moment-locale-test.js 769 B

123456789101112131415161718192021222324252627282930
  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. Ember.$('html').attr('lang', 'pl');
  22. initialize(container, application);
  23. assert.equal(moment.locale(), 'pl');
  24. });