index-test.js 745 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import {
  2. moduleFor,
  3. test
  4. } from 'ember-qunit';
  5. var document_title = document.title;
  6. moduleFor('route:index', 'IndexRoute', {
  7. afterEach: function() {
  8. document.title = document_title;
  9. }
  10. });
  11. test('it exists', function(assert) {
  12. var route = this.subject();
  13. assert.ok(route);
  14. });
  15. test('sets title correctly', function(assert) {
  16. var route = this.subject();
  17. route.set('settings', {
  18. 'forum_index_title': '',
  19. 'forum_name': 'Forum Name',
  20. });
  21. route.send('didTransition');
  22. assert.equal(document.title, 'Forum Name');
  23. route.set('settings', {
  24. 'forum_index_title': 'Welcome to Forum!',
  25. 'forum_name': 'Forum Name',
  26. });
  27. route.send('didTransition');
  28. assert.equal(document.title, 'Welcome to Forum!');
  29. });