From a67247013528c2044cf3671658e5caa741c4a8f6 Mon Sep 17 00:00:00 2001 From: Aleksey Semikozov Date: Fri, 20 Mar 2026 07:04:26 -0300 Subject: [PATCH 1/2] Scheduler - Qunit tests - remove watchers of private methods --- .../common.events.tests.js | 8 +++--- .../common.options.tests.js | 25 +++++++++---------- .../integration.dateNavigator.tests.js | 13 ++++------ 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js index e58b4a65dd5a..9d763db04664 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js @@ -671,12 +671,14 @@ QUnit.module('Events', { dataSource: [appointment] }); - const workspaceSpy = sinon.spy(scheduler.instance._workSpace, '_dimensionChanged'); - const appointmentsSpy = sinon.spy(scheduler.instance._appointments, 'repaintAppointments'); + const $element = scheduler.instance.$element(); + const initialAppointmentWidth = $element.find('.dx-scheduler-appointment').outerWidth(); + scheduler.instance.option('width', 400); resizeCallbacks.fire(); - assert.ok(appointmentsSpy.calledAfter(workspaceSpy), 'workSpace dimension changing was called before appointments repainting'); + const updatedAppointmentWidth = $element.find('.dx-scheduler-appointment').outerWidth(); + assert.ok(updatedAppointmentWidth < initialAppointmentWidth, 'appointment width is recalculated after resize'); }); QUnit.test('ContentReady event should be fired after render completely ready (T902483)', async function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.options.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.options.tests.js index 0a4b333e8219..b472ed64da73 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.options.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.options.tests.js @@ -636,15 +636,16 @@ QUnit.module('Options', () => { view: 'timelineWeek', }); - const spyAppointmentPopupForm = sinon.spy( - scheduler.instance, - 'createAppointmentPopupForm' - ); - scheduler.instance.option('resources', resources); await waitAsync(10); - assert.ok(spyAppointmentPopupForm.calledOnce, 'Appointment form was recreated'); + scheduler.instance.showAppointmentPopup({ + startDate: new Date(2017, 11, 18, 10), + endDate: new Date(2017, 11, 18, 11), + }, true); + + const resourceEditor = scheduler.appointmentForm.getEditor('TestResources'); + assert.ok(resourceEditor, 'Appointment form contains the resource editor after changing resources'); }); QUnit.test('Filter options should be updated when dataSource is changed', async function(assert) { @@ -935,16 +936,14 @@ QUnit.module('Options', () => { dataSource, }); - const initMarkupSpy = sinon.spy(scheduler.instance, '_initMarkup'); - const reloadDataSourceSpy = sinon.spy(scheduler.instance, 'reloadDataSource'); - let count = 0; + let loadCount = 0; const nextDataSource = new DataSource({ store: new CustomStore({ load: function() { const d = $.Deferred(); setTimeout(function() { - count++; + loadCount++; d.resolve([]); }, 100); @@ -959,10 +958,10 @@ QUnit.module('Options', () => { 'views[2].intervalCount': 2, 'views[2].startDate': new Date(), }); - await waitForAsync(() => count === 2); + await waitForAsync(() => loadCount === 2); + await waitAsync(200); - assert.equal(initMarkupSpy.callCount, 2, 'Init markup was called on each dataSource changes'); - assert.equal(reloadDataSourceSpy.callCount, 2, 'reloadDataSource was called on each changes'); + assert.equal(loadCount, 2, 'Data source load was called exactly twice — once per option change'); }); QUnit.test('It should be possible to change views option when view names are specified (T995794)', async function(assert) { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.dateNavigator.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.dateNavigator.tests.js index fd6f1555e080..f3448f2d7270 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.dateNavigator.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.dateNavigator.tests.js @@ -379,16 +379,13 @@ QUnit.module('Integration: Date navigator', moduleConfig, function() { }); QUnit.test('Tasks should be rerendered after click on next/prev button', async function(assert) { - await this.createInstance({ currentDate: new Date(2015, 1, 24) }); + const initialDate = new Date(2015, 1, 24); + await this.createInstance({ currentDate: initialDate }); - const spy = sinon.spy(this.instance, 'setRemoteFilterIfNeeded'); + $(this.instance.$element()).find('.dx-scheduler-navigator-previous').trigger('dxclick'); - try { - $(this.instance.$element()).find('.dx-scheduler-navigator-previous').trigger('dxclick'); - assert.ok(spy.calledOnce, 'setRemoteFilterIfNeeded is called'); - } finally { - this.instance.setRemoteFilterIfNeeded.restore(); - } + const currentDate = this.instance.option('currentDate'); + assert.ok(currentDate < initialDate, 'currentDate changed to an earlier date after clicking previous'); }); QUnit.test('Tasks should have correct position after click on next/prev button & calendar', async function(assert) { From 46a65ef23a713491b9b842107d608480ff7218aa Mon Sep 17 00:00:00 2001 From: Aleksey Semikozov Date: Fri, 20 Mar 2026 07:16:33 -0300 Subject: [PATCH 2/2] Scheduler - Fix outerWidth call in resize test --- .../DevExpress.ui.widgets.scheduler/common.events.tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js index 9d763db04664..1cc60e62406e 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/common.events.tests.js @@ -671,7 +671,7 @@ QUnit.module('Events', { dataSource: [appointment] }); - const $element = scheduler.instance.$element(); + const $element = $(scheduler.instance.$element()); const initialAppointmentWidth = $element.find('.dx-scheduler-appointment').outerWidth(); scheduler.instance.option('width', 400);