'), transclude: true });
+QUnit.test('default template engine should preserve element for transcluded templates', function(assert) {
+ const $element = $('
');
+ const template = new Template($element);
+ const $result = template.render({ model: null, container: $('
'), transclude: true });
- assert.equal($result[0], $element[0]);
- });
+ assert.equal($result[0], $element[0]);
});
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/accordion.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/accordion.tests.js
index 1aa8ec8d966b..73fb8de9fa96 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/accordion.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/accordion.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/accordion');
-require('integration/knockout');
+import 'ui/accordion';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('accordion');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/actionSheet.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/actionSheet.tests.js
index 915242f80339..7f9b0f8be278 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/actionSheet.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/actionSheet.tests.js
@@ -1,9 +1,9 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const ko = require('knockout');
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import ko from 'knockout';
-require('ui/action_sheet');
-require('integration/knockout');
+import 'ui/action_sheet';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('actionSheet');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/autocomplete.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/autocomplete.tests.js
index 75e68a92ef42..051095d87f9e 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/autocomplete.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/autocomplete.tests.js
@@ -1,9 +1,9 @@
-const $ = require('jquery');
-const keyboardMock = require('../../helpers/keyboardMock.js');
-const ko = require('knockout');
-const Autocomplete = require('ui/autocomplete');
+import $ from 'jquery';
+import keyboardMock from '../../helpers/keyboardMock.js';
+import ko from 'knockout';
+import Autocomplete from 'ui/autocomplete';
-require('integration/knockout');
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('autocomplete');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/box.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/box.tests.js
index dcf294de0542..895ea354435f 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/box.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/box.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/box');
-require('integration/knockout');
+import 'ui/box';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('box');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/calendar.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/calendar.tests.js
index 67b304370855..36c48366dbfa 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/calendar.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/calendar.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('integration/knockout');
-require('ui/calendar');
+import 'integration/knockout';
+import 'ui/calendar';
if(QUnit.urlParams['nocsp']) {
QUnit.module('calendar');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/cleanNode.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/cleanNode.tests.js
index 09d033a2cb0f..18cfac3f7b09 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/cleanNode.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/cleanNode.tests.js
@@ -1,8 +1,8 @@
-require('integration/knockout');
+import 'integration/knockout';
-const $ = require('jquery');
-const ko = require('knockout');
-const dataUtils = require('core/element_data');
+import $ from 'jquery';
+import ko from 'knockout';
+import * as dataUtils from 'core/element_data';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/collectionWidget.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/collectionWidget.tests.js
index 85fc6c1a9364..782302d79e69 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/collectionWidget.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/collectionWidget.tests.js
@@ -1,10 +1,10 @@
-const $ = require('jquery');
-const ko = require('knockout');
-const registerComponent = require('core/component_registrator');
-const CollectionWidget = require('ui/collection/ui.collection_widget.edit');
-const executeAsyncMock = require('../../helpers/executeAsyncMock.js');
+import $ from 'jquery';
+import ko from 'knockout';
+import registerComponent from 'core/component_registrator';
+import CollectionWidget from 'ui/collection/ui.collection_widget.edit';
+import executeAsyncMock from '../../helpers/executeAsyncMock.js';
-require('integration/knockout');
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/componentRegistration.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/componentRegistration.tests.js
index f50865a4f32a..34b6cf81b199 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/componentRegistration.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/componentRegistration.tests.js
@@ -1,17 +1,17 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const ko = require('knockout');
-const registerComponent = require('core/component_registrator');
-const DOMComponent = require('core/dom_component');
-const Widget = require('ui/widget/ui.widget');
-const KoTemplate = require('__internal/integration/knockout/template').KoTemplate;
-const CollectionWidget = require('ui/collection/ui.collection_widget.edit');
-const config = require('core/config');
-const dataUtils = require('core/element_data');
-
-require('ui/select_box');
-require('ui/lookup');
-require('integration/knockout');
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import ko from 'knockout';
+import registerComponent from 'core/component_registrator';
+import DOMComponent from 'core/dom_component';
+import Widget from 'ui/widget/ui.widget';
+import { KoTemplate } from '__internal/integration/knockout/template';
+import CollectionWidget from 'ui/collection/ui.collection_widget.edit';
+import config from 'core/config';
+import * as dataUtils from 'core/element_data';
+
+import 'ui/select_box';
+import 'ui/lookup';
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/contextMenu.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/contextMenu.tests.js
index 2e00952a03ae..007675bd338a 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/contextMenu.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/contextMenu.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/context_menu');
-require('integration/knockout');
+import 'ui/context_menu';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('contextMenu');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/draggable.test.js b/packages/devextreme/testing/tests/DevExpress.knockout/draggable.test.js
index 158144782ee3..3fd767fb6891 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/draggable.test.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/draggable.test.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/draggable');
-require('integration/knockout');
+import 'ui/draggable';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('draggable');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/dropDownEditor.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/dropDownEditor.tests.js
index 71c25bda8a73..b37dce285d97 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/dropDownEditor.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/dropDownEditor.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('integration/knockout');
-require('ui/drop_down_editor/ui.drop_down_editor');
+import 'integration/knockout';
+import 'ui/drop_down_editor/ui.drop_down_editor';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/eventRegistration.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/eventRegistration.tests.js
index d361180f9fd4..9f374cff9ec4 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/eventRegistration.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/eventRegistration.tests.js
@@ -1,13 +1,13 @@
-const $ = require('jquery');
-const ko = require('knockout');
-const registerEvent = require('common/core/events/core/event_registrator');
-const dragEvents = require('common/core/events/drag');
-const clickEvent = require('common/core/events/click');
-const holdEvent = require('common/core/events/hold');
-const pointerEvents = require('common/core/events/pointer');
-const swipeEvents = require('common/core/events/swipe');
-
-require('integration/knockout');
+import $ from 'jquery';
+import ko from 'knockout';
+import registerEvent from 'common/core/events/core/event_registrator';
+import * as dragEvents from 'common/core/events/drag';
+import * as clickEvent from 'common/core/events/click';
+import holdEvent from 'common/core/events/hold';
+import pointerEvents from 'common/core/events/pointer';
+import * as swipeEvents from 'common/core/events/swipe';
+
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/fieldset_bundled.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/fieldset_bundled.tests.js
index fca674de95b1..a06d1f04ed40 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/fieldset_bundled.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/fieldset_bundled.tests.js
@@ -1,12 +1,12 @@
-const $ = require('jquery');
-const ko = require('knockout');
-const browser = require('core/utils/browser');
-const devices = require('core/devices');
-
-require('fluent_blue_light.css!');
-require('../../helpers/executeAsyncMock.js');
-require('integration/knockout');
-require('bundles/modules/parts/widgets-web');
+import $ from 'jquery';
+import ko from 'knockout';
+import browser from 'core/utils/browser';
+import devices from 'core/devices';
+
+import 'fluent_blue_light.css!';
+import '../../helpers/executeAsyncMock.js';
+import 'integration/knockout';
+import 'bundles/modules/parts/widgets-web';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/list.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/list.tests.js
index ccaef0f8ac54..e714b13b60fa 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/list.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/list.tests.js
@@ -1,13 +1,13 @@
// eslint-disable-next-line spellcheck/spell-checker
-const { rerender } = require('inferno');
-const $ = require('jquery');
-const ko = require('knockout');
-const executeAsyncMock = require('../../helpers/executeAsyncMock.js');
+import { rerender } from 'inferno';
+import $ from 'jquery';
+import ko from 'knockout';
+import executeAsyncMock from '../../helpers/executeAsyncMock.js';
-require('ui/list');
-require('integration/knockout');
+import 'ui/list';
+import 'integration/knockout';
-require('fluent_blue_light.css!');
+import 'fluent_blue_light.css!';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/loadPanel.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/loadPanel.tests.js
index fd1a488e1d02..1c0bac242b33 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/loadPanel.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/loadPanel.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/load_panel');
-require('integration/knockout');
+import 'ui/load_panel';
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/lookup.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/lookup.tests.js
index dce97a7ad480..e8a4e4f54572 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/lookup.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/lookup.tests.js
@@ -1,10 +1,10 @@
-const $ = require('jquery');
-const fx = require('common/core/animation/fx');
-const executeAsyncMock = require('../../helpers/executeAsyncMock.js');
-const ko = require('knockout');
+import $ from 'jquery';
+import fx from 'common/core/animation/fx';
+import executeAsyncMock from '../../helpers/executeAsyncMock.js';
+import ko from 'knockout';
-require('ui/lookup');
-require('integration/knockout');
+import 'ui/lookup';
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/objectUtils.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/objectUtils.tests.js
index 957c8333967d..40473d14344f 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/objectUtils.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/objectUtils.tests.js
@@ -1,8 +1,8 @@
-const ko = require('knockout');
-const variableWrapper = require('core/utils/variable_wrapper');
-const objectUtils = require('core/utils/object');
+import ko from 'knockout';
+import variableWrapper from 'core/utils/variable_wrapper';
+import * as objectUtils from 'core/utils/object';
-require('integration/knockout');
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('objectUtils');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/overlay.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/overlay.tests.js
index 43e88500b53c..589945083c9d 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/overlay.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/overlay.tests.js
@@ -1,12 +1,12 @@
-const $ = require('jquery');
-const fx = require('common/core/animation/fx');
-const ko = require('knockout');
+import $ from 'jquery';
+import fx from 'common/core/animation/fx';
+import ko from 'knockout';
-require('ui/overlay/ui.overlay');
-require('ui/slider');
-require('integration/knockout');
+import 'ui/overlay/ui.overlay';
+import 'ui/slider';
+import 'integration/knockout';
-require('fluent_blue_light.css!');
+import 'fluent_blue_light.css!';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/pivotGrid.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/pivotGrid.tests.js
index 371579a4c8f6..8bba7db3198d 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/pivotGrid.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/pivotGrid.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/pivot_grid/ui.pivot_grid');
-require('integration/knockout');
+import 'ui/pivot_grid/ui.pivot_grid';
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/popup.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/popup.tests.js
index 7674a1d2da9b..786a39b98e49 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/popup.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/popup.tests.js
@@ -1,11 +1,11 @@
-const $ = require('jquery');
-const viewPort = require('core/utils/view_port').value;
-const devices = require('core/devices');
-const themes = require('ui/themes');
-const ko = require('knockout');
-
-require('ui/popup');
-require('integration/knockout');
+import $ from 'jquery';
+import { value as viewPort } from 'core/utils/view_port';
+import devices from 'core/devices';
+import themes from 'ui/themes';
+import ko from 'knockout';
+
+import 'ui/popup';
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/scheduler.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/scheduler.tests.js
index 9e4e250dd210..7c7d4a27cbb3 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/scheduler.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/scheduler.tests.js
@@ -1,11 +1,11 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('integration/knockout');
-require('ui/scheduler');
-const { waitAsync } = require('../../helpers/scheduler/waitForAsync.js');
+import 'integration/knockout';
+import 'ui/scheduler';
+import { waitAsync } from '../../helpers/scheduler/waitForAsync.js';
-require('fluent_blue_light.css!');
+import 'fluent_blue_light.css!';
if(QUnit.urlParams['nocsp']) {
QUnit.module('scheduler');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/selectBox.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/selectBox.tests.js
index e1ef4e07e3a6..ebbcd6d86678 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/selectBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/selectBox.tests.js
@@ -1,9 +1,9 @@
-const $ = require('jquery');
-const SelectBox = require('ui/select_box');
-const fx = require('common/core/animation/fx');
-const ko = require('knockout');
+import $ from 'jquery';
+import SelectBox from 'ui/select_box';
+import fx from 'common/core/animation/fx';
+import ko from 'knockout';
-require('integration/knockout');
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/sortable.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/sortable.tests.js
index d8ed65f0ad23..2a957de9f147 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/sortable.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/sortable.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/sortable');
-require('integration/knockout');
+import 'ui/sortable';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('sortable');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/tabs.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/tabs.tests.js
index 04b7d4ecb257..6f0e24c9e0c5 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/tabs.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/tabs.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/tabs');
-require('integration/knockout');
+import 'ui/tabs';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('tabs');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/tagBox.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/tagBox.tests.js
index 0669839de5d5..a3da1992fc6c 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/tagBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/tagBox.tests.js
@@ -1,9 +1,9 @@
-const $ = require('jquery');
-const TagBox = require('ui/tag_box');
-const fx = require('common/core/animation/fx');
-const ko = require('knockout');
+import $ from 'jquery';
+import TagBox from 'ui/tag_box';
+import fx from 'common/core/animation/fx';
+import ko from 'knockout';
-require('integration/knockout');
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/template.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/template.tests.js
index d1c93959a99b..0a0e61558a83 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/template.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/template.tests.js
@@ -1,7 +1,7 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const ko = require('knockout');
-const KoTemplate = require('__internal/integration/knockout/template').KoTemplate;
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import ko from 'knockout';
+import { KoTemplate } from '__internal/integration/knockout/template';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/toolbar.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/toolbar.tests.js
index c062021fd46d..feed2c66c09f 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/toolbar.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/toolbar.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/toolbar');
-require('integration/knockout');
+import 'ui/toolbar';
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/treeList.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/treeList.tests.js
index c373b4e03a6c..cd28b27a44cb 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/treeList.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/treeList.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const ko = require('knockout');
+import $ from 'jquery';
+import ko from 'knockout';
-require('ui/tree_list');
-require('integration/knockout');
+import 'ui/tree_list';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('treeList');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/treeView.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/treeView.tests.js
index f36d202feda9..e315f3c49d4e 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/treeView.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/treeView.tests.js
@@ -1,10 +1,10 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const ko = require('knockout');
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import ko from 'knockout';
-require('ui/button');
-require('ui/tree_view');
-require('integration/knockout');
+import 'ui/button';
+import 'ui/tree_view';
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('treeView');
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/validationGroup.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/validationGroup.tests.js
index 53552dd61d28..03cafdd745ad 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/validationGroup.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/validationGroup.tests.js
@@ -1,11 +1,11 @@
-const $ = require('jquery');
-const ko = require('knockout');
-const ValidationEngine = require('ui/validation_engine');
-
-require('ui/text_box');
-require('ui/validation_group');
-require('ui/validator');
-require('integration/knockout');
+import $ from 'jquery';
+import ko from 'knockout';
+import ValidationEngine from 'ui/validation_engine';
+
+import 'ui/text_box';
+import 'ui/validation_group';
+import 'ui/validator';
+import 'integration/knockout';
const moduleWithoutCsp = QUnit.urlParams['nocsp'] ? QUnit.module : QUnit.module.skip;
diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/variableWrapperUtils.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/variableWrapperUtils.tests.js
index a43c88e1ab7f..bc793dc7d40c 100644
--- a/packages/devextreme/testing/tests/DevExpress.knockout/variableWrapperUtils.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.knockout/variableWrapperUtils.tests.js
@@ -1,8 +1,8 @@
-const ko = require('knockout');
-const variableWrapper = require('core/utils/variable_wrapper');
-const { logger } = require('core/utils/console');
+import ko from 'knockout';
+import variableWrapper from 'core/utils/variable_wrapper';
+import { logger } from 'core/utils/console';
-require('integration/knockout');
+import 'integration/knockout';
if(QUnit.urlParams['nocsp']) {
QUnit.module('variableWrapperUtils');
diff --git a/packages/devextreme/testing/tests/DevExpress.localization/ldml.tests.js b/packages/devextreme/testing/tests/DevExpress.localization/ldml.tests.js
index b96f360e315f..c368509ea446 100644
--- a/packages/devextreme/testing/tests/DevExpress.localization/ldml.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.localization/ldml.tests.js
@@ -1,17 +1,15 @@
-require('../../helpers/noIntl.js');
-const getNumberFormatter = require('common/core/localization/ldml/number').getFormatter;
-const getNumberFormat = require('common/core/localization/ldml/number').getFormat;
-const getDateParser = require('common/core/localization/ldml/date.parser').getParser;
-const getRegExpInfo = require('common/core/localization/ldml/date.parser').getRegExpInfo;
-const getDateFormatter = require('common/core/localization/ldml/date.formatter').getFormatter;
-const getDateFormat = require('common/core/localization/ldml/date.format').getFormat;
-const defaultDateNames = require('common/core/localization/default_date_names');
-const numberLocalization = require('common/core/localization/number');
-const dateLocalization = require('common/core/localization/date');
-const extend = require('core/utils/extend').extend;
-const console = require('core/utils/console').logger;
-
-require('common/core/localization/currency');
+import '../../helpers/noIntl.js';
+import { getFormatter as getNumberFormatter, getFormat as getNumberFormat } from 'common/core/localization/ldml/number';
+import { getParser as getDateParser, getRegExpInfo } from 'common/core/localization/ldml/date.parser';
+import { getFormatter as getDateFormatter } from 'common/core/localization/ldml/date.formatter';
+import { getFormat as getDateFormat } from 'common/core/localization/ldml/date.format';
+import defaultDateNames from 'common/core/localization/default_date_names';
+import numberLocalization from 'common/core/localization/number';
+import dateLocalization from 'common/core/localization/date';
+import { extend } from 'core/utils/extend';
+import { logger as console } from 'core/utils/console';
+
+import 'common/core/localization/currency';
const dateParts = extend({}, defaultDateNames, {
getPeriodNames: function() {
@@ -406,14 +404,14 @@ QUnit.module('number formatter', () => {
assert.deepEqual(regExpInfo.patterns, [
'HH', '\' h \'', 'mm'
]);
- // eslint-disable-next-line no-useless-escape
+
assert.deepEqual(regExpInfo.regexp, /^(2[0-3]|1[0-9]|0?[0-9])(\ h\ )([1-5][0-9]|0?[0-9])$/i);
regExpInfo = getRegExpInfo('HH:mm', parts);
assert.deepEqual(regExpInfo.patterns, [
'HH', ':', 'mm'
]);
- // eslint-disable-next-line no-useless-escape
+
assert.deepEqual(regExpInfo.regexp, /^(2[0-3]|1[0-9]|0?[0-9])(h|:)([1-5][0-9]|0?[0-9])$/i);
parts.getTimeSeparator = function() {
@@ -423,7 +421,7 @@ QUnit.module('number formatter', () => {
assert.deepEqual(regExpInfo.patterns, [
'HH', ':', 'mm'
]);
- // eslint-disable-next-line no-useless-escape
+
assert.deepEqual(regExpInfo.regexp, /^(2[0-3]|1[0-9]|0?[0-9])(\[\.\]|:)([1-5][0-9]|0?[0-9])$/i);
});
diff --git a/packages/devextreme/testing/tests/DevExpress.localization/localization.custom.tests.js b/packages/devextreme/testing/tests/DevExpress.localization/localization.custom.tests.js
index c3079b762b39..254848e54d1f 100644
--- a/packages/devextreme/testing/tests/DevExpress.localization/localization.custom.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.localization/localization.custom.tests.js
@@ -1,5 +1,5 @@
-const numberLocalization = require('common/core/localization/number');
-const dateLocalization = require('common/core/localization/date');
+import numberLocalization from 'common/core/localization/number';
+import dateLocalization from 'common/core/localization/date';
QUnit.module('Custom date names', {
beforeEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.tests.js b/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.tests.js
index d028a628baf6..02a4ec2b0a06 100644
--- a/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.tests.js
@@ -1,957 +1,933 @@
-SystemJS.config({
- meta: {
- './localization.base.tests.js': {
- deps: [
- 'common/core/localization/globalize/core',
- 'common/core/localization/globalize/number',
- 'common/core/localization/globalize/currency',
- 'common/core/localization/globalize/date',
- 'common/core/localization/globalize/message'
- ]
- }
- },
- packages: {
- 'globalize': {
- meta: {
- '../globalize.js': {
- deps: ['cldr/unresolved']
- }
- }
- }
- }
-});
+import 'common/core/localization/globalize/core';
+import 'common/core/localization/globalize/number';
+import 'common/core/localization/globalize/currency';
+import 'common/core/localization/globalize/date';
+import 'common/core/localization/globalize/message';
-define(function(require, exports, module) {
- const cldrData = [
- require('devextreme-cldr-data/ar.json!json'),
- require('devextreme-cldr-data/ru.json!json'),
- require('devextreme-cldr-data/de.json!json'),
- require('devextreme-cldr-data/da.json!json')
- ];
+import { generateDate as generateExpectedDate } from '../../helpers/dateHelper.js';
- require('common/core/localization/globalize/core');
- require('common/core/localization/globalize/number');
- require('common/core/localization/globalize/currency');
- require('common/core/localization/globalize/date');
- require('common/core/localization/globalize/message');
+import $ from 'jquery';
+import Globalize from 'globalize';
+import numberLocalization from 'common/core/localization/number';
+import dateLocalization from 'common/core/localization/date';
+import messageLocalization from 'common/core/localization/message';
+import config from 'core/config';
- const generateExpectedDate = require('../../helpers/dateHelper.js').generateDate;
+import ExcelJSLocalizationFormatTests from '../DevExpress.exporter/exceljsParts/exceljs.format.tests.js';
- const $ = require('jquery');
- const Globalize = require('globalize');
- const numberLocalization = require('common/core/localization/number');
- const dateLocalization = require('common/core/localization/date');
- const messageLocalization = require('common/core/localization/message');
- const config = require('core/config');
+import likelySubtags from 'cldr-core/supplemental/likelySubtags.json!';
- const ExcelJSLocalizationFormatTests = require('../DevExpress.exporter/exceljsParts/exceljs.format.tests.js');
+import { noop } from 'core/utils/common';
+import formatHelper from 'format_helper';
+import browser from 'core/utils/browser';
+import dateUtils from 'core/utils/date';
- const likelySubtags = require('cldr-core/supplemental/likelySubtags.json!');
- Globalize.load(likelySubtags);
+import sharedTests from './sharedParts/localization.shared.js';
- cldrData.forEach(localeCldrData => {
- Globalize.load(localeCldrData);
- });
+import ar from 'devextreme-cldr-data/ar.json!json';
+import ru from 'devextreme-cldr-data/ru.json!json';
+import de from 'devextreme-cldr-data/de.json!json';
+import da from 'devextreme-cldr-data/da.json!json';
- const NBSP = String.fromCharCode(160);
- const RUB = String.fromCharCode(8381);
+const cldrData = [ar, ru, de, da];
- const noop = require('core/utils/common').noop;
- const formatHelper = require('format_helper');
- const browser = require('core/utils/browser');
- const dateUtils = require('core/utils/date');
+Globalize.load(likelySubtags);
- const sharedTests = require('./sharedParts/localization.shared.js').default;
+cldrData.forEach(localeCldrData => {
+ Globalize.load(localeCldrData);
+});
- const NEGATIVE_NUMBERS = [-4.645, -35.855];
- const ROUNDING_CORRECTION = {
- '-4.64': '-4.65',
- '-35.85': '-35.86'
- };
+const NBSP = String.fromCharCode(160);
+const RUB = String.fromCharCode(8381);
+
+const NEGATIVE_NUMBERS = [-4.645, -35.855];
+const ROUNDING_CORRECTION = {
+ '-4.64': '-4.65',
+ '-35.85': '-35.86'
+};
+
+function isIosWithMSKTimeZone() {
+ const isIos = navigator.userAgent.indexOf('Mac OS X') > -1 && browser['webkit'];
+ const hasMSKTimeZone = new Date().toString().indexOf('MSK') > -1;
+
+ return isIos && hasMSKTimeZone;
+}
+
+QUnit.module('Globalize common', {
+ before: function() {
+ numberLocalization.inject({
+ format: function(value, format) {
+ // NOTE: Globalizejs implementation of negative number rounding differs from Intl.
+ // https://github.com/globalizejs/globalize/issues/884
+ // If the fractional portion is exactly 0.5 and the argument is negative,
+ // the argument is rounded to the next integer in the positive direction
+ let result = this.callBase.apply(this, arguments);
+ if(NEGATIVE_NUMBERS.indexOf(value) !== -1 && format.type === 'fixedPoint' && format.precision === 2 && !!ROUNDING_CORRECTION[result]) {
+ result = ROUNDING_CORRECTION[result];
+ }
+ return result;
+ }
+ });
+ }
+}, function() {
- function isIosWithMSKTimeZone() {
- const isIos = navigator.userAgent.indexOf('Mac OS X') > -1 && browser['webkit'];
- const hasMSKTimeZone = new Date().toString().indexOf('MSK') > -1;
+ QUnit.test('engine', function(assert) {
+ assert.equal(numberLocalization.engine(), 'globalize');
+ assert.equal(dateLocalization.engine(), 'globalize');
+ assert.equal(messageLocalization.engine(), 'globalize');
+ });
+
+ sharedTests();
+});
- return isIos && hasMSKTimeZone;
+QUnit.module('Localization date (ru)', {
+ beforeEach: function() {
+ Globalize.locale('ru');
+ },
+ afterEach: function() {
+ Globalize.locale('en');
}
+}, () => {
+ QUnit.test('getFormatParts', function(assert) {
+ assert.equal(dateLocalization.getFormatParts('dayofweek').length, 0);
+ assert.equal(dateLocalization.getFormatParts('shortdate').join(' '), 'day month year');
+ assert.equal(dateLocalization.getFormatParts('longDateLongTime').join(' '), 'day month year hours minutes seconds');
+ assert.equal(dateLocalization.getFormatParts('d - M - y, hh:mm:ss [SSS]').join(' '), 'day month year hours minutes seconds milliseconds');
+ assert.equal(dateLocalization.getFormatParts('ah:mm').join(' '), 'hours minutes'); // T460693
+ });
- QUnit.module('Globalize common', {
- before: function() {
- numberLocalization.inject({
- format: function(value, format) {
- // NOTE: Globalizejs implementation of negative number rounding differs from Intl.
- // https://github.com/globalizejs/globalize/issues/884
- // If the fractional portion is exactly 0.5 and the argument is negative,
- // the argument is rounded to the next integer in the positive direction
- let result = this.callBase.apply(this, arguments);
- if(NEGATIVE_NUMBERS.indexOf(value) !== -1 && format.type === 'fixedPoint' && format.precision === 2 && !!ROUNDING_CORRECTION[result]) {
- result = ROUNDING_CORRECTION[result];
- }
- return result;
- }
- });
- }
- }, function() {
+ QUnit.test('getMonthNames', function(assert) {
+ assert.deepEqual(dateLocalization.getMonthNames(),
+ ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
+ 'Array of month names');
+ });
- QUnit.test('engine', function(assert) {
- assert.equal(numberLocalization.engine(), 'globalize');
- assert.equal(dateLocalization.engine(), 'globalize');
- assert.equal(messageLocalization.engine(), 'globalize');
- });
+ QUnit.test('getMonthNames with specified type', function(assert) {
+ assert.deepEqual(dateLocalization.getMonthNames('wide', 'format'),
+ ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'],
+ 'Array of month names');
+ });
- sharedTests();
+ QUnit.test('getMonthNames with type=\'standalone\'', function(assert) {
+ assert.deepEqual(dateLocalization.getMonthNames('wide', 'standalone'),
+ ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
+ 'Array of month names');
});
- QUnit.module('Localization date (ru)', {
- beforeEach: function() {
- Globalize.locale('ru');
- },
- afterEach: function() {
- Globalize.locale('en');
- }
- }, () => {
- QUnit.test('getFormatParts', function(assert) {
- assert.equal(dateLocalization.getFormatParts('dayofweek').length, 0);
- assert.equal(dateLocalization.getFormatParts('shortdate').join(' '), 'day month year');
- assert.equal(dateLocalization.getFormatParts('longDateLongTime').join(' '), 'day month year hours minutes seconds');
- assert.equal(dateLocalization.getFormatParts('d - M - y, hh:mm:ss [SSS]').join(' '), 'day month year hours minutes seconds milliseconds');
- assert.equal(dateLocalization.getFormatParts('ah:mm').join(' '), 'hours minutes'); // T460693
- });
+ QUnit.test('getPeriodNames', function(assert) {
+ assert.deepEqual(dateLocalization.getPeriodNames(), ['AM', 'PM'], 'Array of period names');
- QUnit.test('getMonthNames', function(assert) {
- assert.deepEqual(dateLocalization.getMonthNames(),
- ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
- 'Array of month names');
- });
+ Globalize.locale('ar');
- QUnit.test('getMonthNames with specified type', function(assert) {
- assert.deepEqual(dateLocalization.getMonthNames('wide', 'format'),
- ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'],
- 'Array of month names');
- });
+ [null, 'abbreviated', 'wide', 'narrow'].forEach(format => {
+ ['format', null].forEach(type => {
+ const expect = ([null, 'wide'].includes(format) && type == null) ? ['صباحًا', 'مساءً'] : ['ص', 'م'];
- QUnit.test('getMonthNames with type=\'standalone\'', function(assert) {
- assert.deepEqual(dateLocalization.getMonthNames('wide', 'standalone'),
- ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
- 'Array of month names');
+ assert.deepEqual(dateLocalization.getPeriodNames(format, type), expect, 'Array of correct period names');
+ });
});
+ });
- QUnit.test('getPeriodNames', function(assert) {
- assert.deepEqual(dateLocalization.getPeriodNames(), ['AM', 'PM'], 'Array of period names');
-
- Globalize.locale('ar');
+ QUnit.test('getDayNames', function(assert) {
+ assert.deepEqual(dateLocalization.getDayNames(),
+ ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'],
+ 'Array of day names');
+ });
- [null, 'abbreviated', 'wide', 'narrow'].forEach(format => {
- ['format', null].forEach(type => {
- const expect = ([null, 'wide'].includes(format) && type == null) ? ['صباحًا', 'مساءً'] : ['ص', 'م'];
+ QUnit.test('getTimeSeparator', function(assert) {
+ assert.equal(dateLocalization.getTimeSeparator(), ':');
+ });
- assert.deepEqual(dateLocalization.getPeriodNames(format, type), expect, 'Array of correct period names');
- });
- });
+ QUnit.test('format', function(assert) {
+ const expectedValues = {
+ 'day': '2',
+ 'dayofweek': 'понедельник',
+ 'hour': '03',
+ 'longdate': 'понедельник, 2 марта 2015 г.',
+ 'longdatelongtime': 'понедельник, 2 марта 2015 г., 03:04:05',
+ 'longtime': '03:04:05',
+ 'millisecond': '006',
+ 'minute': '04',
+ 'month': 'март',
+ 'monthandday': '2 марта',
+ 'monthandyear': 'март 2015 г.',
+ 'quarter': '1-й кв.',
+ 'quarterandyear': '1-й кв. 2015 г.',
+ 'second': '05',
+ 'shortdate': '02.03.2015',
+ 'shortdateshorttime': '02.03.2015, 03:04',
+ 'shorttime': '03:04',
+ 'shortyear': '15',
+ 'year': '2015',
+
+ 'datetime-local': '2015-03-02T03:04:05',
+ 'yyyy MMMM d': '2015 марта 2',
+ 'ss SSS': '05 006'
+ };
+ const date = new Date(2015, 2, 2, 3, 4, 5);
+
+ date.setMilliseconds(6);
+
+ $.each(expectedValues, function(format, expectedValue) {
+ assert.equal(dateLocalization.format(date, format), expectedValue, format + ' format');
});
- QUnit.test('getDayNames', function(assert) {
- assert.deepEqual(dateLocalization.getDayNames(),
- ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота'],
- 'Array of day names');
- });
-
- QUnit.test('getTimeSeparator', function(assert) {
- assert.equal(dateLocalization.getTimeSeparator(), ':');
- });
-
- QUnit.test('format', function(assert) {
- const expectedValues = {
- 'day': '2',
- 'dayofweek': 'понедельник',
- 'hour': '03',
- 'longdate': 'понедельник, 2 марта 2015 г.',
- 'longdatelongtime': 'понедельник, 2 марта 2015 г., 03:04:05',
- 'longtime': '03:04:05',
- 'millisecond': '006',
- 'minute': '04',
- 'month': 'март',
- 'monthandday': '2 марта',
- 'monthandyear': 'март 2015 г.',
- 'quarter': '1-й кв.',
- 'quarterandyear': '1-й кв. 2015 г.',
- 'second': '05',
- 'shortdate': '02.03.2015',
- 'shortdateshorttime': '02.03.2015, 03:04',
- 'shorttime': '03:04',
- 'shortyear': '15',
- 'year': '2015',
-
- 'datetime-local': '2015-03-02T03:04:05',
- 'yyyy MMMM d': '2015 марта 2',
- 'ss SSS': '05 006'
- };
- const date = new Date(2015, 2, 2, 3, 4, 5);
-
- date.setMilliseconds(6);
-
- $.each(expectedValues, function(format, expectedValue) {
- assert.equal(dateLocalization.format(date, format), expectedValue, format + ' format');
- });
+ assert.equal(dateLocalization.format(date), String(new Date(2015, 2, 2, 3, 4, 5)), 'without format');
+ assert.notOk(dateLocalization.format(), 'without date');
+ });
- assert.equal(dateLocalization.format(date), String(new Date(2015, 2, 2, 3, 4, 5)), 'without format');
- assert.notOk(dateLocalization.format(), 'without date');
- });
+ QUnit.test('format cache for different locales', function(assert) {
+ const originalLocale = Globalize.locale().locale;
+ const date = new Date(2015, 2, 2, 3, 4, 5);
+ try {
+ Globalize.locale('en');
+ assert.equal(dateLocalization.format(date, 'month'), 'March');
+ } finally {
+ Globalize.locale(originalLocale);
+ assert.equal(dateLocalization.format(date, 'month'), 'март');
+ }
+ });
- QUnit.test('format cache for different locales', function(assert) {
- const originalLocale = Globalize.locale().locale;
- const date = new Date(2015, 2, 2, 3, 4, 5);
- try {
- Globalize.locale('en');
- assert.equal(dateLocalization.format(date, 'month'), 'March');
- } finally {
- Globalize.locale(originalLocale);
- assert.equal(dateLocalization.format(date, 'month'), 'март');
+ QUnit.test('parse', function(assert) {
+ const assertData = {
+ 'day': {
+ text: '2',
+ expectedConfig: { day: 2 }
+ },
+ 'hour': {
+ text: '03',
+ expectedConfig: { hours: 3 }
+ },
+ 'longdate': {
+ text: 'понедельник, 2 марта 2015 г.',
+ expected: new Date(2015, 2, 2)
+ },
+ 'longdatelongtime': {
+ text: 'понедельник, 2 марта 2015 г., 3:04:05',
+ expected: new Date(2015, 2, 2, 3, 4, 5)
+ },
+ 'longtime': {
+ text: '3:04:05',
+ expectedConfig: { hours: 3, minutes: 4, seconds: 5 }
+ },
+ 'minute': {
+ text: '04',
+ expectedConfig: { minutes: 4 }
+ },
+ 'month': {
+ text: 'март',
+ expectedConfig: { month: 2, day: 1 }
+ },
+ 'monthandday': {
+ text: '2 марта',
+ expectedConfig: { month: 2, day: 2 }
+ },
+ 'monthandyear': {
+ text: 'март 2015 г.',
+ expected: new Date(2015, 2, 1)
+ },
+ 'second': {
+ text: '05',
+ expectedConfig: { seconds: 5 }
+ },
+ 'shortdate': {
+ text: '02.03.2015',
+ expected: new Date(2015, 2, 2)
+ },
+ 'shortdateshorttime': {
+ text: '02.03.2015, 3:04',
+ expected: new Date(2015, 2, 2, 3, 4)
+ },
+ 'shorttime': {
+ text: '3:04',
+ expectedConfig: { hours: 3, minutes: 4 }
+ },
+ 'shortyear': {
+ text: '15',
+ expected: new Date(2015, 0, 1)
+ },
+ 'year': {
+ text: '2015',
+ expected: new Date(2015, 0, 1)
+ },
+
+ 'datetime-local': {
+ text: '2015-03-02T03:04:05',
+ expected: new Date(2015, 2, 2, 3, 4, 5)
+ },
+ 'yyyy MMMM d': {
+ text: '2015 марта 2',
+ expected: new Date(2015, 2, 2)
}
+ };
+
+ $.each(assertData, function(format, data) {
+ assert.equal(dateLocalization.parse(data.text, format), String(data.expected || generateExpectedDate(data.expectedConfig)), format + ' format');
});
- QUnit.test('parse', function(assert) {
- const assertData = {
- 'day': {
- text: '2',
- expectedConfig: { day: 2 }
- },
- 'hour': {
- text: '03',
- expectedConfig: { hours: 3 }
- },
- 'longdate': {
- text: 'понедельник, 2 марта 2015 г.',
- expected: new Date(2015, 2, 2)
- },
- 'longdatelongtime': {
- text: 'понедельник, 2 марта 2015 г., 3:04:05',
- expected: new Date(2015, 2, 2, 3, 4, 5)
- },
- 'longtime': {
- text: '3:04:05',
- expectedConfig: { hours: 3, minutes: 4, seconds: 5 }
- },
- 'minute': {
- text: '04',
- expectedConfig: { minutes: 4 }
- },
- 'month': {
- text: 'март',
- expectedConfig: { month: 2, day: 1 }
- },
- 'monthandday': {
- text: '2 марта',
- expectedConfig: { month: 2, day: 2 }
- },
- 'monthandyear': {
- text: 'март 2015 г.',
- expected: new Date(2015, 2, 1)
- },
- 'second': {
- text: '05',
- expectedConfig: { seconds: 5 }
- },
- 'shortdate': {
- text: '02.03.2015',
- expected: new Date(2015, 2, 2)
- },
- 'shortdateshorttime': {
- text: '02.03.2015, 3:04',
- expected: new Date(2015, 2, 2, 3, 4)
- },
- 'shorttime': {
- text: '3:04',
- expectedConfig: { hours: 3, minutes: 4 }
- },
- 'shortyear': {
- text: '15',
- expected: new Date(2015, 0, 1)
- },
- 'year': {
- text: '2015',
- expected: new Date(2015, 0, 1)
- },
-
- 'datetime-local': {
- text: '2015-03-02T03:04:05',
- expected: new Date(2015, 2, 2, 3, 4, 5)
- },
- 'yyyy MMMM d': {
- text: '2015 марта 2',
- expected: new Date(2015, 2, 2)
- }
- };
+ assert.equal(dateLocalization.parse('550', 'millisecond').getMilliseconds(), 550, 'millisecond format');
+ assert.equal(dateLocalization.parse('550', 'SSS').getMilliseconds(), 550, 'millisecond format');
- $.each(assertData, function(format, data) {
- assert.equal(dateLocalization.parse(data.text, format), String(data.expected || generateExpectedDate(data.expectedConfig)), format + ' format');
- });
+ assert.equal(dateLocalization.parse(dateLocalization.format(new Date(), 'shortDate')), String(generateExpectedDate({ hours: 0 })), 'without format');
+ assert.notOk(dateLocalization.parse(), 'without date');
- assert.equal(dateLocalization.parse('550', 'millisecond').getMilliseconds(), 550, 'millisecond format');
- assert.equal(dateLocalization.parse('550', 'SSS').getMilliseconds(), 550, 'millisecond format');
+ assert.equal(dateLocalization.parse(Globalize.formatDate(new Date(), { date: 'short' }), { date: 'short' }), String(generateExpectedDate({ hours: 0 })), 'globalize format');
+ });
- assert.equal(dateLocalization.parse(dateLocalization.format(new Date(), 'shortDate')), String(generateExpectedDate({ hours: 0 })), 'without format');
- assert.notOk(dateLocalization.parse(), 'without date');
+ QUnit.test('firstDayOfWeekIndex', function(assert) {
+ assert.equal(dateLocalization.firstDayOfWeekIndex(), 1);
+ });
+});
- assert.equal(dateLocalization.parse(Globalize.formatDate(new Date(), { date: 'short' }), { date: 'short' }), String(generateExpectedDate({ hours: 0 })), 'globalize format');
- });
+QUnit.module('Custom format types', () => {
+ QUnit.test('format: { time: \'medium\' }', function(assert) {
+ assert.equal(dateLocalization.format(new Date(2015, 1, 2, 3, 4, 5, 6), { time: 'medium' }), '3:04:05 AM', 'with object format');
+ });
- QUnit.test('firstDayOfWeekIndex', function(assert) {
- assert.equal(dateLocalization.firstDayOfWeekIndex(), 1);
- });
+ QUnit.test('Parse custom format', function(assert) {
+ const expected = new Date(2010, 2, 2).toString();
+ assert.equal(dateLocalization.parse('20100302', 'yyyyMMdd'), expected, 'Format \'yyyyMMdd\' parse ok');
+ assert.equal(dateLocalization.parse('02mar10', 'dMyyyy'), expected, 'Format \'dMyyyy\' parse ok');
});
+});
- QUnit.module('Custom format types', () => {
- QUnit.test('format: { time: \'medium\' }', function(assert) {
- assert.equal(dateLocalization.format(new Date(2015, 1, 2, 3, 4, 5, 6), { time: 'medium' }), '3:04:05 AM', 'with object format');
+QUnit.module('Localization message (custom locales)', {
+ beforeEach: function() {
+ messageLocalization.load({
+ 'en': {
+ addedKey: 'testValue',
+ hello: 'Hello, {0} {1}'
+ }
+ });
+ }
+}, () => {
+ QUnit.test('Fallback to neutral culture', function(assert) {
+ const originalLocale = Globalize.locale().locale;
+
+ messageLocalization.load({
+ 'ru': {
+ TestBack: 'Back ru',
+ TestCancel: 'Cancel ru'
+ }
});
- QUnit.test('Parse custom format', function(assert) {
- const expected = new Date(2010, 2, 2).toString();
- assert.equal(dateLocalization.parse('20100302', 'yyyyMMdd'), expected, 'Format \'yyyyMMdd\' parse ok');
- assert.equal(dateLocalization.parse('02mar10', 'dMyyyy'), expected, 'Format \'dMyyyy\' parse ok');
+ messageLocalization.load({
+ 'ru-RU': {
+ TestCancel: 'Cancel ru-RU'
+ }
});
+
+ try {
+ Globalize.locale('ru-RU');
+
+ assert.equal(messageLocalization.format('TestBack'), 'Back ru');
+ assert.equal(messageLocalization.format('TestCancel'), 'Cancel ru-RU');
+ } finally {
+ Globalize.locale(originalLocale);
+ }
});
- QUnit.module('Localization message (custom locales)', {
- beforeEach: function() {
- messageLocalization.load({
- 'en': {
- addedKey: 'testValue',
- hello: 'Hello, {0} {1}'
- }
- });
+
+ QUnit.test('Fallback to default (en) culture', function(assert) {
+ const originalLocale = Globalize.locale().locale;
+ try {
+ Globalize.locale('ru');
+
+ assert.equal(messageLocalization.format('OK'), 'OK');
+ assert.equal(messageLocalization.getFormatter('OK')(), 'OK');
+ } finally {
+ Globalize.locale(originalLocale);
}
- }, () => {
- QUnit.test('Fallback to neutral culture', function(assert) {
- const originalLocale = Globalize.locale().locale;
+ });
- messageLocalization.load({
- 'ru': {
- TestBack: 'Back ru',
- TestCancel: 'Cancel ru'
- }
- });
+ QUnit.test('Extended culture with empty string value (T271323)', function(assert) {
+ const originalLocale = Globalize.locale().locale;
- messageLocalization.load({
- 'ru-RU': {
- TestCancel: 'Cancel ru-RU'
+ Globalize.load({
+ 'supplemental': {
+ 'likelySubtags': {
+ 'zh': 'zh-Hans-CN'
}
- });
-
- try {
- Globalize.locale('ru-RU');
+ }
+ });
- assert.equal(messageLocalization.format('TestBack'), 'Back ru');
- assert.equal(messageLocalization.format('TestCancel'), 'Cancel ru-RU');
- } finally {
- Globalize.locale(originalLocale);
+ messageLocalization.load({
+ 'zh-CN': {
+ addedKey: ''
}
});
+ try {
+ Globalize.locale('zh-CN');
- QUnit.test('Fallback to default (en) culture', function(assert) {
- const originalLocale = Globalize.locale().locale;
- try {
- Globalize.locale('ru');
+ assert.equal(messageLocalization.localizeString('@addedKey'), 'testValue', 'Default culture value');
+ } finally {
+ Globalize.locale(originalLocale);
+ }
+ });
- assert.equal(messageLocalization.format('OK'), 'OK');
- assert.equal(messageLocalization.getFormatter('OK')(), 'OK');
- } finally {
- Globalize.locale(originalLocale);
+ QUnit.test('localizeString by custom locale (T383089)', function(assert) {
+ messageLocalization.load({
+ 'ru': {
+ 'ruAddedKey': 'ruValue'
}
});
+ Globalize.locale('ru');
+ const localized = messageLocalization.localizeString('@ruAddedKey @@ruAddedKey @');
+ assert.equal(localized, 'ruValue @ruAddedKey @');
- QUnit.test('Extended culture with empty string value (T271323)', function(assert) {
- const originalLocale = Globalize.locale().locale;
+ Globalize.locale('en');
+ });
- Globalize.load({
- 'supplemental': {
- 'likelySubtags': {
- 'zh': 'zh-Hans-CN'
- }
- }
- });
+ QUnit.test('Empty message', function(assert) {
+ Globalize.loadMessages({
+ 'en': {
+ 'empty': ''
+ }
+ });
- messageLocalization.load({
- 'zh-CN': {
- addedKey: ''
- }
- });
+ assert.equal(messageLocalization.format('empty'), '');
+ });
- try {
- Globalize.locale('zh-CN');
+ QUnit.test('DX messages can be customized', function(assert) {
+ assert.equal(messageLocalization.format('dxCollectionWidget-noDataText'), 'No data to display');
- assert.equal(messageLocalization.localizeString('@addedKey'), 'testValue', 'Default culture value');
- } finally {
- Globalize.locale(originalLocale);
+ Globalize.loadMessages({
+ 'en': {
+ 'dxCollectionWidget-noDataText': 'Custom caption'
}
});
- QUnit.test('localizeString by custom locale (T383089)', function(assert) {
- messageLocalization.load({
- 'ru': {
- 'ruAddedKey': 'ruValue'
- }
- });
- Globalize.locale('ru');
- const localized = messageLocalization.localizeString('@ruAddedKey @@ruAddedKey @');
- assert.equal(localized, 'ruValue @ruAddedKey @');
+ assert.equal(messageLocalization.format('dxCollectionWidget-noDataText'), 'Custom caption');
+ });
- Globalize.locale('en');
+ QUnit.test('getDictionary ru', function(assert) {
+ messageLocalization.load({
+ 'ru': {
+ 'freshRuAddedKey': 'ruValue'
+ }
});
+ Globalize.locale('ru');
- QUnit.test('Empty message', function(assert) {
- Globalize.loadMessages({
- 'en': {
- 'empty': ''
- }
- });
+ messageLocalization.localizeString('@unknownKey');
+ messageLocalization.localizeString('@ruAddedKey');
- assert.equal(messageLocalization.format('empty'), '');
- });
+ assert.equal(messageLocalization.getDictionary()['freshRuAddedKey'], 'ruValue');
+ assert.equal(messageLocalization.getDictionary(true)['freshRuAddedKey'], undefined);
+ assert.equal(messageLocalization.getDictionary()['unknownKey'], 'Unknown key');
+ assert.equal(messageLocalization.getDictionary(true)['unknownKey'], 'Unknown key');
- QUnit.test('DX messages can be customized', function(assert) {
- assert.equal(messageLocalization.format('dxCollectionWidget-noDataText'), 'No data to display');
+ Globalize.locale('en');
+ });
+});
- Globalize.loadMessages({
- 'en': {
- 'dxCollectionWidget-noDataText': 'Custom caption'
- }
- });
+QUnit.module('Localization globalizeNumber', () => {
+ QUnit.test('format', function(assert) {
+ assert.equal(numberLocalization.format(1.2), '1.2');
+ assert.equal(numberLocalization.format(12), '12');
+ assert.equal(numberLocalization.format(2, { minimumIntegerDigits: 2 }), '02');
+ assert.equal(numberLocalization.format(12, { minimumIntegerDigits: 2 }), '12');
+ assert.equal(numberLocalization.format(2, { minimumIntegerDigits: 3 }), '002');
+ assert.equal(numberLocalization.format(12, { minimumIntegerDigits: 3 }), '012');
+ assert.equal(numberLocalization.format(123, { minimumIntegerDigits: 3 }), '123');
+ });
+});
- assert.equal(messageLocalization.format('dxCollectionWidget-noDataText'), 'Custom caption');
- });
+QUnit.module('Localization currency with Globalize', () => {
- QUnit.test('getDictionary ru', function(assert) {
- messageLocalization.load({
- 'ru': {
- 'freshRuAddedKey': 'ruValue'
- }
- });
- Globalize.locale('ru');
+ QUnit.test('format currency default after global config change', function(assert) {
+ const originalDefaultCurrency = config().defaultCurrency;
- messageLocalization.localizeString('@unknownKey');
- messageLocalization.localizeString('@ruAddedKey');
+ assert.equal(numberLocalization.format(1.2, { currency: 'default' }), '$1.20');
- assert.equal(messageLocalization.getDictionary()['freshRuAddedKey'], 'ruValue');
- assert.equal(messageLocalization.getDictionary(true)['freshRuAddedKey'], undefined);
- assert.equal(messageLocalization.getDictionary()['unknownKey'], 'Unknown key');
- assert.equal(messageLocalization.getDictionary(true)['unknownKey'], 'Unknown key');
+ config({ defaultCurrency: 'EUR' });
+ assert.equal(numberLocalization.format(12, { currency: 'default' }), '€12.00');
+
+ config({ defaultCurrency: originalDefaultCurrency });
+ assert.equal(numberLocalization.format(1.2, { currency: 'default' }), '$1.20');
- Globalize.locale('en');
- });
});
- QUnit.module('Localization globalizeNumber', () => {
- QUnit.test('format', function(assert) {
- assert.equal(numberLocalization.format(1.2), '1.2');
- assert.equal(numberLocalization.format(12), '12');
- assert.equal(numberLocalization.format(2, { minimumIntegerDigits: 2 }), '02');
- assert.equal(numberLocalization.format(12, { minimumIntegerDigits: 2 }), '12');
- assert.equal(numberLocalization.format(2, { minimumIntegerDigits: 3 }), '002');
- assert.equal(numberLocalization.format(12, { minimumIntegerDigits: 3 }), '012');
- assert.equal(numberLocalization.format(123, { minimumIntegerDigits: 3 }), '123');
- });
+ QUnit.test('format', function(assert) {
+ assert.equal(numberLocalization.format(1.2, { currency: 'default' }), '$1.20');
+ assert.equal(numberLocalization.format(12, { currency: 'default' }), '$12.00');
+ assert.equal(numberLocalization.format(1, { minimumIntegerDigits: 2, minimumFractionDigits: 0, currency: 'default' }), '$01');
+ assert.equal(numberLocalization.format(1, { minimumIntegerDigits: 2, minimumFractionDigits: 0, currency: 'RUB' }), 'RUB' + NBSP + '01');
});
- QUnit.module('Localization currency with Globalize', () => {
+ QUnit.test('format currency with sign/style (T1076906)', function(assert) {
+ assert.equal(numberLocalization.format(-1.2, { currency: 'default', style: 'accounting' }), '($1.20)');
+ assert.equal(numberLocalization.format(-1.2, { type: 'currency', useCurrencyAccountingStyle: true }), '($1)');
+ assert.equal(numberLocalization.format(-12, { currency: 'default', style: 'symbol' }), '-$12.00');
+ assert.equal(numberLocalization.format(-12, { type: 'currency', useCurrencyAccountingStyle: false }), '-$12');
+ });
- QUnit.test('format currency default after global config change', function(assert) {
- const originalDefaultCurrency = config().defaultCurrency;
+ QUnit.test('format currency & power in RU locale', function(assert) {
+ Globalize.locale('ru');
+ assert.equal(numberLocalization.format(0, { type: 'currency thousands', currency: undefined, precision: 0 }), '0K' + NBSP + '$');
+ assert.equal(numberLocalization.format(0, { type: 'currency thousands', currency: 'CSK', precision: 2 }), '0,00K' + NBSP + 'CSK');
+ assert.equal(numberLocalization.format(2e+5, { type: 'currency thousands', precision: 0 }), '200K' + NBSP + '$');
+ Globalize.locale('en');
+ });
- assert.equal(numberLocalization.format(1.2, { currency: 'default' }), '$1.20');
+ QUnit.test('getOpenXmlCurrencyFormat: check conversion for some cultures (T835933)', function(assert) {
+ try {
+ Globalize.locale('en');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat(undefined), '$#,##0{0}_);\\($#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('USD'), '$#,##0{0}_);\\($#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('RUB'), '\\R\\U\\B#,##0{0}_);\\(\\R\\U\\B#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('CNY'), '\\C\\N\\¥#,##0{0}_);\\(\\C\\N\\¥#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('NOK'), '\\N\\O\\K#,##0{0}_);\\(\\N\\O\\K#,##0{0}\\)');
+
+ Globalize.locale('en-ru'); // switch to parent if there are no settings for the passed culture
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat(undefined), '$#,##0{0}_);\\($#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('USD'), '$#,##0{0}_);\\($#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('RUB'), '\\R\\U\\B#,##0{0}_);\\(\\R\\U\\B#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('CNY'), '\\C\\N\\¥#,##0{0}_);\\(\\C\\N\\¥#,##0{0}\\)');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('NOK'), '\\N\\O\\K#,##0{0}_);\\(\\N\\O\\K#,##0{0}\\)');
- config({ defaultCurrency: 'EUR' });
- assert.equal(numberLocalization.format(12, { currency: 'default' }), '€12.00');
+ Globalize.locale('ru');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat(undefined), '#,##0{0}\xA0$');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('USD'), '#,##0{0}\xA0$');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('RUB'), '#,##0{0}\xA0\\₽');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('CNY'), '#,##0{0}\xA0\\C\\N\\¥');
+ assert.equal(numberLocalization.getOpenXmlCurrencyFormat('NOK'), '#,##0{0}\xA0\\N\\O\\K');
+ } finally {
+ Globalize.locale('en');
+ }
+ });
- config({ defaultCurrency: originalDefaultCurrency });
- assert.equal(numberLocalization.format(1.2, { currency: 'default' }), '$1.20');
+ QUnit.test('getDecimalSeparator and getThousandsSeparator in RU locale', function(assert) {
+ Globalize.locale('ru');
+ assert.equal(numberLocalization.getDecimalSeparator(), ',');
+ assert.equal(numberLocalization.getThousandsSeparator(), '\xa0');
+ Globalize.locale('en');
+ });
- });
+ QUnit.test('getCurrencySymbol and config.defaultCurrency', function(assert) {
+ const originalDefaultCurrency = config().defaultCurrency;
- QUnit.test('format', function(assert) {
- assert.equal(numberLocalization.format(1.2, { currency: 'default' }), '$1.20');
- assert.equal(numberLocalization.format(12, { currency: 'default' }), '$12.00');
- assert.equal(numberLocalization.format(1, { minimumIntegerDigits: 2, minimumFractionDigits: 0, currency: 'default' }), '$01');
- assert.equal(numberLocalization.format(1, { minimumIntegerDigits: 2, minimumFractionDigits: 0, currency: 'RUB' }), 'RUB' + NBSP + '01');
- });
+ try {
+ assert.equal(numberLocalization.getCurrencySymbol().symbol, '$');
- QUnit.test('format currency with sign/style (T1076906)', function(assert) {
- assert.equal(numberLocalization.format(-1.2, { currency: 'default', style: 'accounting' }), '($1.20)');
- assert.equal(numberLocalization.format(-1.2, { type: 'currency', useCurrencyAccountingStyle: true }), '($1)');
- assert.equal(numberLocalization.format(-12, { currency: 'default', style: 'symbol' }), '-$12.00');
- assert.equal(numberLocalization.format(-12, { type: 'currency', useCurrencyAccountingStyle: false }), '-$12');
- });
+ config({
+ defaultCurrency: 'EUR'
+ });
- QUnit.test('format currency & power in RU locale', function(assert) {
- Globalize.locale('ru');
- assert.equal(numberLocalization.format(0, { type: 'currency thousands', currency: undefined, precision: 0 }), '0K' + NBSP + '$');
- assert.equal(numberLocalization.format(0, { type: 'currency thousands', currency: 'CSK', precision: 2 }), '0,00K' + NBSP + 'CSK');
- assert.equal(numberLocalization.format(2e+5, { type: 'currency thousands', precision: 0 }), '200K' + NBSP + '$');
- Globalize.locale('en');
- });
+ assert.equal(numberLocalization.getCurrencySymbol().symbol, '€');
+ } finally {
+ config({
+ defaultCurrency: originalDefaultCurrency
+ });
+ }
+ });
+});
- QUnit.test('getOpenXmlCurrencyFormat: check conversion for some cultures (T835933)', function(assert) {
- try {
- Globalize.locale('en');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat(undefined), '$#,##0{0}_);\\($#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('USD'), '$#,##0{0}_);\\($#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('RUB'), '\\R\\U\\B#,##0{0}_);\\(\\R\\U\\B#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('CNY'), '\\C\\N\\¥#,##0{0}_);\\(\\C\\N\\¥#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('NOK'), '\\N\\O\\K#,##0{0}_);\\(\\N\\O\\K#,##0{0}\\)');
-
- Globalize.locale('en-ru'); // switch to parent if there are no settings for the passed culture
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat(undefined), '$#,##0{0}_);\\($#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('USD'), '$#,##0{0}_);\\($#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('RUB'), '\\R\\U\\B#,##0{0}_);\\(\\R\\U\\B#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('CNY'), '\\C\\N\\¥#,##0{0}_);\\(\\C\\N\\¥#,##0{0}\\)');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('NOK'), '\\N\\O\\K#,##0{0}_);\\(\\N\\O\\K#,##0{0}\\)');
-
- Globalize.locale('ru');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat(undefined), '#,##0{0}\xA0$');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('USD'), '#,##0{0}\xA0$');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('RUB'), '#,##0{0}\xA0\\₽');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('CNY'), '#,##0{0}\xA0\\C\\N\\¥');
- assert.equal(numberLocalization.getOpenXmlCurrencyFormat('NOK'), '#,##0{0}\xA0\\N\\O\\K');
- } finally {
- Globalize.locale('en');
- }
- });
+QUnit.module('Exceljs format', () => {
+ ExcelJSLocalizationFormatTests.runCurrencyTests([
+ { value: 'USD', expected: '$#,##0_);\\($#,##0\\)' },
+ { value: 'RUB', expected: '\\R\\U\\B#,##0_);\\(\\R\\U\\B#,##0\\)' },
+ { value: 'JPY', expected: '\\¥#,##0_);\\(\\¥#,##0\\)' },
+ { value: 'KPW', expected: '\\K\\P\\W#,##0_);\\(\\K\\P\\W#,##0\\)' },
+ { value: 'LBP', expected: '\\L\\B\\P#,##0_);\\(\\L\\B\\P#,##0\\)' },
+ { value: 'SEK', expected: '\\S\\E\\K#,##0_);\\(\\S\\E\\K#,##0\\)' }
+ ]);
+
+ ExcelJSLocalizationFormatTests.runPivotGridCurrencyTests([
+ { value: 'USD', expected: '$#,##0_);\\($#,##0\\)' },
+ { value: 'RUB', expected: '\\R\\U\\B#,##0_);\\(\\R\\U\\B#,##0\\)' },
+ { value: 'JPY', expected: '\\¥#,##0_);\\(\\¥#,##0\\)' },
+ { value: 'KPW', expected: '\\K\\P\\W#,##0_);\\(\\K\\P\\W#,##0\\)' },
+ { value: 'LBP', expected: '\\L\\B\\P#,##0_);\\(\\L\\B\\P#,##0\\)' },
+ { value: 'SEK', expected: '\\S\\E\\K#,##0_);\\(\\S\\E\\K#,##0\\)' }
+ ]);
+});
- QUnit.test('getDecimalSeparator and getThousandsSeparator in RU locale', function(assert) {
- Globalize.locale('ru');
- assert.equal(numberLocalization.getDecimalSeparator(), ',');
- assert.equal(numberLocalization.getThousandsSeparator(), '\xa0');
- Globalize.locale('en');
+QUnit.module('Format helper', () => {
+ QUnit.module('Numeric and dateTime formats', {
+ beforeEach: function() {
+ this.testDate = new Date(2010, 2, 5, 12, 13, 33, 0);
+ }
+ }, () => {
+ QUnit.test('Currency numeric formats', function(assert) {
+ assert.equal(formatHelper.format(1204, 'currency'), '$1,204');
+ assert.equal(formatHelper.format(1204, { type: 'cuRRency', precision: 2 }), '$1,204.00');
+ assert.equal(formatHelper.format(-1204, { type: 'currency', precision: 2 }), '($1,204.00)');
});
- QUnit.test('getCurrencySymbol and config.defaultCurrency', function(assert) {
- const originalDefaultCurrency = config().defaultCurrency;
+ QUnit.test('currency RUB large number format with different locales', function(assert) {
+ const currentCultureName = Globalize.locale().locale;
- try {
- assert.equal(numberLocalization.getCurrencySymbol().symbol, '$');
+ assert.equal(formatHelper.format(1.204, { type: 'currency', precision: 2, currency: 'RUB' }), 'RUB' + NBSP + '1.20');
- config({
- defaultCurrency: 'EUR'
- });
-
- assert.equal(numberLocalization.getCurrencySymbol().symbol, '€');
+ Globalize.locale('ru');
+ try {
+ assert.equal(formatHelper.format(1.204, { type: 'currency', precision: 2, currency: 'RUB' }), '1,20' + NBSP + RUB);
} finally {
- config({
- defaultCurrency: originalDefaultCurrency
- });
+ Globalize.locale(currentCultureName);
}
});
- });
-
- QUnit.module('Exceljs format', () => {
- ExcelJSLocalizationFormatTests.default.runCurrencyTests([
- { value: 'USD', expected: '$#,##0_);\\($#,##0\\)' },
- { value: 'RUB', expected: '\\R\\U\\B#,##0_);\\(\\R\\U\\B#,##0\\)' },
- { value: 'JPY', expected: '\\¥#,##0_);\\(\\¥#,##0\\)' },
- { value: 'KPW', expected: '\\K\\P\\W#,##0_);\\(\\K\\P\\W#,##0\\)' },
- { value: 'LBP', expected: '\\L\\B\\P#,##0_);\\(\\L\\B\\P#,##0\\)' },
- { value: 'SEK', expected: '\\S\\E\\K#,##0_);\\(\\S\\E\\K#,##0\\)' }
- ]);
-
- ExcelJSLocalizationFormatTests.default.runPivotGridCurrencyTests([
- { value: 'USD', expected: '$#,##0_);\\($#,##0\\)' },
- { value: 'RUB', expected: '\\R\\U\\B#,##0_);\\(\\R\\U\\B#,##0\\)' },
- { value: 'JPY', expected: '\\¥#,##0_);\\(\\¥#,##0\\)' },
- { value: 'KPW', expected: '\\K\\P\\W#,##0_);\\(\\K\\P\\W#,##0\\)' },
- { value: 'LBP', expected: '\\L\\B\\P#,##0_);\\(\\L\\B\\P#,##0\\)' },
- { value: 'SEK', expected: '\\S\\E\\K#,##0_);\\(\\S\\E\\K#,##0\\)' }
- ]);
- });
-
- QUnit.module('Format helper', () => {
- QUnit.module('Numeric and dateTime formats', {
- beforeEach: function() {
- this.testDate = new Date(2010, 2, 5, 12, 13, 33, 0);
- }
- }, () => {
- QUnit.test('Currency numeric formats', function(assert) {
- assert.equal(formatHelper.format(1204, 'currency'), '$1,204');
- assert.equal(formatHelper.format(1204, { type: 'cuRRency', precision: 2 }), '$1,204.00');
- assert.equal(formatHelper.format(-1204, { type: 'currency', precision: 2 }), '($1,204.00)');
- });
-
- QUnit.test('currency RUB large number format with different locales', function(assert) {
- const currentCultureName = Globalize.locale().locale;
- assert.equal(formatHelper.format(1.204, { type: 'currency', precision: 2, currency: 'RUB' }), 'RUB' + NBSP + '1.20');
+ QUnit.test('Fixed point numeric formats', function(assert) {
+ assert.equal(formatHelper.format(23.04059872, { type: 'fIxedPoint', precision: 4 }), '23.0406');
+ });
- Globalize.locale('ru');
- try {
- assert.equal(formatHelper.format(1.204, { type: 'currency', precision: 2, currency: 'RUB' }), '1,20' + NBSP + RUB);
- } finally {
- Globalize.locale(currentCultureName);
- }
- });
+ QUnit.test('Percent numeric formats', function(assert) {
+ assert.equal(formatHelper.format(0.45, 'percEnt'), '45%');
+ assert.equal(formatHelper.format(0.45, { type: 'peRcent', precision: 2 }), '45.00%');
+ });
- QUnit.test('Fixed point numeric formats', function(assert) {
- assert.equal(formatHelper.format(23.04059872, { type: 'fIxedPoint', precision: 4 }), '23.0406');
- });
+ QUnit.test('Decimal numeric formats', function(assert) {
+ assert.equal(formatHelper.format(437, 'decimAl'), '437');
+ assert.equal(formatHelper.format(437, { type: 'deCimal', precision: 5 }), '00437');
+ });
- QUnit.test('Percent numeric formats', function(assert) {
- assert.equal(formatHelper.format(0.45, 'percEnt'), '45%');
- assert.equal(formatHelper.format(0.45, { type: 'peRcent', precision: 2 }), '45.00%');
- });
+ QUnit.test('Long date format', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'LONGDate'), 'Friday, March 5, 2010');
+ });
- QUnit.test('Decimal numeric formats', function(assert) {
- assert.equal(formatHelper.format(437, 'decimAl'), '437');
- assert.equal(formatHelper.format(437, { type: 'deCimal', precision: 5 }), '00437');
- });
+ QUnit.test('Long time format', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'longTIME'), '12:13:33 PM');
+ });
+ QUnit.test('Month and day format', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'monthAndDAY'), 'March 5');
+ });
- QUnit.test('Long date format', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'LONGDate'), 'Friday, March 5, 2010');
- });
+ QUnit.test('Month and year format', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'MONTHAndYear'), 'March 2010');
+ });
- QUnit.test('Long time format', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'longTIME'), '12:13:33 PM');
- });
- QUnit.test('Month and day format', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'monthAndDAY'), 'March 5');
- });
+ QUnit.test('Short date format', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'shoRTDate'), '3/5/2010');
+ });
- QUnit.test('Month and year format', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'MONTHAndYear'), 'March 2010');
- });
+ QUnit.test('Short time format', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'shoRTTime'), '12:13 PM');
+ });
- QUnit.test('Short date format', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'shoRTDate'), '3/5/2010');
- });
+ QUnit.test('Custom date time format', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'dd MMM yy'), '05 Mar 10');
+ });
- QUnit.test('Short time format', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'shoRTTime'), '12:13 PM');
- });
+ QUnit.test('LongDateLongTime', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'LONGDATELongTime'), 'Friday, March 5, 2010, 12:13:33 PM');
+ });
- QUnit.test('Custom date time format', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'dd MMM yy'), '05 Mar 10');
- });
+ QUnit.test('ShortDateShortTime', function(assert) {
+ assert.equal(formatHelper.format(this.testDate, 'shortDATESHORTTime'), '3/5/2010, 12:13 PM');
+ });
- QUnit.test('LongDateLongTime', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'LONGDATELongTime'), 'Friday, March 5, 2010, 12:13:33 PM');
- });
+ QUnit.test('Invalid format parameters', function(assert) {
+ assert.equal(formatHelper.format('test', 'percent'), 'test');
+ assert.equal(formatHelper.format(12, 12), 12);
+ });
- QUnit.test('ShortDateShortTime', function(assert) {
- assert.equal(formatHelper.format(this.testDate, 'shortDATESHORTTime'), '3/5/2010, 12:13 PM');
- });
+ QUnit.test('Quarter and year', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QUarterAndYear'), 'Q1 2005');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'dd MMM yy, Q'), '01 Jan 05, 1');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qq, dd MMM yy'), '01, 01 Jan 05');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'q, yy'), '1, 05');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qq, yy'), '01, 05');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQ, yyyy MM'), '01, 2005 01');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqq, yyyy'), 'Q1, 2005');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqqq, yyyy'), '1st quarter, 2005');
+ });
- QUnit.test('Invalid format parameters', function(assert) {
- assert.equal(formatHelper.format('test', 'percent'), 'test');
- assert.equal(formatHelper.format(12, 12), 12);
- });
+ // B218108
+ QUnit.test('Custom quarter format', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'q'), '1', 'quarter format - q');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'Q'), '1', 'quarter format - Q');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qq'), '01', 'quarter format - qq');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQ'), '01', 'quarter format - QQ');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqq'), 'Q1', 'quarter format - qqq');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQQ'), 'Q1', 'quarter format - QQQ');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqqq'), '1st quarter', 'quarter format - qqqq');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQQQ'), '1st quarter', 'quarter format - QQQQ');
+
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'q MMM QQ'), '1 Jan 01', 'quarter format - q MMM QQ');
+ });
- QUnit.test('Quarter and year', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QUarterAndYear'), 'Q1 2005');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'dd MMM yy, Q'), '01 Jan 05, 1');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qq, dd MMM yy'), '01, 01 Jan 05');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'q, yy'), '1, 05');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qq, yy'), '01, 05');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQ, yyyy MM'), '01, 2005 01');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqq, yyyy'), 'Q1, 2005');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqqq, yyyy'), '1st quarter, 2005');
- });
+ QUnit.test('Quarters for any months', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'quartERAndYear'), 'Q1 2005');
+ assert.equal(formatHelper.format(new Date(2005, 1, 1), 'quartERAndYear'), 'Q1 2005');
+ assert.equal(formatHelper.format(new Date(2005, 2, 1), 'quartERAndYear'), 'Q1 2005');
- // B218108
- QUnit.test('Custom quarter format', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'q'), '1', 'quarter format - q');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'Q'), '1', 'quarter format - Q');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qq'), '01', 'quarter format - qq');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQ'), '01', 'quarter format - QQ');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqq'), 'Q1', 'quarter format - qqq');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQQ'), 'Q1', 'quarter format - QQQ');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'qqqq'), '1st quarter', 'quarter format - qqqq');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'QQQQ'), '1st quarter', 'quarter format - QQQQ');
-
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'q MMM QQ'), '1 Jan 01', 'quarter format - q MMM QQ');
- });
+ assert.equal(formatHelper.format(new Date(2005, 3, 1), 'quarterANDYear'), 'Q2 2005');
+ assert.equal(formatHelper.format(new Date(2005, 4, 1), 'quarterANDYear'), 'Q2 2005');
+ assert.equal(formatHelper.format(new Date(2005, 5, 1), 'quarterANDYear'), 'Q2 2005');
- QUnit.test('Quarters for any months', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'quartERAndYear'), 'Q1 2005');
- assert.equal(formatHelper.format(new Date(2005, 1, 1), 'quartERAndYear'), 'Q1 2005');
- assert.equal(formatHelper.format(new Date(2005, 2, 1), 'quartERAndYear'), 'Q1 2005');
+ assert.equal(formatHelper.format(new Date(2005, 6, 1), 'qUARterAndYear'), 'Q3 2005');
+ assert.equal(formatHelper.format(new Date(2005, 7, 1), 'qUARterAndYear'), 'Q3 2005');
+ assert.equal(formatHelper.format(new Date(2005, 8, 1), 'qUARterAndYear'), 'Q3 2005');
- assert.equal(formatHelper.format(new Date(2005, 3, 1), 'quarterANDYear'), 'Q2 2005');
- assert.equal(formatHelper.format(new Date(2005, 4, 1), 'quarterANDYear'), 'Q2 2005');
- assert.equal(formatHelper.format(new Date(2005, 5, 1), 'quarterANDYear'), 'Q2 2005');
+ assert.equal(formatHelper.format(new Date(2005, 9, 1), 'qUARterAndYear'), 'Q4 2005');
+ assert.equal(formatHelper.format(new Date(2005, 10, 1), 'qUARterAndYear'), 'Q4 2005');
+ assert.equal(formatHelper.format(new Date(2005, 11, 1), 'qUARterAndYear'), 'Q4 2005');
+ });
- assert.equal(formatHelper.format(new Date(2005, 6, 1), 'qUARterAndYear'), 'Q3 2005');
- assert.equal(formatHelper.format(new Date(2005, 7, 1), 'qUARterAndYear'), 'Q3 2005');
- assert.equal(formatHelper.format(new Date(2005, 8, 1), 'qUARterAndYear'), 'Q3 2005');
+ QUnit.test('Choose call format method by the value type', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'loNGDate'), 'Saturday, January 1, 2005');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1), 'SHORTDate'), '1/1/2005');
+ assert.equal(formatHelper.format(12.098, { type: 'fixEDPoint', precision: 2 }), '12.10');
+ assert.equal(formatHelper.format(12.098, { type: 'cuRRency', precision: 1 }), '$12.1');
+ assert.equal(formatHelper.format('InvalidValue'), 'InvalidValue');
+ });
- assert.equal(formatHelper.format(new Date(2005, 9, 1), 'qUARterAndYear'), 'Q4 2005');
- assert.equal(formatHelper.format(new Date(2005, 10, 1), 'qUARterAndYear'), 'Q4 2005');
- assert.equal(formatHelper.format(new Date(2005, 11, 1), 'qUARterAndYear'), 'Q4 2005');
- });
+ QUnit.test('Millisecond date time interval format', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 1, 10, 33, 20, 237), 'millisecond'), '237');
+ assert.equal(formatHelper.format(new Date(2005, 0, 1, 10, 33, 20, 569), 'millisecond'), '569');
+ });
- QUnit.test('Choose call format method by the value type', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'loNGDate'), 'Saturday, January 1, 2005');
- assert.equal(formatHelper.format(new Date(2005, 0, 1), 'SHORTDate'), '1/1/2005');
- assert.equal(formatHelper.format(12.098, { type: 'fixEDPoint', precision: 2 }), '12.10');
- assert.equal(formatHelper.format(12.098, { type: 'cuRRency', precision: 1 }), '$12.1');
- assert.equal(formatHelper.format('InvalidValue'), 'InvalidValue');
- });
+ QUnit.test('Day date time interval format', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'day'), '16');
+ assert.equal(formatHelper.format(new Date(2005, 0, 30, 19, 23, 56, 237), 'day'), '30');
+ });
- QUnit.test('Millisecond date time interval format', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 1, 10, 33, 20, 237), 'millisecond'), '237');
- assert.equal(formatHelper.format(new Date(2005, 0, 1, 10, 33, 20, 569), 'millisecond'), '569');
- });
+ QUnit.test('Month date time interval format', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'month'), 'January');
+ assert.equal(formatHelper.format(new Date(2005, 9, 27, 19, 23, 56, 237), 'month'), 'October');
+ });
- QUnit.test('Day date time interval format', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'day'), '16');
- assert.equal(formatHelper.format(new Date(2005, 0, 30, 19, 23, 56, 237), 'day'), '30');
- });
+ QUnit.test('Quarter date time interval format', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'quarter'), 'Q1');
+ assert.equal(formatHelper.format(new Date(2005, 9, 27, 19, 23, 56, 237), 'quarter'), 'Q4');
+ });
- QUnit.test('Month date time interval format', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'month'), 'January');
- assert.equal(formatHelper.format(new Date(2005, 9, 27, 19, 23, 56, 237), 'month'), 'October');
- });
+ QUnit.test('Year date time interval format', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'year'), '2005');
+ assert.equal(formatHelper.format(new Date(2009, 9, 27, 19, 23, 56, 237), 'year'), '2009');
+ });
- QUnit.test('Quarter date time interval format', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'quarter'), 'Q1');
- assert.equal(formatHelper.format(new Date(2005, 9, 27, 19, 23, 56, 237), 'quarter'), 'Q4');
- });
+ QUnit.test('Short Year date time interval format', function(assert) {
+ assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'shortyear'), '05');
+ assert.equal(formatHelper.format(new Date(2009, 9, 27, 19, 23, 56, 237), 'shortyear'), '09');
+ });
- QUnit.test('Year date time interval format', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'year'), '2005');
- assert.equal(formatHelper.format(new Date(2009, 9, 27, 19, 23, 56, 237), 'year'), '2009');
- });
+ // This condition is added because of Safari bug 15434904
+ if(!isIosWithMSKTimeZone()) {
+ QUnit.test('getDateMarkerFormat for second range', function(assert) {
+ const date1 = new Date(2010, 0, 1, 2, 23, 33);
+ const date2 = new Date(date1.getTime());
- QUnit.test('Short Year date time interval format', function(assert) {
- assert.equal(formatHelper.format(new Date(2005, 0, 16, 10, 33, 20, 237), 'shortyear'), '05');
- assert.equal(formatHelper.format(new Date(2009, 9, 27, 19, 23, 56, 237), 'shortyear'), '09');
+ date2.setMilliseconds(3000);
+ const format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), '2:23:36 AM');
});
- // This condition is added because of Safari bug 15434904
- if(!isIosWithMSKTimeZone()) {
- QUnit.test('getDateMarkerFormat for second range', function(assert) {
- const date1 = new Date(2010, 0, 1, 2, 23, 33);
- const date2 = new Date(date1.getTime());
-
- date2.setMilliseconds(3000);
- const format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), '2:23:36 AM');
- });
-
- QUnit.test('getDateMarkerFormat for minute range', function(assert) {
- const date1 = new Date(2010, 0, 1, 2, 23, 33, 990);
- let date2 = new Date(date1.getTime());
- let format;
-
- date2.setSeconds(63);
- format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), '2:24:03 AM');
-
- date2 = new Date(date1.getTime());
- date2.setMinutes(25);
- format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), '2:25 AM');
- });
-
- QUnit.test('getDateMarkerFormat for hour range', function(assert) {
- const date1 = new Date(2010, 0, 1, 2, 23, 33, 990);
- let date2 = new Date(date1.getTime());
- let format;
-
- date2.setSeconds(30000);
- format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), '10:43:00 AM');
-
- date2 = new Date(date1.getTime());
- date2.setHours(4);
- format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), '4:23 AM');
- });
- }
-
- QUnit.test('getDateMarkerFormat for day range', function(assert) {
- const date1 = new Date(2010, 0, 29, 12, 23, 33, 990);
+ QUnit.test('getDateMarkerFormat for minute range', function(assert) {
+ const date1 = new Date(2010, 0, 1, 2, 23, 33, 990);
let date2 = new Date(date1.getTime());
let format;
- // day and time
- date2 = new Date(date1.getTime());
- date2.setMinutes(1000);
+ date2.setSeconds(63);
format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), 'Saturday, 30 4:40 AM');
+ assert.equal(formatHelper.format(date2, format), '2:24:03 AM');
- // day
date2 = new Date(date1.getTime());
- date2.setDate(30);
+ date2.setMinutes(25);
format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), 'Saturday, 30');
+ assert.equal(formatHelper.format(date2, format), '2:25 AM');
});
- QUnit.test('getDateMarkerFormat for month range', function(assert) {
- const date1 = new Date(2010, 10, 29, 12, 23, 33, 990);
+ QUnit.test('getDateMarkerFormat for hour range', function(assert) {
+ const date1 = new Date(2010, 0, 1, 2, 23, 33, 990);
let date2 = new Date(date1.getTime());
let format;
- // month, day and time
- date2.setHours(74);
- format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), 'December 2 2:23 AM');
-
- // year, month, day and time
- date2 = new Date(date1.getTime());
- date2.setFullYear(2011);
- date2.setMonth(11);
- date2.setHours(74);
- format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), '1/1/2012 2:23 AM');
-
- // month and day
- date2 = new Date(date1.getTime());
- date2.setDate(32);
+ date2.setSeconds(30000);
format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), 'December 2');
+ assert.equal(formatHelper.format(date2, format), '10:43:00 AM');
- // month
date2 = new Date(date1.getTime());
- date2.setMonth(11);
+ date2.setHours(4);
format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), 'December');
+ assert.equal(formatHelper.format(date2, format), '4:23 AM');
});
+ }
- QUnit.test('getDateMarkerFormat for year range', function(assert) {
- const date1 = new Date(2010, 10, 29, 12, 23, 33, 990);
- const date2 = new Date(date1.getTime());
+ QUnit.test('getDateMarkerFormat for day range', function(assert) {
+ const date1 = new Date(2010, 0, 29, 12, 23, 33, 990);
+ let date2 = new Date(date1.getTime());
+ let format;
+
+ // day and time
+ date2 = new Date(date1.getTime());
+ date2.setMinutes(1000);
+ format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), 'Saturday, 30 4:40 AM');
+
+ // day
+ date2 = new Date(date1.getTime());
+ date2.setDate(30);
+ format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), 'Saturday, 30');
+ });
- // year
- date2.setFullYear(2031);
- const format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
- assert.equal(formatHelper.format(date2, format), '2031');
- });
+ QUnit.test('getDateMarkerFormat for month range', function(assert) {
+ const date1 = new Date(2010, 10, 29, 12, 23, 33, 990);
+ let date2 = new Date(date1.getTime());
+ let format;
+
+ // month, day and time
+ date2.setHours(74);
+ format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), 'December 2 2:23 AM');
+
+ // year, month, day and time
+ date2 = new Date(date1.getTime());
+ date2.setFullYear(2011);
+ date2.setMonth(11);
+ date2.setHours(74);
+ format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), '1/1/2012 2:23 AM');
+
+ // month and day
+ date2 = new Date(date1.getTime());
+ date2.setDate(32);
+ format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), 'December 2');
+
+ // month
+ date2 = new Date(date1.getTime());
+ date2.setMonth(11);
+ format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), 'December');
+ });
- // B217749
- QUnit.test('value is null or undefined', function(assert) {
- assert.strictEqual(formatHelper.format(null, ''), '');
- assert.strictEqual(formatHelper.format(undefined, ''), '');
- assert.strictEqual(formatHelper.format('test', ''), 'test');
- });
+ QUnit.test('getDateMarkerFormat for year range', function(assert) {
+ const date1 = new Date(2010, 10, 29, 12, 23, 33, 990);
+ const date2 = new Date(date1.getTime());
- QUnit.test('large number auto format negative numbers', function(assert) {
- assert.strictEqual(formatHelper.format(-123, 'fixedPoint largeNumber'), '-123');
- assert.strictEqual(formatHelper.format(-1230, 'fixedPoint largeNumber'), '-1K');
- assert.strictEqual(formatHelper.format(-12300000, 'fixedPoint largeNumber'), '-12M');
- });
+ // year
+ date2.setFullYear(2031);
+ const format = formatHelper.getDateFormatByDifferences(dateUtils.getDatesDifferences(date1, date2));
+ assert.equal(formatHelper.format(date2, format), '2031');
+ });
- QUnit.test('large number auto format precision', function(assert) {
- assert.strictEqual(formatHelper.format(0.01, 'fixedPoint LARGENumber'), '0');
- assert.strictEqual(formatHelper.format(10.23, 'fixedPoint largeNumber'), '10');
- assert.strictEqual(formatHelper.format(123, { type: 'fixedPoint largeNumber', precision: 1 }), '123.0');
- assert.strictEqual(formatHelper.format(12345, { type: 'fixedPoint largeNUMBER', precision: 2 }), '12.35K');
- assert.strictEqual(formatHelper.format(12345, { type: 'fixedPoint largeNumber', precision: 5 }), '12.34500K');
- });
+ // B217749
+ QUnit.test('value is null or undefined', function(assert) {
+ assert.strictEqual(formatHelper.format(null, ''), '');
+ assert.strictEqual(formatHelper.format(undefined, ''), '');
+ assert.strictEqual(formatHelper.format('test', ''), 'test');
+ });
- QUnit.test('large number auto format small numbers', function(assert) {
- assert.strictEqual(formatHelper.format(0.01, { type: 'fixedPoint largeNumber', precision: 2 }), '0.01');
- assert.strictEqual(formatHelper.format(999, { type: 'fixedPoint largeNumber', precision: 2 }), '999.00');
- assert.strictEqual(formatHelper.format(999.9, { type: 'fixedPoint largeNumber', precision: 0 }), '1,000');
- assert.strictEqual(formatHelper.format(1000, { type: 'fixedPoint largeNumber', precision: 0 }), '1K');
- });
+ QUnit.test('large number auto format negative numbers', function(assert) {
+ assert.strictEqual(formatHelper.format(-123, 'fixedPoint largeNumber'), '-123');
+ assert.strictEqual(formatHelper.format(-1230, 'fixedPoint largeNumber'), '-1K');
+ assert.strictEqual(formatHelper.format(-12300000, 'fixedPoint largeNumber'), '-12M');
+ });
- QUnit.test('large number auto format powers', function(assert) {
- assert.strictEqual(formatHelper.format(1234.56, { type: 'fixedPoint largeNumber', precision: 2 }), '1.23K');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint largeNumber', precision: 2 }), '12.35K');
- assert.strictEqual(formatHelper.format(123400000, { type: 'fixedPoint largeNumber', precision: 2 }), '123.40M');
- assert.strictEqual(formatHelper.format(1234000000, { type: 'fixedPoint largeNumber', precision: 2 }), '1.23B');
- assert.strictEqual(formatHelper.format(12340000000000, { type: 'fixedPoint largeNumber', precision: 2 }), '12.34T');
- assert.strictEqual(formatHelper.format(12340000000000000, { type: 'fixedPoint largeNumber', precision: 2 }), '12,340.00T');
- });
+ QUnit.test('large number auto format precision', function(assert) {
+ assert.strictEqual(formatHelper.format(0.01, 'fixedPoint LARGENumber'), '0');
+ assert.strictEqual(formatHelper.format(10.23, 'fixedPoint largeNumber'), '10');
+ assert.strictEqual(formatHelper.format(123, { type: 'fixedPoint largeNumber', precision: 1 }), '123.0');
+ assert.strictEqual(formatHelper.format(12345, { type: 'fixedPoint largeNUMBER', precision: 2 }), '12.35K');
+ assert.strictEqual(formatHelper.format(12345, { type: 'fixedPoint largeNumber', precision: 5 }), '12.34500K');
+ });
- QUnit.test('large number format powers', function(assert) {
- assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint', precision: 2 }), '12,345.67');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint largeNumber', precision: 2 }), '12.35K');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint thousands', precision: 2 }), '12.35K');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint miLLions', precision: 3 }), '0.012M');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint biLLions', precision: 7 }), '0.0000123B');
- assert.strictEqual(formatHelper.format(12345670, { type: 'fixedPoint triLLions', precision: 7 }), '0.0000123T');
- });
+ QUnit.test('large number auto format small numbers', function(assert) {
+ assert.strictEqual(formatHelper.format(0.01, { type: 'fixedPoint largeNumber', precision: 2 }), '0.01');
+ assert.strictEqual(formatHelper.format(999, { type: 'fixedPoint largeNumber', precision: 2 }), '999.00');
+ assert.strictEqual(formatHelper.format(999.9, { type: 'fixedPoint largeNumber', precision: 0 }), '1,000');
+ assert.strictEqual(formatHelper.format(1000, { type: 'fixedPoint largeNumber', precision: 0 }), '1K');
+ });
- QUnit.test('currency large number format', function(assert) {
- assert.strictEqual(formatHelper.format(12345.67, { type: 'currency largeNumber', precision: 2 }), '$12.35K');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'currency thoUSands', precision: 2 }), '$12.35K');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'currency miLLions', precision: 3 }), '$0.012M');
- });
+ QUnit.test('large number auto format powers', function(assert) {
+ assert.strictEqual(formatHelper.format(1234.56, { type: 'fixedPoint largeNumber', precision: 2 }), '1.23K');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint largeNumber', precision: 2 }), '12.35K');
+ assert.strictEqual(formatHelper.format(123400000, { type: 'fixedPoint largeNumber', precision: 2 }), '123.40M');
+ assert.strictEqual(formatHelper.format(1234000000, { type: 'fixedPoint largeNumber', precision: 2 }), '1.23B');
+ assert.strictEqual(formatHelper.format(12340000000000, { type: 'fixedPoint largeNumber', precision: 2 }), '12.34T');
+ assert.strictEqual(formatHelper.format(12340000000000000, { type: 'fixedPoint largeNumber', precision: 2 }), '12,340.00T');
+ });
- QUnit.test('large number format without number type', function(assert) {
- assert.strictEqual(formatHelper.format(12345.67, { type: 'largeNumber', precision: 2 }), '12.35K');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'thousands', precision: 2 }), '12.35K');
- assert.strictEqual(formatHelper.format(12345.67, { type: 'millions', precision: 3 }), '0.012M');
- });
+ QUnit.test('large number format powers', function(assert) {
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint', precision: 2 }), '12,345.67');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint largeNumber', precision: 2 }), '12.35K');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint thousands', precision: 2 }), '12.35K');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint miLLions', precision: 3 }), '0.012M');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'fixedPoint biLLions', precision: 7 }), '0.0000123B');
+ assert.strictEqual(formatHelper.format(12345670, { type: 'fixedPoint triLLions', precision: 7 }), '0.0000123T');
+ });
- QUnit.test('Empty format for number', function(assert) {
- assert.equal(formatHelper.format(1204, ''), '1204');
- assert.equal(formatHelper.format(12.04, ''), '12.04');
- });
+ QUnit.test('currency large number format', function(assert) {
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'currency largeNumber', precision: 2 }), '$12.35K');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'currency thoUSands', precision: 2 }), '$12.35K');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'currency miLLions', precision: 3 }), '$0.012M');
+ });
- QUnit.test('exponential number type pow', function(assert) {
- assert.strictEqual(formatHelper.format(5, { type: 'exponEntial', precision: 2 }), '5.00E+0');
- assert.strictEqual(formatHelper.format(0.0081, { type: 'exponential', precision: 2 }), '8.10E-3');
- assert.strictEqual(formatHelper.format(-12345.67, { type: 'exponential', precision: 2 }), '-1.23E+4');
- assert.strictEqual(formatHelper.format(500000001, { type: 'exponential', precision: 2 }), '5.00E+8');
- assert.strictEqual(formatHelper.format(1.56662165464E+99, { type: 'exponential', precision: 2 }), '1.57E+99');
- assert.strictEqual(formatHelper.format(1.56662165464E-99, { type: 'exponential', precision: 2 }), '1.57E-99');
- });
+ QUnit.test('large number format without number type', function(assert) {
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'largeNumber', precision: 2 }), '12.35K');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'thousands', precision: 2 }), '12.35K');
+ assert.strictEqual(formatHelper.format(12345.67, { type: 'millions', precision: 3 }), '0.012M');
+ });
- QUnit.test('exponential number type precision', function(assert) {
- assert.strictEqual(formatHelper.format(1234, 'exponential'), '1.2E+3');
- assert.strictEqual(formatHelper.format(5, { type: 'exponential', precision: 0 }), '5E+0');
- assert.strictEqual(formatHelper.format(0.0081, { type: 'exponential', precision: 1 }), '8.1E-3');
- assert.strictEqual(formatHelper.format(-12345.67, { type: 'exponential', precision: 2 }), '-1.23E+4');
- assert.strictEqual(formatHelper.format(500000001, { type: 'exponential', precision: 3 }), '5.000E+8');
- assert.strictEqual(formatHelper.format(-123456789, { type: 'exponential', precision: 8 }), '-1.23456789E+8');
- });
+ QUnit.test('Empty format for number', function(assert) {
+ assert.equal(formatHelper.format(1204, ''), '1204');
+ assert.equal(formatHelper.format(12.04, ''), '12.04');
+ });
- QUnit.test('exponential number type round', function(assert) {
- assert.strictEqual(formatHelper.format(0.00999, { type: 'exponential', precision: 0 }), '1E-2');
- assert.strictEqual(formatHelper.format(0.00999, { type: 'exponential', precision: 2 }), '9.99E-3');
- assert.strictEqual(formatHelper.format(999, { type: 'exponential', precision: 1 }), '1.0E+3');
- });
+ QUnit.test('exponential number type pow', function(assert) {
+ assert.strictEqual(formatHelper.format(5, { type: 'exponEntial', precision: 2 }), '5.00E+0');
+ assert.strictEqual(formatHelper.format(0.0081, { type: 'exponential', precision: 2 }), '8.10E-3');
+ assert.strictEqual(formatHelper.format(-12345.67, { type: 'exponential', precision: 2 }), '-1.23E+4');
+ assert.strictEqual(formatHelper.format(500000001, { type: 'exponential', precision: 2 }), '5.00E+8');
+ assert.strictEqual(formatHelper.format(1.56662165464E+99, { type: 'exponential', precision: 2 }), '1.57E+99');
+ assert.strictEqual(formatHelper.format(1.56662165464E-99, { type: 'exponential', precision: 2 }), '1.57E-99');
+ });
+ QUnit.test('exponential number type precision', function(assert) {
+ assert.strictEqual(formatHelper.format(1234, 'exponential'), '1.2E+3');
+ assert.strictEqual(formatHelper.format(5, { type: 'exponential', precision: 0 }), '5E+0');
+ assert.strictEqual(formatHelper.format(0.0081, { type: 'exponential', precision: 1 }), '8.1E-3');
+ assert.strictEqual(formatHelper.format(-12345.67, { type: 'exponential', precision: 2 }), '-1.23E+4');
+ assert.strictEqual(formatHelper.format(500000001, { type: 'exponential', precision: 3 }), '5.000E+8');
+ assert.strictEqual(formatHelper.format(-123456789, { type: 'exponential', precision: 8 }), '-1.23456789E+8');
+ });
- QUnit.test('exponential number type positive and negative number', function(assert) {
- assert.strictEqual(formatHelper.format(0, { type: 'exponential', precision: 2 }), '0.00E+0');
- assert.strictEqual(formatHelper.format(1234, { type: 'exponential', precision: 2 }), '1.23E+3');
- assert.strictEqual(formatHelper.format(-1234, { type: 'exponential', precision: 2 }), '-1.23E+3');
- });
+ QUnit.test('exponential number type round', function(assert) {
+ assert.strictEqual(formatHelper.format(0.00999, { type: 'exponential', precision: 0 }), '1E-2');
+ assert.strictEqual(formatHelper.format(0.00999, { type: 'exponential', precision: 2 }), '9.99E-3');
+ assert.strictEqual(formatHelper.format(999, { type: 'exponential', precision: 1 }), '1.0E+3');
+ });
+
+ QUnit.test('exponential number type positive and negative number', function(assert) {
+ assert.strictEqual(formatHelper.format(0, { type: 'exponential', precision: 2 }), '0.00E+0');
+ assert.strictEqual(formatHelper.format(1234, { type: 'exponential', precision: 2 }), '1.23E+3');
+ assert.strictEqual(formatHelper.format(-1234, { type: 'exponential', precision: 2 }), '-1.23E+3');
});
- QUnit.module('formatNumberEx', () => {
- QUnit.test('not execute formatNumberEx for non-number value', function(assert) {
- assert.equal(formatHelper.format('test string', { format: 'currency' }), 'test string');
- });
+ });
- QUnit.test('not execute formatNumberEx for infinite value', function(assert) {
- assert.equal(formatHelper.format(Infinity, { format: 'fixedPoint' }), Infinity.toString());
- assert.equal(formatHelper.format(-Infinity, { format: 'fixedPoint' }), (-Infinity).toString());
- });
+ QUnit.module('formatNumberEx', () => {
+ QUnit.test('not execute formatNumberEx for non-number value', function(assert) {
+ assert.equal(formatHelper.format('test string', { format: 'currency' }), 'test string');
+ });
- QUnit.test('not execute formatNumberEx for NaN value', function(assert) {
- assert.equal(formatHelper.format(NaN, { format: 'fixedPoint' }), NaN.toString());
- });
+ QUnit.test('not execute formatNumberEx for infinite value', function(assert) {
+ assert.equal(formatHelper.format(Infinity, { format: 'fixedPoint' }), Infinity.toString());
+ assert.equal(formatHelper.format(-Infinity, { format: 'fixedPoint' }), (-Infinity).toString());
+ });
- QUnit.test('Case insensitive currency', function(assert) {
- assert.equal(formatHelper.format(1204, 'currency'), '$1,204');
- assert.equal(formatHelper.format(1204, { type: 'cuRrency', precision: 2 }), '$1,204.00');
- });
+ QUnit.test('not execute formatNumberEx for NaN value', function(assert) {
+ assert.equal(formatHelper.format(NaN, { format: 'fixedPoint' }), NaN.toString());
+ });
+
+ QUnit.test('Case insensitive currency', function(assert) {
+ assert.equal(formatHelper.format(1204, 'currency'), '$1,204');
+ assert.equal(formatHelper.format(1204, { type: 'cuRrency', precision: 2 }), '$1,204.00');
+ });
- QUnit.test('not execute formatNumberEx for string w with set format', function(assert) {
- /* eslint-disable no-extend-native */
+ QUnit.test('not execute formatNumberEx for string w with set format', function(assert) {
+ /* eslint-disable no-extend-native */
- String.prototype.format = noop;
+ String.prototype.format = noop;
- assert.equal(formatHelper.format(123, 'currency'), '$123');
+ assert.equal(formatHelper.format(123, 'currency'), '$123');
- // cleanup
- delete String.prototype.format;
- });
+ // cleanup
+ delete String.prototype.format;
});
});
});
diff --git a/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.widgets.tests.js b/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.widgets.tests.js
index 29056fc61eed..d0488ddaab72 100644
--- a/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.widgets.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.localization/localization.globalize.widgets.tests.js
@@ -1,13 +1,27 @@
-const likelySubtags = require('cldr-core/supplemental/likelySubtags.json!');
-const numberingSystems = require('cldr-core/supplemental/numberingSystems.json!');
-const Globalize = require('globalize');
+import likelySubtags from 'cldr-core/supplemental/likelySubtags.json!';
+import numberingSystems from 'cldr-core/supplemental/numberingSystems.json!';
+import Globalize from 'globalize';
-const cldrData = [
- require('devextreme-cldr-data/fa.json!json'),
- require('devextreme-cldr-data/mr.json!json'),
- require('devextreme-cldr-data/ar.json!json'),
- require('devextreme-cldr-data/de.json!json'),
-];
+import fa from 'devextreme-cldr-data/fa.json!json';
+import mr from 'devextreme-cldr-data/mr.json!json';
+import ar from 'devextreme-cldr-data/ar.json!json';
+import de from 'devextreme-cldr-data/de.json!json';
+
+import 'common/core/localization/globalize/core';
+import 'common/core/localization/globalize/number';
+import 'common/core/localization/globalize/currency';
+import 'common/core/localization/globalize/date';
+import 'common/core/localization/globalize/message';
+
+import $ from 'jquery';
+import dateLocalization from 'common/core/localization/date';
+
+import 'ui/date_box';
+import 'viz/chart';
+
+import * as ExcelExport from '__internal/exporter/exceljs/export_format';
+
+const cldrData = [fa, mr, ar, de];
Globalize.load(likelySubtags);
Globalize.load(numberingSystems);
@@ -16,20 +30,6 @@ cldrData.forEach(localeCldrData => {
Globalize.load(localeCldrData);
});
-require('common/core/localization/globalize/core');
-require('common/core/localization/globalize/number');
-require('common/core/localization/globalize/currency');
-require('common/core/localization/globalize/date');
-require('common/core/localization/globalize/message');
-
-const $ = require('jquery');
-const dateLocalization = require('common/core/localization/date');
-
-require('ui/date_box');
-require('viz/chart');
-
-const ExcelExport = require('__internal/exporter/exceljs/export_format');
-
const TEXTEDITOR_INPUT_SELECTOR = '.dx-texteditor-input';
const DATEVIEW_ITEM_SELECTOR = '.dx-dateview-item';
const DATEVIEW_ROLLER_DAY_SELECTOR = '.dx-dateviewroller-day';
diff --git a/packages/devextreme/testing/tests/DevExpress.localization/localization.messages.test.js b/packages/devextreme/testing/tests/DevExpress.localization/localization.messages.test.js
index 6f4570399b3b..12845c890d5a 100644
--- a/packages/devextreme/testing/tests/DevExpress.localization/localization.messages.test.js
+++ b/packages/devextreme/testing/tests/DevExpress.localization/localization.messages.test.js
@@ -1,18 +1,18 @@
-const localization = require('localization');
-const dictionaries = {};
-
-dictionaries['zh-tw'] = require('localization/messages/zh-tw.json!');
+import { loadMessages, locale, formatMessage } from 'localization';
+// eslint-disable-next-line spellcheck/spell-checker
+import zhTwMessages from 'localization/messages/zh-tw.json!';
QUnit.module('Locale messages of DevExtreme', {
}, () => {
QUnit.test('test zh-TW locale format message', function(assert) {
try {
- localization.loadMessages(dictionaries['zh-tw']);
- localization.locale('zh-TW');
- assert.equal(localization.formatMessage('Yes'), '是');
+ // eslint-disable-next-line spellcheck/spell-checker
+ loadMessages(zhTwMessages);
+ locale('zh-TW');
+ assert.equal(formatMessage('Yes'), '是');
} finally {
- localization.locale('en');
+ locale('en');
}
});
});
diff --git a/packages/devextreme/testing/tests/DevExpress.localization/validation.tests.js b/packages/devextreme/testing/tests/DevExpress.localization/validation.tests.js
index 623796d1dd67..4b12138141f5 100644
--- a/packages/devextreme/testing/tests/DevExpress.localization/validation.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.localization/validation.tests.js
@@ -1,22 +1,22 @@
-require('common/core/localization/globalize/core');
-require('common/core/localization/globalize/number');
-require('common/core/localization/globalize/currency');
-require('common/core/localization/globalize/date');
-require('common/core/localization/globalize/message');
-const cldrData = [
- require('devextreme-cldr-data/fr.json!json')
-];
+import 'common/core/localization/globalize/core';
+import 'common/core/localization/globalize/number';
+import 'common/core/localization/globalize/currency';
+import 'common/core/localization/globalize/date';
+import 'common/core/localization/globalize/message';
-const ValidationEngine = require('ui/validation_engine');
-const Globalize = require('globalize');
-const localization = require('localization');
-const fr = require('localization/messages/fr.json!');
+import ValidationEngine from 'ui/validation_engine';
+import Globalize from 'globalize';
+import { loadMessages } from 'localization';
+import fr from 'localization/messages/fr.json!';
+import frCldr from 'devextreme-cldr-data/fr.json!json';
+
+const cldrData = [frCldr];
cldrData.forEach(localeCldrData => {
Globalize.load(localeCldrData);
});
-localization.loadMessages(fr);
+loadMessages(fr);
QUnit.module('culture-specific validation', {
beforeEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/autocomplete.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/autocomplete.tests.js
index 96bbb0814273..1465ec1041b3 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/autocomplete.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/autocomplete.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/autocomplete.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/autocomplete.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/calendar.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/calendar.tests.js
index e66ea9a02d22..2e12f7ce1934 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/calendar.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/calendar.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/calendar.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/calendar.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/calendarView.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/calendarView.tests.js
index 379d0c3a2bde..1df0b685f22d 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/calendarView.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/calendarView.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/calendarView.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/calendarView.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/checkbox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/checkbox.tests.js
index c1b0d6e44add..b5fc2724d7ee 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/checkbox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/checkbox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/checkbox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/checkbox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/colorBox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/colorBox.tests.js
index 3bc387fd14fe..982ff39cba8b 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/colorBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/colorBox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/colorBox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/colorBox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/colorView.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/colorView.tests.js
index c201e83bda6d..f583b2c317b0 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/colorView.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/colorView.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/colorView.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/colorView.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/dataGrid.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/dataGrid.tests.js
index ec74c8ebdb22..08524be4e186 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/dataGrid.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/dataGrid.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.dataGrid/dataGrid.markup.tests.js');
+import '../DevExpress.ui.widgets.dataGrid/dataGrid.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/datebox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/datebox.tests.js
index 83b3da7dae74..1abfc6833567 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/datebox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/datebox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/datebox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/datebox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownBox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownBox.tests.js
index 7f0b377d0e1c..0a924c4d3ddd 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownBox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/dropDownBox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/dropDownBox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownEditor.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownEditor.tests.js
index db2ecf9228a4..75ed630f0be3 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownEditor.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/dropDownEditor.tests.js
@@ -1,6 +1,6 @@
-require('../DevExpress.ui.widgets.editors/dropDownEditor.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/dropDownEditor.markup.tests.js';
-const $ = require('jquery');
+import $ from 'jquery';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/editor.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/editor.tests.js
index 44c141bfad1c..35d3c16459a1 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/editor.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/editor.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/editor.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/editor.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/fieldChooser.js b/packages/devextreme/testing/tests/DevExpress.serverSide/fieldChooser.js
index 6dcfd49d807f..e149cec5a68a 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/fieldChooser.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/fieldChooser.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.pivotGrid/fieldChooser.markup.tests.js');
+import '../DevExpress.ui.widgets.pivotGrid/fieldChooser.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/fileManager.test.js b/packages/devextreme/testing/tests/DevExpress.serverSide/fileManager.test.js
index 99cab6583dd4..3279f15e81fc 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/fileManager.test.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/fileManager.test.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets/fileManagerParts/markup.tests.js');
+import '../DevExpress.ui.widgets/fileManagerParts/markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/fileUploader.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/fileUploader.tests.js
index f4589a68023c..2bec0f8ddd17 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/fileUploader.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/fileUploader.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/fileUploader.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/fileUploader.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/filterBuilder.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/filterBuilder.tests.js
index 8a0776fe2cf4..6ef6b145c922 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/filterBuilder.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/filterBuilder.tests.js
@@ -1,4 +1,4 @@
-const $ = require('jquery');
+import $ from 'jquery';
QUnit.testStart(function() {
$('#qunit-fixture').html('
');
@@ -6,4 +6,4 @@ QUnit.testStart(function() {
QUnit.module('Filter Builder markup');
-require('../DevExpress.ui.widgets/filterBuilderParts/markupTests.js');
+import '../DevExpress.ui.widgets/filterBuilderParts/markupTests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/gantt.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/gantt.tests.js
index 1be9953591fc..a729ff53a995 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/gantt.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/gantt.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets/gantt.markup.tests.js');
+import '../DevExpress.ui.widgets/gantt.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/localization.intl.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/localization.intl.tests.js
index e7d178cf6c91..b76ef02a5a17 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/localization.intl.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/localization.intl.tests.js
@@ -1 +1 @@
-require('../DevExpress.localization/localization.intl.tests.js');
+import '../DevExpress.localization/localization.intl.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/lookup.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/lookup.tests.js
index ad9f60381275..2117e3c204f0 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/lookup.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/lookup.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/lookup.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/lookup.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/numberBox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/numberBox.tests.js
index 19ef38e94b32..a0a3b0669b1e 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/numberBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/numberBox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/numberBox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/numberBox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/overlay.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/overlay.tests.js
index e522acc25f38..dcb97e2244d4 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/overlay.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/overlay.tests.js
@@ -1,6 +1,6 @@
-const $ = require('jquery');
+import $ from 'jquery';
-require('ui/overlay/ui.overlay');
+import 'ui/overlay/ui.overlay';
QUnit.testStart(function() {
const markup = '
';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/pivotGrid.test.js b/packages/devextreme/testing/tests/DevExpress.serverSide/pivotGrid.test.js
index f77edd20916f..28c2b5db5f05 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/pivotGrid.test.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/pivotGrid.test.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.pivotGrid/pivotGrid.markup.tests.js');
+import '../DevExpress.ui.widgets.pivotGrid/pivotGrid.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/progressBar.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/progressBar.tests.js
index eb4872b71ad4..02ef76eea59b 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/progressBar.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/progressBar.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets/progressBar.markup.tests.js');
+import '../DevExpress.ui.widgets/progressBar.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/rangeSlider.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/rangeSlider.tests.js
index 79c5b0289c8f..394299a66e6d 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/rangeSlider.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/rangeSlider.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/rangeSlider.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/rangeSlider.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/selectBox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/selectBox.tests.js
index ecc17d5906c9..2182ec5303da 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/selectBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/selectBox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/selectBox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/selectBox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/slider.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/slider.tests.js
index a668a821e87f..ee9f7e4166fd 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/slider.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/slider.tests.js
@@ -1,4 +1,4 @@
-const $ = require('jquery');
+import $ from 'jquery';
const SLIDER_HANDLE_CLASS = 'dx-slider-handle';
const TOOLTIP_CLASS = 'dx-tooltip';
@@ -27,5 +27,5 @@ QUnit.test('there is no tooltip in markup on server', function(assert) {
assert.notOk($tooltip.length);
});
-require('../DevExpress.ui.widgets.editors/slider.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/slider.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/switch.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/switch.tests.js
index b91ca3f996d2..87f85ba12381 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/switch.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/switch.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/switch.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/switch.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/tagBox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/tagBox.tests.js
index f710d02b08a8..329ed5c3ec78 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/tagBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/tagBox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/tagBox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/tagBox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/textArea.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/textArea.tests.js
index cf7894744cf6..a6a89cfc7dbd 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/textArea.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/textArea.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/textArea.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/textArea.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/textBox.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/textBox.tests.js
index 6a78b3b280f3..1dda1bebd5ff 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/textBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/textBox.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/textbox.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/textbox.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/textEditor.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/textEditor.tests.js
index 830fe319edde..15a76356118b 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/textEditor.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/textEditor.tests.js
@@ -4,4 +4,4 @@ QUnit.testStart(function() {
document.getElementById('qunit-fixture').innerHTML = markup;
});
-require('../DevExpress.ui.widgets.editors/textEditorParts/markup.tests.js');
+import '../DevExpress.ui.widgets.editors/textEditorParts/markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/trackBar.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/trackBar.tests.js
index f461dea2be50..b5424648c678 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/trackBar.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/trackBar.tests.js
@@ -1,8 +1,8 @@
-require('../DevExpress.ui.widgets.editors/trackBar.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/trackBar.markup.tests.js';
-const $ = require('jquery');
+import $ from 'jquery';
-require('ui/track_bar');
+import 'ui/track_bar';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/treeList.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/treeList.tests.js
index a12733657c3a..c8711b637d5f 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/treeList.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/treeList.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.treeList/treeList.markup.tests.js');
+import '../DevExpress.ui.widgets.treeList/treeList.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/utils.ready_callbacks.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/utils.ready_callbacks.tests.js
index 31683ada9350..a9d6c21a0d4f 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/utils.ready_callbacks.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/utils.ready_callbacks.tests.js
@@ -1,4 +1,4 @@
-const readyCallbacks = require('core/utils/ready_callbacks');
+import readyCallbacks from 'core/utils/ready_callbacks';
QUnit.module('readyCallbacks injection', {
afterEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/validationGroup.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/validationGroup.tests.js
index add3678c14f1..6bea69aa6175 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/validationGroup.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/validationGroup.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/validationGroup.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/validationGroup.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/validationSummary.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/validationSummary.tests.js
index b1a3df75a59e..9ba926ac4497 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/validationSummary.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/validationSummary.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/validationSummary.markup.tests.js');
+import '../DevExpress.ui.widgets.editors/validationSummary.markup.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/validator.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/validator.tests.js
index d6eadca67b34..a6305d78403c 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/validator.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/validator.tests.js
@@ -1 +1 @@
-require('../DevExpress.ui.widgets.editors/validator.tests.js');
+import '../DevExpress.ui.widgets.editors/validator.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.serverSide/widgetsCreation.tests.js b/packages/devextreme/testing/tests/DevExpress.serverSide/widgetsCreation.tests.js
index 86030b7adb10..090386d3d9ff 100644
--- a/packages/devextreme/testing/tests/DevExpress.serverSide/widgetsCreation.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.serverSide/widgetsCreation.tests.js
@@ -1,6 +1,6 @@
-const widgets = require('../../helpers/widgetsList.js').widgetsList;
+import { widgetsList as widgets } from '../../helpers/widgetsList.js';
-const DataSource = require('common/data/data_source');
+import DataSource from 'common/data/data_source';
QUnit.module('Widget creation', {
beforeEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/contextmenu.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/contextmenu.tests.js
index b2fbf79af553..cc79ce03817d 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/contextmenu.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/contextmenu.tests.js
@@ -1,9 +1,9 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const devices = require('core/devices');
-const support = require('core/utils/support');
-const holdEvent = require('common/core/events/hold');
-const contextMenuEvent = require('common/core/events/contextmenu');
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import devices from 'core/devices';
+import * as support from 'core/utils/support';
+import holdEvent from 'common/core/events/hold';
+import * as contextMenuEvent from 'common/core/events/contextmenu';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/dblclick.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/dblclick.tests.js
index acbeecedcecb..71464819b371 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/dblclick.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/dblclick.tests.js
@@ -1,7 +1,7 @@
-const $ = require('jquery');
-const dblclickEvent = require('common/core/events/dblclick');
-const { dblClick } = require('__internal/events/dblclick');
-const pointerMock = require('../../helpers/pointerMock.js');
+import $ from 'jquery';
+import dblclickEvent from 'common/core/events/dblclick';
+import { dblClick } from '__internal/events/dblclick';
+import pointerMock from '../../helpers/pointerMock.js';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/drag.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/drag.tests.js
index 182e9b32063c..cdcad45ebffa 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/drag.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/drag.tests.js
@@ -1,10 +1,10 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const dragEvents = require('common/core/events/drag');
-const support = require('core/utils/support');
-const GestureEmitter = require('common/core/events/gesture/emitter.gesture');
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import * as dragEvents from 'common/core/events/drag';
+import * as support from 'core/utils/support';
+import GestureEmitter from 'common/core/events/gesture/emitter.gesture';
const dropTargets = dragEvents.dropTargets;
-const pointerMock = require('../../helpers/pointerMock.js');
+import pointerMock from '../../helpers/pointerMock.js';
$('#qunit-fixture').addClass('qunit-fixture-visible');
QUnit.testStart(function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/feedback.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/feedback.tests.js
index 6458f0852da3..ee54e87596ba 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/feedback.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/feedback.tests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const devices = require('core/devices');
-const feedbackEvents = require('common/core/events/core/emitter.feedback');
-const pointerMock = require('../../helpers/pointerMock.js');
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import devices from 'core/devices';
+import * as feedbackEvents from 'common/core/events/core/emitter.feedback';
+import pointerMock from '../../helpers/pointerMock.js';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/hold.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/hold.tests.js
index 78a4db9961b1..a00284ee8a34 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/hold.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/hold.tests.js
@@ -1,6 +1,6 @@
-const $ = require('jquery');
-const holdEvent = require('common/core/events/hold');
-const pointerMock = require('../../helpers/pointerMock.js');
+import $ from 'jquery';
+import holdEvent from 'common/core/events/hold';
+import pointerMock from '../../helpers/pointerMock.js';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/hover.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/hover.tests.js
index a358fb58f39d..791e7fc26416 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/hover.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/hover.tests.js
@@ -1,6 +1,6 @@
-const $ = require('jquery');
-const devices = require('core/devices');
-const hoverEvents = require('common/core/events/hover');
+import $ from 'jquery';
+import devices from 'core/devices';
+import * as hoverEvents from 'common/core/events/hover';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/pointer.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/pointer.tests.js
index 93b47fdba064..fb85cd963e47 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/pointer.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/pointer.tests.js
@@ -1,4 +1,4 @@
-const $ = require('jquery');
+import $ from 'jquery';
QUnit.testStart(function() {
const markup =
@@ -9,8 +9,8 @@ QUnit.testStart(function() {
$('#qunit-fixture').html(markup);
});
-require('./pointerParts/baseTests.js');
-require('./pointerParts/mouseTests.js');
-require('./pointerParts/touchTests.js');
-require('./pointerParts/mouseAndTouchTests.js');
-require('./pointerParts/strategySelectionTests.js');
+import './pointerParts/baseTests.js';
+import './pointerParts/mouseTests.js';
+import './pointerParts/touchTests.js';
+import './pointerParts/mouseAndTouchTests.js';
+import './pointerParts/strategySelectionTests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/baseTests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/baseTests.js
index af476b785267..fdfb40692a7c 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/baseTests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/baseTests.js
@@ -1,9 +1,9 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const BaseStrategy = require('common/core/events/pointer/base');
-const registerEvent = require('common/core/events/core/event_registrator');
-const typeUtils = require('core/utils/type');
-const special = require('../../../helpers/eventHelper.js').special;
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import BaseStrategy from 'common/core/events/pointer/base';
+import registerEvent from 'common/core/events/core/event_registrator';
+import * as typeUtils from 'core/utils/type';
+import { special } from '../../../helpers/eventHelper.js';
const BubbledTestEventMap = {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseAndTouchTests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseAndTouchTests.js
index ac065b0129b6..9f407cde1721 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseAndTouchTests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseAndTouchTests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const MouseAndTouchStrategy = require('common/core/events/pointer/mouse_and_touch');
-const registerEvent = require('common/core/events/core/event_registrator');
-const nativePointerMock = require('../../../helpers/nativePointerMock.js');
-const special = require('../../../helpers/eventHelper.js').special;
+import $ from 'jquery';
+import MouseAndTouchStrategy from 'common/core/events/pointer/mouse_and_touch';
+import registerEvent from 'common/core/events/core/event_registrator';
+import nativePointerMock from '../../../helpers/nativePointerMock.js';
+import { special } from '../../../helpers/eventHelper.js';
QUnit.module('mouse and touch events', {
beforeEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseTests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseTests.js
index 8733017ed2d0..2b69eafcfbec 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseTests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/mouseTests.js
@@ -1,8 +1,8 @@
-const $ = require('jquery');
-const MouseStrategy = require('common/core/events/pointer/mouse');
-const registerEvent = require('common/core/events/core/event_registrator');
-const nativePointerMock = require('../../../helpers/nativePointerMock.js');
-const special = require('../../../helpers/eventHelper.js').special;
+import $ from 'jquery';
+import MouseStrategy from 'common/core/events/pointer/mouse';
+import registerEvent from 'common/core/events/core/event_registrator';
+import nativePointerMock from '../../../helpers/nativePointerMock.js';
+import { special } from '../../../helpers/eventHelper.js';
QUnit.module('mouse events', {
beforeEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/touchTests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/touchTests.js
index 78cf41582d81..8cc336fa4fb2 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/touchTests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/touchTests.js
@@ -1,10 +1,10 @@
-const $ = require('jquery');
-const TouchStrategy = require('common/core/events/pointer/touch');
-const registerEvent = require('common/core/events/core/event_registrator');
-const nativePointerMock = require('../../../helpers/nativePointerMock.js');
-const noop = require('core/utils/common').noop;
-const special = require('../../../helpers/eventHelper.js').special;
-const eventsEngine = require('common/core/events/core/events_engine');
+import $ from 'jquery';
+import TouchStrategy from 'common/core/events/pointer/touch';
+import registerEvent from 'common/core/events/core/event_registrator';
+import nativePointerMock from '../../../helpers/nativePointerMock.js';
+import { noop } from 'core/utils/common';
+import { special } from '../../../helpers/eventHelper.js';
+import eventsEngine from 'common/core/events/core/events_engine';
QUnit.module('touch events', {
beforeEach: function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/scroll.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/scroll.tests.js
index d80ac13750a1..f4738fd8e668 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/scroll.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/scroll.tests.js
@@ -1,12 +1,12 @@
-const $ = require('jquery');
-const noop = require('core/utils/common').noop;
-const scrollEvents = require('common/core/events/gesture/emitter.gesture.scroll');
-const GestureEmitter = require('common/core/events/gesture/emitter.gesture');
-const eventUtils = require('common/core/events/utils/index');
-const devices = require('core/devices');
-const compareVersions = require('core/utils/version').compare;
-const animationFrame = require('common/core/animation/frame');
-const pointerMock = require('../../helpers/pointerMock.js');
+import $ from 'jquery';
+import { noop } from 'core/utils/common';
+import scrollEvents from 'common/core/events/gesture/emitter.gesture.scroll';
+import GestureEmitter from 'common/core/events/gesture/emitter.gesture';
+import * as eventUtils from 'common/core/events/utils/index';
+import devices from 'core/devices';
+import { compare as compareVersions } from 'core/utils/version';
+import * as animationFrame from 'common/core/animation/frame';
+import pointerMock from '../../helpers/pointerMock.js';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/transformation.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/transformation.tests.js
index a0e83e63a5a6..e4422f6b6700 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/transformation.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/transformation.tests.js
@@ -1,5 +1,5 @@
-const $ = require('jquery');
-const transformEvent = require('common/core/events/transform');
+import $ from 'jquery';
+import * as transformEvent from 'common/core/events/transform';
$('#qunit-fixture').addClass('qunit-fixture-visible');
QUnit.testStart(function() {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/wheel.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/wheel.tests.js
index f2f68c750db5..57f4ef469f58 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.events/wheel.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.events/wheel.tests.js
@@ -1,6 +1,6 @@
-const $ = require('jquery');
-const wheelEvent = require('common/core/events/core/wheel');
-const nativePointerMock = require('../../helpers/nativePointerMock.js');
+import $ from 'jquery';
+import * as wheelEvent from 'common/core/events/core/wheel';
+import nativePointerMock from '../../helpers/nativePointerMock.js';
QUnit.testStart(function() {
const markup =
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js
index 7159ed187fb5..3ec0cf098d5a 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js
@@ -105,19 +105,22 @@ QUnit.module('AdaptiveColumns', {
if(name === 'width' || name === 'height') {
++cssInvokeCounter;
}
+ return cssFunc.apply(this, arguments);
};
- // arrange, act
- $('.dx-datagrid').width(200);
- setupDataGrid(this);
- this.rowsView.render($('#container'));
- this.resizingController.updateDimensions();
- this.clock.tick(10);
-
- // assert
- assert.equal(cssInvokeCounter, 0, 'no $.css() invokes for width/height CSS properties');
-
- renderer.fn.css = cssFunc;
+ try {
+ // arrange, act
+ $('.dx-datagrid').width(200);
+ setupDataGrid(this);
+ this.rowsView.render($('#container'));
+ this.resizingController.updateDimensions();
+ this.clock.tick(10);
+
+ // assert
+ assert.equal(cssInvokeCounter, 0, 'no $.css() invokes for width/height CSS properties');
+ } finally {
+ renderer.fn.css = cssFunc;
+ }
});
// T516888
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/dropDownBox.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/dropDownBox.tests.js
index c0b2ad29a24d..3c4059e5a0f7 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/dropDownBox.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/dropDownBox.tests.js
@@ -3,7 +3,7 @@ import renderer from 'core/renderer';
import keyboardMock from '../../helpers/keyboardMock.js';
import fx from 'common/core/animation/fx';
import DropDownBox from 'ui/drop_down_box';
-import typeUtils, { isRenderer } from 'core/utils/type';
+import { isRenderer, isFunction } from 'core/utils/type';
import config from 'core/config';
import devices from '__internal/core/m_devices';
import { normalizeKeyName } from 'common/core/events/utils/index';
@@ -789,7 +789,7 @@ QUnit.module('popup options', moduleConfig, () => {
contentTemplate: () => $content
});
- assert.ok(typeUtils.isFunction(instance.option('dropDownOptions.hideOnParentScroll')));
+ assert.ok(isFunction(instance.option('dropDownOptions.hideOnParentScroll')));
});
[true, false].forEach((isMac) => {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part1.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part1.js
index d61a6192935d..13cf0441b0c7 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part1.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part1.js
@@ -1,2 +1,2 @@
-require('../../helpers/ignoreQuillTimers.js');
-require('./htmlEditorParts/importQuill.tests.js');
+import '../../helpers/ignoreQuillTimers.js';
+import './htmlEditorParts/importQuill.tests.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part2.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part2.js
index 339dd30efcf3..52f2e5017af0 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part2.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditor.missingModules.tests.part2.js
@@ -1 +1 @@
-require('../../helpers/ignoreQuillTimers.js');
+import '../../helpers/ignoreQuillTimers.js';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/importQuill.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/importQuill.tests.js
index 8ba22c6b1e98..954d86128ce6 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/importQuill.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/importQuill.tests.js
@@ -1,22 +1,13 @@
+import quillImporter from 'ui/html_editor/quill_importer';
-SystemJS.config({
- map: {
- 'devextreme-quill': '/packages/devextreme/testing/helpers/quillDependencies/noQuill.js'
- }
-});
-
-define(function(require) {
- const getQuill = require('ui/html_editor/quill_importer').getQuill;
-
- QUnit.module('Import 3rd party', function() {
- QUnit.test('it throw an error if the quill script isn\'t referenced', function(assert) {
- assert.throws(
- function() { getQuill(); },
- function(e) {
- return /(E1041)[\s\S]*(Quill)/.test(e.message);
- },
- 'The Quill script isn\'t referenced'
- );
- });
+QUnit.module('Import 3rd party', function() {
+ QUnit.test('it throw an error if the quill script is not referenced', function(assert) {
+ assert.throws(
+ function() { quillImporter.getQuill(); },
+ function(e) {
+ return /(E1041)[\s\S]*(Quill)/.test(e.message);
+ },
+ 'The Quill script is not referenced'
+ );
});
});
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js
index 939672ded248..cf29a6de403a 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/tableResizingModule.tests.js
@@ -72,6 +72,8 @@ const moduleConfig = {
},
afterEach: function() {
+ this.clock.tick(1000);
+ resizeCallbacks.empty();
this.clock.restore();
}
};
@@ -176,7 +178,7 @@ module('Table resizing module', moduleConfig, () => {
resizeCallbacks.fire();
- assert.strictEqual(typeof resizingInstance._resizeHandlerWithContext, 'object', '_resizeHandler is an object');
+ assert.ok(resizingInstance._resizeHandlerWithContext, '_resizeHandlerWithContext is registered');
});
test('Window resize callback should be cleaned after the widget dispose', function(assert) {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js
index 3afd5c78e87e..bcc686b7c3b1 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts/toolbarModule.tests.js
@@ -1883,6 +1883,7 @@ testModule('Toolbar items state update', {
test('state of the items in menu should be synchronized after toolbar repaint (t1117604)', function(assert) {
this.options.items = this.mapToMenuItems(TABLE_OPERATIONS);
+ resizeCallbacks.empty();
const toolbar = new Toolbar(this.quillMock, this.options);
this.quillMock.getFormat = () => ({ table: true });
toolbar.updateTableWidgets();
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/desktopTooltip.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/desktopTooltip.tests.js
index 9205430c2753..55a3f263fb84 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/desktopTooltip.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/desktopTooltip.tests.js
@@ -1,3 +1,4 @@
+import $ from 'jquery';
import { DesktopTooltipStrategy } from '__internal/scheduler/tooltip_strategies/desktop_tooltip_strategy';
import { FunctionTemplate } from 'core/templates/function_template';
import { extend } from 'core/utils/extend';
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/editing.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/editing.tests.js
index e2125aa08ba8..a42f81dc26e5 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/editing.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/editing.tests.js
@@ -1,12 +1,12 @@
-const $ = require('jquery');
-const devices = require('core/devices');
-const fx = require('common/core/animation/fx');
-const keyboardMock = require('../../helpers/keyboardMock.js');
-const { createWrapper } = require('../../helpers/scheduler/helpers.js');
-const { waitAsync } = require('../../helpers/scheduler/waitForAsync.js');
-
-require('__internal/scheduler/scheduler');
-require('ui/drop_down_button');
+import $ from 'jquery';
+import devices from 'core/devices';
+import fx from 'common/core/animation/fx';
+import keyboardMock from '../../helpers/keyboardMock.js';
+import { createWrapper } from '../../helpers/scheduler/helpers.js';
+import { waitAsync } from '../../helpers/scheduler/waitForAsync.js';
+
+import '__internal/scheduler/scheduler';
+import 'ui/drop_down_button';
QUnit.testStart(function() {
$('#qunit-fixture').html('
');
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.base.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.base.tests.js
index 344a1ac27a97..81f0ba81e33c 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.base.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.base.tests.js
@@ -1,7 +1,16 @@
-const { getOuterHeight } = require('core/utils/size');
-const $ = require('jquery');
-const { createWrapper } = require('../../helpers/scheduler/helpers.js');
-const { waitAsync } = require('../../helpers/scheduler/waitForAsync.js');
+import { getOuterHeight } from 'core/utils/size';
+import $ from 'jquery';
+import { createWrapper } from '../../helpers/scheduler/helpers.js';
+import { waitAsync } from '../../helpers/scheduler/waitForAsync.js';
+
+import 'fluent_blue_light.css!';
+
+import { noop } from 'core/utils/common';
+import errors from 'ui/widget/ui.errors';
+import config from 'core/config';
+
+import '__internal/scheduler/scheduler';
+import 'ui/drop_down_button';
QUnit.testStart(function() {
$('#qunit-fixture').html(
@@ -10,15 +19,6 @@ QUnit.testStart(function() {
');
});
-require('fluent_blue_light.css!');
-
-const noop = require('core/utils/common').noop;
-const errors = require('ui/widget/ui.errors');
-const config = require('core/config');
-
-require('__internal/scheduler/scheduler');
-require('ui/drop_down_button');
-
QUnit.module('Integration: Base', {
beforeEach: function() {
this.createInstance = async function(options) {
diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.recurrenceRuleValidation.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.recurrenceRuleValidation.tests.js
index a8d5b4170e91..9a93400f7933 100644
--- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.recurrenceRuleValidation.tests.js
+++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.recurrenceRuleValidation.tests.js
@@ -1,4 +1,14 @@
-const $ = require('jquery');
+import $ from 'jquery';
+
+import 'fluent_blue_light.css!';
+
+import fx from 'common/core/animation/fx';
+import * as dragEvents from 'common/core/events/drag';
+import { DataSource } from 'common/data/data_source/data_source';
+import { createWrapper } from '../../helpers/scheduler/helpers.js';
+
+import '__internal/scheduler/scheduler';
+import 'ui/drop_down_button';
QUnit.testStart(function() {
$('#qunit-fixture').html(
@@ -7,16 +17,6 @@ QUnit.testStart(function() {