moment-locale-test.js 790 B

1234567891011121314151617181920212223242526272829303132
  1. import Ember from 'ember';
  2. import { initialize } from '../../../initializers/moment-locale';
  3. import { module, test } from 'qunit';
  4. var container, application;
  5. var documentLang = null;
  6. module('MomentLocaleInitializer', {
  7. beforeEach: function() {
  8. documentLang = Ember.$('html').attr('lang');
  9. Ember.run(function() {
  10. application = Ember.Application.create();
  11. container = application.__container__;
  12. application.deferReadiness();
  13. });
  14. },
  15. afterEach: function() {
  16. Ember.$('html').attr('lang', documentLang);
  17. moment.locale(documentLang);
  18. }
  19. });
  20. test('initializer changes moment.js locale', function(assert) {
  21. assert.expect(1);
  22. Ember.$('html').attr('lang', 'pl');
  23. initialize(container, application);
  24. assert.equal(moment.locale(), 'pl');
  25. });