diff --git a/apps/demos/Demos/Charts/SignalRService/signalr-hub.js b/apps/demos/Demos/Charts/SignalRService/signalr-hub.js index 98bdc87e542e..a5d207a65bb3 100644 --- a/apps/demos/Demos/Charts/SignalRService/signalr-hub.js +++ b/apps/demos/Demos/Charts/SignalRService/signalr-hub.js @@ -14,6 +14,8 @@ /// "use strict"; + var isFunction = function(val) { return typeof val === 'function'; }; + if (typeof ($.signalR) !== "function") { throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js."); } @@ -52,7 +54,7 @@ if (hub.client.hasOwnProperty(memberKey)) { memberValue = hub.client[memberKey]; - if (!$.isFunction(memberValue)) { + if (!isFunction(memberValue)) { // Not a client hub function continue; } diff --git a/apps/demos/Demos/DataGrid/SignalRService/signalr-hub.js b/apps/demos/Demos/DataGrid/SignalRService/signalr-hub.js index e547fbb26888..0d6e373c93e8 100644 --- a/apps/demos/Demos/DataGrid/SignalRService/signalr-hub.js +++ b/apps/demos/Demos/DataGrid/SignalRService/signalr-hub.js @@ -15,6 +15,8 @@ /// "use strict"; + var isFunction = function(val) { return typeof val === 'function'; }; + if (typeof ($.signalR) !== "function") { throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js."); } @@ -53,7 +55,7 @@ if (hub.client.hasOwnProperty(memberKey)) { memberValue = hub.client[memberKey]; - if (!$.isFunction(memberValue)) { + if (!isFunction(memberValue)) { // Not a client hub function continue; } diff --git a/packages/devextreme/testing/helpers/gridBaseMocks.js b/packages/devextreme/testing/helpers/gridBaseMocks.js index e2b26c4eb314..bc72a0bcaeaf 100644 --- a/packages/devextreme/testing/helpers/gridBaseMocks.js +++ b/packages/devextreme/testing/helpers/gridBaseMocks.js @@ -1046,7 +1046,7 @@ module.exports = function($, gridCore, columnResizingReordering, domUtils, commo if(options) { if(options.initDefaultOptions) { $.each(modules, function() { - if($.isFunction(this.defaultOptions)) { + if(typeUtils.isFunction(this.defaultOptions)) { that.option(this.defaultOptions()); } }); diff --git a/packages/devextreme/testing/helpers/nativePointerMock.js b/packages/devextreme/testing/helpers/nativePointerMock.js index 3ae8ec0c7c3b..fab9e3227981 100644 --- a/packages/devextreme/testing/helpers/nativePointerMock.js +++ b/packages/devextreme/testing/helpers/nativePointerMock.js @@ -41,6 +41,7 @@ const isBoolean = function(val) { return typeof val === 'boolean'; }; const isObject = function(val) { return typeof val === 'object'; }; const isNumeric = function(val) { return typeof val === 'number'; }; + const isFunction = function(val) { return typeof val === 'function'; }; const MOUSE_EVENTS = { 'click': 1, @@ -329,7 +330,7 @@ if(!isNumeric(detail)) { detail = 1; - if($.isFunction(document.createEvent)) { + if(isFunction(document.createEvent)) { customEvent = document.createEvent('UIEvents'); customEvent.initUIEvent(type, bubbles, cancelable, view, detail); diff --git a/packages/devextreme/testing/helpers/vizMocks.js b/packages/devextreme/testing/helpers/vizMocks.js index 1ce9153eb7c8..3b281643553d 100644 --- a/packages/devextreme/testing/helpers/vizMocks.js +++ b/packages/devextreme/testing/helpers/vizMocks.js @@ -15,7 +15,8 @@ require('viz/core/renderers/renderer'), require('viz/core/errors_warnings'), require('__internal/viz/core/m_base_widget'), - require('viz/core/base_widget.utils') + require('viz/core/base_widget.utils'), + require('core/utils/type') ); }); } else { @@ -32,10 +33,11 @@ DevExpress.require('viz/core/renderers/renderer'), DevExpress.require('viz/core/errors_warnings'), DevExpress.require('__internal/viz/core/m_base_widget'), - DevExpress.require('viz/core/base_widget.utils') + DevExpress.require('viz/core/base_widget.utils'), + DevExpress.require('core/utils/type') ); } -}(window, function($, tooltipModule, titleModule, legendModule, axisModule, pointModule, Series, loadingIndicatorModule, exportMenuModule, rendererModule, errors, baseWidgetModule, baseWidgetUtils) { +}(window, function($, tooltipModule, titleModule, legendModule, axisModule, pointModule, Series, loadingIndicatorModule, exportMenuModule, rendererModule, errors, baseWidgetModule, baseWidgetUtils, typeUtils) { /* global currentAssert, currentTest */ const Element = stubClass(rendererModule.SvgElement, { @@ -94,7 +96,7 @@ return this; }, getBBox: function() { - const template = $.isFunction(this.renderer.bBoxTemplate) ? this.renderer.bBoxTemplate.call(this) : this.renderer.bBoxTemplate; + const template = typeUtils.isFunction(this.renderer.bBoxTemplate) ? this.renderer.bBoxTemplate.call(this) : this.renderer.bBoxTemplate; return $.extend({}, template); }, dispose: function() { @@ -219,9 +221,9 @@ this._resetStub = function(stub) { $.each(stub, function(key, value) { - if($.isFunction(value && value.reset)) { + if(typeUtils.isFunction(value && value.reset)) { value.reset(); - $.isFunction(value.resetBehavior) && value.resetBehavior(); + typeUtils.isFunction(value.resetBehavior) && value.resetBehavior(); } else { stub[key] = undefined; } diff --git a/packages/devextreme/testing/helpers/widgetsIterator.js b/packages/devextreme/testing/helpers/widgetsIterator.js index 56c622cd563f..b8f8a922fa88 100644 --- a/packages/devextreme/testing/helpers/widgetsIterator.js +++ b/packages/devextreme/testing/helpers/widgetsIterator.js @@ -1,5 +1,6 @@ define(function(require) { const $ = require('jquery'); + const typeUtils = require('core/utils/type'); return function(namespace, parent, excluded) { excluded = excluded || []; @@ -12,7 +13,7 @@ define(function(require) { return; } - if($.isFunction(excluded) ? !excluded(componentName) : $.inArray(componentName, excluded) > -1) { + if(typeUtils.isFunction(excluded) ? !excluded(componentName) : $.inArray(componentName, excluded) > -1) { return; } diff --git a/packages/devextreme/testing/tests/DevExpress.jquery/eventRegistrator.tests.js b/packages/devextreme/testing/tests/DevExpress.jquery/eventRegistrator.tests.js index 070d6b6c34f9..e7f5e1c087ac 100644 --- a/packages/devextreme/testing/tests/DevExpress.jquery/eventRegistrator.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.jquery/eventRegistrator.tests.js @@ -87,7 +87,7 @@ define(function(require) { assert.strictEqual(LOG.arguments[0], this.element[0], 'element'); assert.strictEqual(LOG.arguments[1], data, 'data'); assert.deepEqual(LOG.arguments[2], ['test1', 'test2'], 'namespaces'); - assert.ok($.isFunction(LOG.arguments[3]), 'eventHandle'); + assert.ok(isFunction(LOG.arguments[3]), 'eventHandle'); }); QUnit.test('\'teardown\' method', function(assert) { @@ -105,7 +105,7 @@ define(function(require) { assert.equal(LOG.arguments.length, 3, 'arguments count'); assert.strictEqual(LOG.arguments[0], this.element[0], 'element'); assert.deepEqual(LOG.arguments[1], ['test1', 'test2'], 'namespaces'); - assert.ok($.isFunction(LOG.arguments[2]), 'eventHandle'); + assert.ok(isFunction(LOG.arguments[2]), 'eventHandle'); }); QUnit.test('\'add\' method', function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.knockout/dataGrid.tests.js b/packages/devextreme/testing/tests/DevExpress.knockout/dataGrid.tests.js index 457fb2d01906..938a16bdce97 100644 --- a/packages/devextreme/testing/tests/DevExpress.knockout/dataGrid.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.knockout/dataGrid.tests.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import ko from 'knockout'; import { DataSource } from 'data/data_source/data_source'; import { logger } from 'core/utils/console'; +import { isFunction } from 'core/utils/type'; import fx from 'animation/fx'; import dataSourceAdapter from '__internal/grids/data_grid/m_data_source_adapter'; import dataGridMocks from '../../helpers/dataGridMocks.js'; @@ -51,7 +52,7 @@ const processColumnsForCompare = function(columns, parameterNames) { delete this[propertyName]; } } else { - if($.isFunction(this[propertyName])) { + if(isFunction(this[propertyName])) { delete this[propertyName]; } if(propertyName === 'filterOperations' || diff --git a/packages/devextreme/testing/tests/DevExpress.localization/sharedParts/localization.shared.js b/packages/devextreme/testing/tests/DevExpress.localization/sharedParts/localization.shared.js index cf45f8dd2395..205c8916681b 100644 --- a/packages/devextreme/testing/tests/DevExpress.localization/sharedParts/localization.shared.js +++ b/packages/devextreme/testing/tests/DevExpress.localization/sharedParts/localization.shared.js @@ -5,6 +5,7 @@ import messageLocalization from 'localization/message'; import errors from 'core/errors'; import localization from 'localization'; import config from 'core/config'; +import { isFunction } from 'core/utils/type'; import { logger } from 'core/utils/console'; import { generateDate } from '../../../helpers/dateHelper.js'; @@ -14,7 +15,7 @@ export default function() { const checkModules = function(testName, namespace, methods) { QUnit.test(testName, function(assert) { $.each(methods, function(index, method) { - assert.ok($.isFunction(namespace[method]), method + ' method exists'); + assert.ok(isFunction(namespace[method]), method + ' method exists'); }); }); }; diff --git a/packages/devextreme/testing/tests/DevExpress.ui.events/eventRegistrator.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.events/eventRegistrator.tests.js index 8991da54889f..6bb8ed6bbf5c 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.events/eventRegistrator.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.events/eventRegistrator.tests.js @@ -3,6 +3,7 @@ import registerEvent from 'events/core/event_registrator'; import eventsEngine from 'events/core/events_engine'; import registerEventCallbacks from 'events/core/event_registrator_callbacks'; import Class from 'core/class'; +import { isFunction } from 'core/utils/type'; import eventHelper from '../../helpers/eventHelper.js'; @@ -87,7 +88,7 @@ QUnit.test('\'setup\' method', function(assert) { assert.strictEqual(LOG.arguments[0], this.element[0], 'element'); assert.strictEqual(LOG.arguments[1], data, 'data'); assert.deepEqual(LOG.arguments[2], ['test1', 'test2'], 'namespaces'); - assert.ok($.isFunction(LOG.arguments[3]), 'eventHandle'); + assert.ok(isFunction(LOG.arguments[3]), 'eventHandle'); }); QUnit.test('\'teardown\' method', function(assert) { @@ -103,7 +104,7 @@ QUnit.test('\'teardown\' method', function(assert) { assert.equal(LOG.arguments.length, 3, 'arguments count'); assert.strictEqual(LOG.arguments[0], this.element[0], 'element'); assert.deepEqual(LOG.arguments[1], ['test1', 'test2'], 'namespaces'); - assert.ok($.isFunction(LOG.arguments[2]), 'eventHandle'); + assert.ok(isFunction(LOG.arguments[2]), 'eventHandle'); }); QUnit.test('\'add\' method', function(assert) { 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 e17b0d147aca..59cc6031f727 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/baseTests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.events/pointerParts/baseTests.js @@ -1,5 +1,6 @@ const $ = require('jquery'); const noop = require('core/utils/common').noop; +const typeUtils = require('core/utils/type'); const BaseStrategy = require('events/pointer/base'); const registerEvent = require('events/core/event_registrator'); const special = require('../../../helpers/eventHelper.js').special; @@ -231,7 +232,7 @@ QUnit.test('event is triggered one time after refresh', function(assert) { }); QUnit.test('pointer event base strategy should have \'setup\' implementation, because jQuery adds a browser event via addEventListener/attachEvent otherwise (T208653)', function(assert) { - assert.ok($.isFunction((new BaseStrategy('', '')).setup)); + assert.ok(typeUtils.isFunction((new BaseStrategy('', '')).setup)); }); QUnit.test('pointer events should correctly unsubscribe events with target', function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/columnsController.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/columnsController.tests.js index 87bcb225c478..3d23530c201a 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/columnsController.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/columnsController.tests.js @@ -62,7 +62,7 @@ const processColumnsForCompare = function(columns, parameterNames, ignoreParamet delete this[propertyName]; } } else { - if($.isFunction(this[propertyName])) { + if(isFunction(this[propertyName])) { delete this[propertyName]; } if([ diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataController.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataController.tests.js index f1b99abd7857..6f66c2685af5 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataController.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataController.tests.js @@ -6880,14 +6880,14 @@ QUnit.module('Filtering', { assert.ok(Array.isArray(filter[0]), 'first argument is filter expression'); assert.strictEqual(filter[1], 'and', 'second argument is operation \'and\''); assert.ok(Array.isArray(filter[2]), 'third argument is filter expression'); - assert.ok($.isFunction(filter[0][0]), 'filter expression selector is function'); + assert.ok(typeUtils.isFunction(filter[0][0]), 'filter expression selector is function'); filter = this.getCombinedFilter(true); assert.ok(Array.isArray(filter[0]), 'first argument is filter expression'); assert.strictEqual(filter[1], 'and', 'second argument is operation \'and\''); assert.ok(Array.isArray(filter[2]), 'third argument is filter expression'); assert.equal(filter.length, 3, 'filter expression + \'and\' + \'filter expression\''); - assert.ok(!$.isFunction(filter[2][0]), 'filter expression selector isn\'t function'); + assert.ok(!typeUtils.isFunction(filter[2][0]), 'filter expression selector isn\'t function'); assert.strictEqual(filter[0][0], 'name', 'value of the selector'); }); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js index f773886c7ecf..166113a48438 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js @@ -3100,7 +3100,7 @@ QUnit.module('API methods', baseModuleConfig, () => { let reloadResolved = false; const d = dataGrid.refresh(); - assert.ok($.isFunction(d.promise), 'type object is the Deferred'); + assert.ok(typeUtils.isFunction(d.promise), 'type object is the Deferred'); d.done(function() { reloadResolved = true; }); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js index eda9ba9a35d0..b93f6f31fe9b 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js @@ -6,6 +6,7 @@ import gridCoreUtils from '__internal/grids/grid_core/m_utils'; import $ from 'jquery'; import ArrayStore from 'data/array_store'; import { noop } from 'core/utils/common'; +import { isFunction } from 'core/utils/type'; import ODataStore from 'data/odata/store'; import devices from 'core/devices'; import { DataSource } from 'data/data_source/data_source'; @@ -1764,7 +1765,7 @@ QUnit.module('Header Filter', { // assert assert.ok(list.option('searchEnabled'), 'list with search bar'); - assert.ok($.isFunction(list.option('searchExpr')), 'expr is correct'); + assert.ok(isFunction(list.option('searchExpr')), 'expr is correct'); assert.equal(list.option('searchTimeout'), 300, 'search timeout is assigned'); assert.equal(list.option('searchMode'), 'contains', 'search mode is default'); }); @@ -1803,7 +1804,7 @@ QUnit.module('Header Filter', { // assert assert.ok(list.option('searchEnabled'), 'list with search bar'); - assert.ok($.isFunction(list.option('searchExpr')), 'expr is correct'); + assert.ok(isFunction(list.option('searchExpr')), 'expr is correct'); assert.equal(list.option('searchTimeout'), 300, 'search timeout is assigned'); assert.equal(list.option('searchMode'), 'equals', 'search mode is assigned'); }); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js index 973438fec92a..a7c2e103cd47 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js @@ -5,7 +5,7 @@ import dataUtils from 'core/element_data'; import config from 'core/config'; import browser from 'core/utils/browser'; import errors from 'core/errors'; -import { isRenderer } from 'core/utils/type'; +import { isFunction, isRenderer } from 'core/utils/type'; import { normalizeKeyName } from 'events/utils/index'; import ArrayStore from 'data/array_store'; @@ -1566,7 +1566,7 @@ QUnit.module('options', { const popup = $lookup.find('.' + POPUP_CLASS).dxPopup('instance'); let initialValue = popup.option('width'); - if($.isFunction(initialValue)) { + if(isFunction(initialValue)) { initialValue = initialValue(); } @@ -1574,7 +1574,7 @@ QUnit.module('options', { instance.option('dropDownOptions.width', 'auto'); let autoValue = popup.option('width'); - if($.isFunction(autoValue)) { + if(isFunction(autoValue)) { autoValue = autoValue(); } @@ -1600,7 +1600,7 @@ QUnit.module('options', { const popup = $lookup.find('.' + POPUP_CLASS).dxPopup('instance'); let initialValue = popup.option('height'); - if($.isFunction(initialValue)) { + if(isFunction(initialValue)) { initialValue = initialValue(); } @@ -1608,7 +1608,7 @@ QUnit.module('options', { instance.option('dropDownOptions.height', 'auto'); let autoValue = popup.option('height'); - if($.isFunction(autoValue)) { + if(isFunction(autoValue)) { autoValue = autoValue(); } diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/tagBox.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/tagBox.tests.js index a3f3b2e83cab..1cdfc44bd0bf 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/tagBox.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/tagBox.tests.js @@ -1,6 +1,6 @@ import $ from 'jquery'; import { DataSource } from 'data/data_source/data_source'; -import { isRenderer } from 'core/utils/type'; +import { isFunction, isRenderer } from 'core/utils/type'; import { createTextElementHiddenCopy } from 'core/utils/dom'; import ajaxMock from '../../helpers/ajaxMock.js'; import config from 'core/config'; @@ -6819,7 +6819,7 @@ QUnit.module('performance', () => { $item.trigger('dxclick'); const filter = load.lastCall.args[0].filter; - assert.ok($.isFunction(filter), 'filter is function'); + assert.ok(isFunction(filter), 'filter is function'); }); QUnit.test('loadOptions.filter should be correct when user filter is also used', function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/chartIntegration.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/chartIntegration.tests.js index 6dbd05959981..542370705e90 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/chartIntegration.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/chartIntegration.tests.js @@ -2,6 +2,7 @@ import '../../helpers/noIntl.js'; import $ from 'jquery'; +import { isFunction } from 'core/utils/type'; import { PivotGridDataSource } from '__internal/grids/pivot_grid/data_source/m_data_source'; import executeAsyncMock from '../../helpers/executeAsyncMock.js'; @@ -79,7 +80,7 @@ QUnit.module('Chart Binding', { const pivotGrid = createPivotGrid(); assert.ok(pivotGrid); - assert.ok($.isFunction(pivotGrid.bindChart)); + assert.ok(isFunction(pivotGrid.bindChart)); }); QUnit.test('Call bind chart without arguments', function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.initialization.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.initialization.tests.js index 3bf12679570b..dadb981d0a8a 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.initialization.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.initialization.tests.js @@ -2,6 +2,7 @@ import fx from 'animation/fx'; import { DataSource } from 'data/data_source/data_source'; import { triggerHidingEvent, triggerShownEvent } from 'events/visibility_change'; +import { isFunction } from 'core/utils/type'; import $ from 'jquery'; import { AppointmentDataProvider } from '__internal/scheduler/appointments/data_provider/m_appointment_data_provider'; import errors from 'ui/widget/ui.errors'; @@ -92,8 +93,8 @@ QUnit.module('Initialization', { 'allDay', 'recurrenceRule', 'recurrenceException'], function(_, field) { - assert.ok($.isFunction(dataAccessors.getter[field]), '\'' + field + '\' getter is OK'); - assert.ok($.isFunction(dataAccessors.setter[field]), '\'' + field + '\' setter is OK'); + assert.ok(isFunction(dataAccessors.getter[field]), '\'' + field + '\' getter is OK'); + assert.ok(isFunction(dataAccessors.setter[field]), '\'' + field + '\' setter is OK'); }); }); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets/contextMenu.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets/contextMenu.tests.js index dc1e8a680f79..365741c26263 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/contextMenu.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/contextMenu.tests.js @@ -9,7 +9,7 @@ import ContextMenu from 'ui/context_menu'; import { addNamespace } from 'events/utils/index'; import contextMenuEvent from 'events/contextmenu'; import holdEvent from 'events/hold'; -import { isRenderer } from 'core/utils/type'; +import { isFunction, isRenderer } from 'core/utils/type'; import config from 'core/config'; import keyboardMock from '../../helpers/keyboardMock.js'; import ariaAccessibilityTestHelper from '../../helpers/ariaAccessibilityTestHelper.js'; @@ -1013,11 +1013,11 @@ QUnit.module('Showing and hiding context menu', moduleConfig, () => { let d = instance.show(); - assert.ok($.isFunction(d.promise), 'type object is the Deferred'); + assert.ok(isFunction(d.promise), 'type object is the Deferred'); d = instance.hide(); - assert.ok($.isFunction(d.promise), 'type object is the Deferred'); + assert.ok(isFunction(d.promise), 'type object is the Deferred'); }); QUnit.test('overlay wrapper should have the same size as window (T1102095)', function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js index c6dfe9464bde..9d875ed4401e 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js @@ -1,6 +1,6 @@ import $ from 'jquery'; import { DataSource } from 'data/data_source/data_source'; -import { isRenderer } from 'core/utils/type'; +import { isFunction, isRenderer } from 'core/utils/type'; import { noop } from 'core/utils/common'; import config from 'core/config'; import devices from 'core/devices'; @@ -94,7 +94,7 @@ const ScrollViewMock = DOMComponent.inherit({ pullDown() { const pullDownHandler = this.option('onPullDown'); - if($.isFunction(pullDownHandler)) { + if(isFunction(pullDownHandler)) { pullDownHandler(); } }, @@ -102,7 +102,7 @@ const ScrollViewMock = DOMComponent.inherit({ scrollBottom() { const scrollBottomHandler = this.option('onReachBottom'); - if($.isFunction(scrollBottomHandler)) { + if(isFunction(scrollBottomHandler)) { scrollBottomHandler(); } }, @@ -2230,7 +2230,7 @@ QUnit.module('dataSource integration', moduleSetup, () => { const widget = this.element.dxList('instance'); const changedHandler = widget._proxiedDataSourceChangedHandler; - assert.ok($.isFunction(changedHandler)); + assert.ok(isFunction(changedHandler)); assert.ok(dataSource._eventsStrategy._events['changed'].has(changedHandler)); widget._dispose(); diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets/treeView.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets/treeView.tests.js index a5a470ad0342..fd1733a9b437 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/treeView.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/treeView.tests.js @@ -3,6 +3,7 @@ import $ from 'jquery'; import CustomStore from 'data/custom_store'; import ArrayStore from 'data/array_store'; +import { isFunction } from 'core/utils/type'; import 'ui/tree_view'; @@ -158,7 +159,7 @@ window.initTree = function(options) { window.stripFunctions = function(obj) { const result = $.extend(true, {}, obj); $.each(result, function(field, value) { - if($.isFunction(value)) { + if(isFunction(value)) { delete result[field]; } diff --git a/packages/devextreme/testing/tests/DevExpress.ui/defaultOptions.tests.js b/packages/devextreme/testing/tests/DevExpress.ui/defaultOptions.tests.js index aec51432c45d..7ccfff40ca4a 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui/defaultOptions.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui/defaultOptions.tests.js @@ -7,6 +7,7 @@ import devices from 'core/devices'; import themes from 'ui/themes'; import support from 'core/utils/support'; import publicComponentUtils from 'core/utils/public_component'; +import { isFunction } from 'core/utils/type'; import { getNestedOptionValue } from 'core/options/utils'; import ActionSheet from 'ui/action_sheet'; @@ -94,7 +95,7 @@ const testComponentDefaults = function(componentClass, forcedDevices, options, b } const $container = $('#cmp'); const component = new componentClass($container); - options = $.isFunction(options) ? options.call(component) : options; + options = isFunction(options) ? options.call(component) : options; const defaults = component.option(); checkOptions.apply(component, [options, defaults, JSON.stringify(device), assert]); @@ -111,7 +112,7 @@ const checkOptions = function(expectedOptions, resultOptions, deviceString, asse $.each(expectedOptions, function(optionName, expectedValue) { let resultValue = getNestedOptionValue(resultOptions, optionName); - resultValue = $.isFunction(resultValue) ? resultValue.call(that) : resultValue; + resultValue = isFunction(resultValue) ? resultValue.call(that) : resultValue; if($.isPlainObject(expectedValue)) { checkOptions(expectedValue, resultValue, null, assert); diff --git a/packages/devextreme/testing/tests/DevExpress.ui/widget.tests.js b/packages/devextreme/testing/tests/DevExpress.ui/widget.tests.js index 600295652553..112c832f05fc 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui/widget.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui/widget.tests.js @@ -12,6 +12,7 @@ import pointerMock from '../../helpers/pointerMock.js'; import config from 'core/config'; import dataUtils from 'core/element_data'; import { deferUpdate } from 'core/utils/common'; +import { isFunction } from 'core/utils/type'; import registerKeyHandlerTestHelper from '../../helpers/registerKeyHandlerTestHelper.js'; import 'generic_light.css!'; @@ -441,7 +442,7 @@ QUnit.module('API', { const element = $('#widget'); const instance = new NewWidget(element); - assert.ok($.isFunction(instance.repaint)); + assert.ok(isFunction(instance.repaint)); const children = element.children(); @@ -455,7 +456,7 @@ QUnit.module('API', { const $anotherElement = $('#another').dxWidget({ focusStateEnabled: true }); const anotherInstance = $anotherElement.dxWidget('instance'); - assert.ok($.isFunction(instance.focus), 'focus method exist'); + assert.ok(isFunction(instance.focus), 'focus method exist'); anotherInstance.focus(); assert.ok($anotherElement.hasClass(FOCUSED_STATE_CLASS), '\'focus\' method focus the widget'); diff --git a/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part1.tests.js b/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part1.tests.js index 53a73ac4c48d..9bb848c33668 100644 --- a/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part1.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part1.tests.js @@ -1,5 +1,6 @@ const $ = require('jquery'); const noop = require('core/utils/common').noop; +const typeUtils = require('core/utils/type'); const vizMocks = require('../../helpers/vizMocks.js'); const commons = require('./chartParts/commons.js'); const DataSource = require('data/data_source/data_source').DataSource; @@ -21,8 +22,8 @@ QUnit.module('dxChart', commons.environment); QUnit.test('dxChart creation', function(assert) { const chart = this.createChart({}); - assert.ok($.isFunction(chart.showLoadingIndicator)); - assert.ok($.isFunction(chart.hideLoadingIndicator)); + assert.ok(typeUtils.isFunction(chart.showLoadingIndicator)); + assert.ok(typeUtils.isFunction(chart.hideLoadingIndicator)); assert.strictEqual(rendererModule.Renderer.firstCall.args[0]['cssClass'], 'dxc dxc-chart', 'root class'); }); diff --git a/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part3.tests.js b/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part3.tests.js index 7cd68867ec11..40d77ef58eff 100644 --- a/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part3.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.viz.charts/chart.part3.tests.js @@ -1,4 +1,5 @@ const $ = require('jquery'); +const typeUtils = require('core/utils/type'); const commons = require('./chartParts/commons.js'); const rendererModule = require('viz/core/renderers/renderer'); const legendModule = require('viz/components/legend'); @@ -1078,7 +1079,7 @@ QUnit.test('Create Horizontal Legend with single named series, position = outsid assert.strictEqual(legendCtorArgs.backgroundClass, 'dxc-border', 'background class'); assert.strictEqual(legendCtorArgs.itemGroupClass, 'dxc-item', 'item group class'); assert.strictEqual(legendCtorArgs.textField, 'seriesName', 'text field'); - assert.ok($.isFunction(legendCtorArgs.getFormatObject), 'getFormatObject is function'); + assert.ok(typeUtils.isFunction(legendCtorArgs.getFormatObject), 'getFormatObject is function'); assert.deepEqual(legendCtorArgs.getFormatObject({ id: 'id', text: 'text', diff --git a/packages/devextreme/testing/tests/DevExpress.viz.charts/pieChart.tests.js b/packages/devextreme/testing/tests/DevExpress.viz.charts/pieChart.tests.js index a91849289391..992d86cfd4c2 100644 --- a/packages/devextreme/testing/tests/DevExpress.viz.charts/pieChart.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.viz.charts/pieChart.tests.js @@ -1,5 +1,6 @@ import $ from 'jquery'; import { noop } from 'core/utils/common'; +import { isFunction } from 'core/utils/type'; import vizMocks from '../../helpers/vizMocks.js'; import executeAsyncMock from '../../helpers/executeAsyncMock.js'; import commons from './chartParts/commons.js'; @@ -1503,7 +1504,7 @@ const overlappingEnvironment = $.extend({}, environment, { }); // assert - assert.ok($.isFunction(this.stubSeries.legendCallback), 'legend callback passed'); + assert.ok(isFunction(this.stubSeries.legendCallback), 'legend callback passed'); }); QUnit.test('Legend callback', function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.viz.core/translator2D.tests.js b/packages/devextreme/testing/tests/DevExpress.viz.core/translator2D.tests.js index 1b60882b87e1..0734886978fd 100644 --- a/packages/devextreme/testing/tests/DevExpress.viz.core/translator2D.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.viz.core/translator2D.tests.js @@ -1,6 +1,7 @@ import $ from 'jquery'; import translator2DModule from 'viz/translators/translator2d'; import { adjust } from 'core/utils/math'; +import { isFunction } from '../../../js/core/utils/type'; function prepareScaleBreaks(array, breakSize) { const breaks = []; @@ -110,9 +111,9 @@ QUnit.test('Create vertical translator', function(assert) { assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: 0, minVisible: 10, max: 100, maxVisible: 90, interval: 20, axisType: 'continuous', dataType: 'numeric', invert: true }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.equal(translator._canvasOptions.rangeMin, 0); assert.equal(translator._canvasOptions.rangeMax, 100); @@ -149,9 +150,9 @@ QUnit.test('Create horizontal translator', function(assert) { assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: 0, minVisible: 10, max: 100, maxVisible: 90, interval: 20, axisType: 'continuous', dataType: 'numeric', invert: true }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.equal(translator._canvasOptions.rangeMin, 0); assert.equal(translator._canvasOptions.rangeMax, 100); @@ -188,9 +189,9 @@ QUnit.test('Create numeric translator', function(assert) { assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: 0, minVisible: 0, max: 100, maxVisible: 100, interval: 20, axisType: 'continuous', dataType: 'numeric' }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); }); QUnit.test('Create numeric translator when business range delta = 0, Min = max = minVisible = maxVisible != 0', function(assert) { @@ -326,9 +327,9 @@ QUnit.test('Create datetime translator', function(assert) { assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: new Date(2012, 9, 1), max: new Date(2012, 9, 2), minVisible: new Date(2012, 9, 1), maxVisible: new Date(2012, 9, 2), interval: new Date(2012, 9, 2) - new Date(2012, 9, 1), axisType: 'continuous', dataType: 'datetime' }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); }); QUnit.test('Create datetime translator when business range delta = 0. min = minVisible = maxVisible = max', function(assert) { @@ -420,9 +421,9 @@ QUnit.test('Create discrete translator (Stick = false, invert = false)', functio assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { categories: ['First', 'Second', 'Third', 'Fourth'], axisType: 'discrete', dataType: 'string' }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.deepEqual(translator._categories, ['First', 'Second', 'Third', 'Fourth']); assert.equal(translator._canvasOptions.interval, 127.5); @@ -470,9 +471,9 @@ QUnit.test('Create logarithmic translator', function(assert) { assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: 10, minVisible: 100, max: 10000, maxVisible: 1000, interval: 1, base: 10, axisType: 'logarithmic', dataType: 'numeric' }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.roughEqual(translator._canvasOptions.rangeMaxVisible, 3, 0.00001); assert.roughEqual(translator._canvasOptions.rangeMinVisible, 2, 0.00001); @@ -493,9 +494,9 @@ QUnit.test('Create logarithmic translator. Min = max = minVisible = maxVisible = assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: 10, minVisible: 10, max: 10, maxVisible: 10, interval: 1, base: 10, axisType: 'logarithmic', dataType: 'numeric' }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.equal(translator._canvasOptions.rangeMaxVisible, 1); assert.equal(translator._canvasOptions.rangeMinVisible, 1); @@ -516,9 +517,9 @@ QUnit.test('Create logarithmic translator. Base = 2', function(assert) { assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: 2, minVisible: 4, max: 32, maxVisible: 16, interval: 1, base: 2, axisType: 'logarithmic', dataType: 'numeric' }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.roughEqual(translator._canvasOptions.rangeMaxVisible, 4, 0.00001); assert.roughEqual(translator._canvasOptions.rangeMinVisible, 2, 0.00001); @@ -564,9 +565,9 @@ QUnit.test('Update business range', function(assert) { assert.deepEqual(translator._canvas, { width: 610, height: 400, left: 70, top: 10, right: 30, bottom: 60 }); assert.deepEqual(getObjectData(translator._businessRange), { min: -1000, minVisible: -600, maxVisible: -90, max: -10, invert: false, axisType: 'continuous', dataType: 'numeric' }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.equal(translator._canvasOptions.rangeMin, -1000); assert.equal(translator._canvasOptions.rangeMax, -10); @@ -592,9 +593,9 @@ QUnit.test('Update canvas', function(assert) { assert.deepEqual(translator._canvas, { width: 333, height: 444, left: 13, top: 15, right: 14, bottom: 16 }); - assert.ok($.isFunction(translator.translate)); - assert.ok($.isFunction(translator.from)); - assert.ok($.isFunction(translator.getInterval)); + assert.ok(isFunction(translator.translate)); + assert.ok(isFunction(translator.from)); + assert.ok(isFunction(translator.getInterval)); assert.equal(translator._canvasOptions.rangeMin, 0); assert.equal(translator._canvasOptions.rangeMax, 100); diff --git a/packages/devextreme/testing/tests/DevExpress.viz.renderers/Animation.tests.js b/packages/devextreme/testing/tests/DevExpress.viz.renderers/Animation.tests.js index 1313bbbbde8e..509b6d83a279 100644 --- a/packages/devextreme/testing/tests/DevExpress.viz.renderers/Animation.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.viz.renderers/Animation.tests.js @@ -833,11 +833,11 @@ QUnit.module('SvgAnimationStep', { QUnit.test('animateSvgStep object', function(assert) { const step = this.animationStep; assert.ok(step); - assert.ok($.isFunction(step.segments), 'can animate segments'); - assert.ok($.isFunction(step.transform), 'can animate transform'); - assert.ok($.isFunction(step.complete), 'complete action for all animate'); - assert.ok($.isFunction(step.base), 'can translate same attribute'); - assert.ok($.isFunction(step._), 'no action step'); + assert.ok(typeUtils.isFunction(step.segments), 'can animate segments'); + assert.ok(typeUtils.isFunction(step.transform), 'can animate transform'); + assert.ok(typeUtils.isFunction(step.complete), 'complete action for all animate'); + assert.ok(typeUtils.isFunction(step.base), 'can translate same attribute'); + assert.ok(typeUtils.isFunction(step._), 'no action step'); }); QUnit.test('Base step', function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.viz.sparklines/sparkline.tests.js b/packages/devextreme/testing/tests/DevExpress.viz.sparklines/sparkline.tests.js index 691cd7511c7e..a0040f05fcea 100644 --- a/packages/devextreme/testing/tests/DevExpress.viz.sparklines/sparkline.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.viz.sparklines/sparkline.tests.js @@ -1,6 +1,7 @@ /* global currentTest, createTestContainer */ const $ = require('jquery'); +const typeUtils = require('core/utils/type'); const vizMocks = require('../../helpers/vizMocks.js'); const tooltipModule = require('viz/core/tooltip'); const BaseWidget = require('__internal/viz/core/m_base_widget').default; @@ -2076,7 +2077,7 @@ QUnit.begin(function() { QUnit.test('sparkline contains export methods', function(assert) { const sparkline = this.createSparkline({}); - assert.ok($.isFunction(sparkline.exportTo)); + assert.ok(typeUtils.isFunction(sparkline.exportTo)); }); QUnit.module('drawn', {