footer-test.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import {
  2. moduleFor,
  3. test
  4. } from 'ember-qunit';
  5. moduleFor('controller:footer', 'FooterController');
  6. test('it exists', function(assert) {
  7. var controller = this.subject();
  8. assert.ok(controller);
  9. });
  10. test('showTermsLink', function(assert) {
  11. assert.expect(4);
  12. var controller = this.subject();
  13. // ToS isn't defined and there isn't link to remote ToS page, don't show link
  14. controller.set('settings', {'terms_of_service': null, 'terms_of_service_link': ''});
  15. assert.ok(!controller.get('showTermsLink'));
  16. // ToS is defined but there isn't link to remote ToS page, show link
  17. controller.set('settings', {'terms_of_service': true, 'terms_of_service_link': ''});
  18. assert.ok(controller.get('showTermsLink'));
  19. // ToS isn't defined but there is link to remote ToS page, show link
  20. controller.set('settings', {'terms_of_service': null, 'terms_of_service_link': 'http://somewhere.com'});
  21. assert.ok(controller.get('showTermsLink'));
  22. // ToS is defined and there is link to remote ToS page, show link
  23. controller.set('settings', {'terms_of_service': true, 'terms_of_service_link': 'http://somewhere.com'});
  24. assert.ok(controller.get('showTermsLink'));
  25. });
  26. test('showPrivacyLink', function(assert) {
  27. assert.expect(4);
  28. var controller = this.subject();
  29. // PrivPolicy isn't defined and there isn't link to remote PrivPolicy page, don't show link
  30. controller.set('settings', {'privacy_policy': null, 'privacy_policy_link': ''});
  31. assert.ok(!controller.get('showPrivacyLink'));
  32. // PrivPolicy is defined but there isn't link to remote PrivPolicy page, show link
  33. controller.set('settings', {'privacy_policy': true, 'privacy_policy_link': ''});
  34. assert.ok(controller.get('showPrivacyLink'));
  35. // PrivPolicy isn't defined but there is link to remote PrivPolicy page, show link
  36. controller.set('settings', {'privacy_policy': null, 'privacy_policy_link': 'http://somewhere.com'});
  37. assert.ok(controller.get('showPrivacyLink'));
  38. // PrivPolicy is defined and there is link to remote PrivPolicy page, show link
  39. controller.set('settings', {'privacy_policy': true, 'privacy_policy_link': 'http://somewhere.com'});
  40. assert.ok(controller.get('showPrivacyLink'));
  41. });
  42. test('showNav', function(assert) {
  43. assert.expect(4);
  44. var controller = this.subject();
  45. // no Privacy Policy or ToS, don't show footer nav
  46. controller.set('settings', {
  47. 'terms_of_service': null, 'terms_of_service_link': '',
  48. 'privacy_policy': null, 'privacy_policy_link': ''
  49. });
  50. assert.ok(!controller.get('showNav'));
  51. // Privacy Policy but no ToS, don't show footer nav
  52. controller.set('settings', {
  53. 'terms_of_service': null, 'terms_of_service_link': '',
  54. 'privacy_policy': true, 'privacy_policy_link': ''
  55. });
  56. assert.ok(controller.get('showNav'));
  57. // no Privacy Policy but ToS, don't show footer nav
  58. controller.set('settings', {
  59. 'terms_of_service': null, 'terms_of_service_link': 'http://somewhere.com',
  60. 'privacy_policy': null, 'privacy_policy_link': ''
  61. });
  62. assert.ok(controller.get('showNav'));
  63. // Privacy Policy and ToS, don't show footer nav
  64. controller.set('settings', {
  65. 'terms_of_service': null, 'terms_of_service_link': 'http://somewhere.com',
  66. 'privacy_policy': null, 'privacy_policy_link': 'http://somewhere.com'
  67. });
  68. assert.ok(controller.get('showNav'));
  69. });