model-pagination-test.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import Ember from 'ember';
  2. import { module, test } from 'qunit';
  3. import startApp from '../helpers/start-app';
  4. import createUser from '../helpers/create-user';
  5. var application, container, auth;
  6. module('Acceptance: Model Pagination Mixin', {
  7. beforeEach: function() {
  8. application = startApp();
  9. container = application.__container__;
  10. auth = container.lookup('service:auth');
  11. },
  12. afterEach: function() {
  13. Ember.run(application, 'destroy');
  14. Ember.$.mockjax.clear();
  15. }
  16. });
  17. test('pagination redirects from explicit first page', function(assert) {
  18. var user = createUser();
  19. auth.setProperties({
  20. 'isAuthenticated': true,
  21. 'user': user
  22. });
  23. Ember.$.mockjax({
  24. url: '/api/ranks/',
  25. status: 200,
  26. responseText: [{
  27. 'id': 3,
  28. 'name': 'Test Rank',
  29. 'slug': 'test-rank',
  30. 'description': '',
  31. 'css_class': '',
  32. 'is_tab': true
  33. }]
  34. });
  35. Ember.$.mockjax({
  36. url: '/api/users/?list=rank&rank=test-rank',
  37. status: 200,
  38. responseText: []
  39. });
  40. assert.expect(1);
  41. visit('/users/');
  42. andThen(function() {
  43. console.log(find('.nav-tabs').text())
  44. assert.equal(currentPath(), 'users.rank.index');
  45. });
  46. });