forum-footer-test.js 3.3 KB

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