mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-04-04 09:33:24 -04:00
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
/*global QUnit:false*/
|
|
|
|
import moment from '../moment';
|
|
import { defineCommonLocaleTests } from './helpers/common-locale';
|
|
import { setupDeprecationHandler, teardownDeprecationHandler } from './helpers/deprecation-handler';
|
|
|
|
export var test = QUnit.test;
|
|
|
|
export var expect = QUnit.expect;
|
|
|
|
export function module (name, lifecycle) {
|
|
QUnit.module(name, {
|
|
setup : function () {
|
|
moment.locale('en');
|
|
moment.createFromInputFallback = function (config) {
|
|
throw new Error('input not handled by moment: ' + config._i);
|
|
};
|
|
setupDeprecationHandler(test, moment, 'core');
|
|
if (lifecycle && lifecycle.setup) {
|
|
lifecycle.setup();
|
|
}
|
|
},
|
|
teardown : function () {
|
|
teardownDeprecationHandler(test, moment, 'core');
|
|
if (lifecycle && lifecycle.teardown) {
|
|
lifecycle.teardown();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
export function localeModule (name, lifecycle) {
|
|
QUnit.module('locale:' + name, {
|
|
setup : function () {
|
|
moment.locale(name);
|
|
moment.createFromInputFallback = function (config) {
|
|
throw new Error('input not handled by moment: ' + config._i);
|
|
};
|
|
setupDeprecationHandler(test, moment, 'locale');
|
|
if (lifecycle && lifecycle.setup) {
|
|
lifecycle.setup();
|
|
}
|
|
},
|
|
teardown : function () {
|
|
moment.locale('en');
|
|
teardownDeprecationHandler(test, moment, 'locale');
|
|
if (lifecycle && lifecycle.teardown) {
|
|
lifecycle.teardown();
|
|
}
|
|
}
|
|
});
|
|
defineCommonLocaleTests(name, -1, -1);
|
|
}
|