Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Comment on lines +642 to +646
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test’s new assertion is satisfied even if the appointment popup form is created lazily only when showAppointmentPopup is called, so it may not actually validate that the form is recreated in response to the resources option change. To keep the original intent without spying on internals, create/show the popup first (so a form instance exists), then change resources, then verify via a public signal that the form was rebuilt/updated (e.g., the resource editor appears/updates after the change).

Copilot uses AI. Check for mistakes.
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) {
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra waitAsync(200) introduces an arbitrary time-based delay that slows the suite and can still be flaky on slow/fast environments. Prefer a deterministic approach (e.g., sinon fake timers with a controlled tick, or a helper that waits until loadCount stays unchanged for a short period) so the test asserts “no additional loads happen” without fixed sleeps.

Suggested change
await waitAsync(200);

Copilot uses AI. Check for mistakes.

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Comment on lines 381 to +385
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test no longer verifies the behavior implied by its name (“Tasks should be rerendered…”). It now only checks that currentDate becomes earlier after clicking Previous, which is already covered by the existing “Click on the 'previous' button should update currentDate” tests above and doesn’t assert anything about task/appointment rerendering. Consider either renaming the test to match the new assertion or asserting a public rerendering outcome (e.g., a DOM change in rendered appointments/tasks after navigation).

Copilot uses AI. Check for mistakes.

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) {
Expand Down
Loading