Skip to content

Commit 531f0e1

Browse files
author
Maksim Zakharov
committed
test(scheduler): yet another await Promise.resolve() after popup save
1 parent c92bbab commit 531f0e1

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

packages/devextreme/js/__internal/scheduler/appointment_popup/appointment_popup.integration.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ describe('Appointment Form', () => {
236236
scheduler.showAppointmentPopup(appointment);
237237
POM.popup.setInputValue('subjectEditor', 'Updated subject');
238238
scheduler.hideAppointmentPopup(true);
239+
await Promise.resolve();
239240

240241
const items = (scheduler as any).getDataSource().items();
241242

@@ -266,6 +267,7 @@ describe('Appointment Form', () => {
266267
POM.popup.setInputValue('endTimeEditor', new Date(2017, 4, 25, 10, 0));
267268
POM.popup.setInputValue('descriptionEditor', 'New appointment description');
268269
scheduler.hideAppointmentPopup(true);
270+
await Promise.resolve();
269271

270272
const items = (scheduler as any).getDataSource().items();
271273

@@ -325,6 +327,7 @@ describe('Appointment Form', () => {
325327
POM.popup.editAppointmentButton.click();
326328
POM.popup.setInputValue('subjectEditor', 'single appointment');
327329
scheduler.hideAppointmentPopup(true);
330+
await Promise.resolve();
328331

329332
expect(dataSource.items()).toHaveLength(2);
330333
expect(dataSource.items()[0]).toEqual({
@@ -486,6 +489,7 @@ describe('Appointment Form', () => {
486489

487490
scheduler.showAppointmentPopup({ ...commonAppointment }, true);
488491
scheduler.hideAppointmentPopup(true);
492+
await Promise.resolve();
489493

490494
const item = dataSource.items()[0];
491495

@@ -674,6 +678,7 @@ describe('Appointment Form', () => {
674678

675679
POM.popup.setInputValue(editorName, value);
676680
scheduler.hideAppointmentPopup(true);
681+
await Promise.resolve();
677682

678683
const customFieldValue = scheduler.option(`dataSource[0].${exprValue}`);
679684
const defaultFieldValue = scheduler.option(`dataSource[0].${defaultField}`);
@@ -704,6 +709,7 @@ describe('Appointment Form', () => {
704709
POM.popup.setInputValue(dateEditorName, value);
705710
POM.popup.setInputValue(timeEditorName, value);
706711
scheduler.hideAppointmentPopup(true);
712+
await Promise.resolve();
707713

708714
const customFieldValue = scheduler.option(`dataSource[0].${exprValue}`);
709715
const defaultFieldValue = scheduler.option(`dataSource[0].${defaultField}`);
@@ -728,6 +734,7 @@ describe('Appointment Form', () => {
728734
scheduler.showAppointmentPopup();
729735
POM.popup.selectRepeatValue('daily');
730736
scheduler.hideAppointmentPopup(true);
737+
await Promise.resolve();
731738

732739
const customFieldValue = scheduler.option(`dataSource[0].${exprValue}`);
733740
const defaultFieldValue = scheduler.option(`dataSource[0].${defaultField}`);
@@ -760,6 +767,7 @@ describe('Appointment Form', () => {
760767

761768
POM.popup.setInputValue(exprValue, 2);
762769
scheduler.hideAppointmentPopup(true);
770+
await Promise.resolve();
763771

764772
const customFieldValue = scheduler.option(`dataSource[0].${exprValue}`);
765773
const defaultFieldValue = scheduler.option(`dataSource[0].${defaultField}`);
@@ -2100,6 +2108,7 @@ describe('Appointment Form', () => {
21002108
scheduler.showAppointmentPopup(item);
21012109
POM.popup.setInputValue('subjectEditor', 'New Subject');
21022110
scheduler.hideAppointmentPopup(true);
2111+
await Promise.resolve();
21032112

21042113
expect(dataSource.items()[0]).toMatchObject({ ...commonAppointment, text: 'New Subject' });
21052114
});
@@ -2116,6 +2125,7 @@ describe('Appointment Form', () => {
21162125
POM.popup.selectRepeatValue('weekly');
21172126
POM.popup.setInputValue('recurrenceStartDateEditor', new Date(2024, 4, 25));
21182127
scheduler.hideAppointmentPopup(true);
2128+
await Promise.resolve();
21192129

21202130
expect(dataSource.items()[0]).toMatchObject({
21212131
...commonAppointment,

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/allDayAppointments.common-0.tests.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ module('All day appointments common', config, () => {
568568

569569
scheduler.instance.showAppointmentPopup(newItem, true);
570570
$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');
571+
await Promise.resolve();
571572

572573
const $addedAppointment = $(scheduler.instance.$element()).find('.dx-scheduler-all-day-appointment').eq(0);
573574
const $allDayCell = $(scheduler.instance.$element()).find('.dx-scheduler-all-day-table-cell').eq(0);
@@ -585,6 +586,7 @@ module('All day appointments common', config, () => {
585586
scheduler.instance.showAppointmentPopup(newItem);
586587

587588
$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');
589+
await Promise.resolve();
588590

589591
const workspace = $(scheduler.instance.$element()).find('.dx-scheduler-work-space').dxSchedulerWorkSpaceDay('instance');
590592

@@ -613,6 +615,7 @@ module('All day appointments common', config, () => {
613615

614616
scheduler.instance.showAppointmentPopup(newItem, true);
615617
$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');
618+
await Promise.resolve();
616619

617620
assert.notOk($workspace.hasClass('dx-scheduler-work-space-all-day-collapsed'), 'Work space has not specific class');
618621
});

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.timeline.tests.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ QUnit.test('Scheduler should not update scroll position if appointment is visibl
101101
try {
102102
scheduler.instance.showAppointmentPopup(appointment);
103103
scheduler.appointmentPopup.clickDoneButton();
104+
await Promise.resolve();
104105

105106
assert.notOk(scrollToSpy.calledOnce, 'scrollTo was not called');
106107
} finally {
@@ -132,6 +133,7 @@ QUnit.test('Scheduler should not update scroll position if appointment is visibl
132133
try {
133134
scheduler.instance.showAppointmentPopup(appointment);
134135
scheduler.appointmentPopup.clickDoneButton();
136+
await Promise.resolve();
135137

136138
assert.notOk(scrollToSpy.calledOnce, 'scrollTo was not called');
137139
} finally {
@@ -162,6 +164,7 @@ QUnit.test('Scheduler should update scroll position if appointment is not visibl
162164
try {
163165
scheduler.instance.showAppointmentPopup(appointment);
164166
scheduler.appointmentPopup.clickDoneButton();
167+
await Promise.resolve();
165168

166169
assert.ok(scrollToSpy.calledOnce, 'scrollTo was called');
167170
} finally {
@@ -206,6 +209,7 @@ QUnit.test('Scheduler should not update scroll position if appointment is visibl
206209
try {
207210
scheduler.instance.showAppointmentPopup(appointment);
208211
scheduler.appointmentPopup.clickDoneButton();
212+
await Promise.resolve();
209213

210214
assert.notOk(scrollToSpy.calledOnce, 'scrollTo was not called');
211215
} finally {
@@ -236,6 +240,7 @@ QUnit.test('Scheduler should update scroll position if appointment is not visibl
236240
try {
237241
scheduler.instance.showAppointmentPopup(appointment);
238242
scheduler.appointmentPopup.clickDoneButton();
243+
await Promise.resolve();
239244

240245
assert.ok(scrollToSpy.calledOnce, 'scrollTo was called');
241246
} finally {

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/perfomance.tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ QUnit.module('Render layout', renderLayoutModuleOptions, function() {
336336
scheduler.tooltip.clickOnItem();
337337
scheduler.appointmentForm.setSubject('new text');
338338
scheduler.appointmentPopup.clickDoneButton();
339+
await Promise.resolve();
339340

340341
assert.equal(scheduler.appointments.getAppointmentCount(), 2, 'Should render 2 appointments');
341342
assert.equal(scheduler.appointments.getAppointmentCount(), getUnmarkedAppointments(scheduler).length, 'Should re-rendered all appointments');

0 commit comments

Comments
 (0)