footer-test.js 3.1 KB

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