Skip to content

Commit 6a9c56f

Browse files
committed
test
1 parent e8dc6fa commit 6a9c56f

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

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

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import { setupSchedulerTestEnvironment } from '../__tests__/__mock__/m_mock_sche
1212
const CLASSES = {
1313
icon: 'dx-scheduler-form-icon',
1414
hidden: 'dx-hidden',
15+
16+
mainGroupHidden: 'dx-scheduler-form-main-group-hidden',
17+
recurrenceGroupHidden: 'dx-scheduler-form-recurrence-group-hidden',
1518
};
1619

1720
const getDefaultData = () => [
@@ -436,24 +439,32 @@ describe('Appointment Popup Form', () => {
436439
});
437440

438441
describe('Recurrence', () => {
439-
it('Recurrence editor container should be visible after changing its visibility value', async () => {
440-
const appointment = {
441-
text: 'Test Appointment',
442-
startDate: new Date(2017, 4, 1, 9, 30),
443-
endDate: new Date(2017, 4, 1, 11),
444-
};
445-
446-
const { POM, scheduler } = await createScheduler(getDefaultConfig());
442+
it('changes visibility of groups when opening recurrence form', async () => {
443+
const { scheduler, POM } = await createScheduler(getDefaultConfig());
447444

448-
scheduler.showAppointmentPopup(appointment);
445+
scheduler.showAppointmentPopup();
449446

447+
const mainGroup = $(POM.popup.mainGroup);
450448
const recurrenceGroup = $(POM.popup.recurrenceGroup);
451449

452-
expect(recurrenceGroup.hasClass('dx-scheduler-form-recurrence-hidden')).toBe(true);
450+
expect(mainGroup.hasClass(CLASSES.mainGroupHidden)).toBe(false);
451+
expect(recurrenceGroup.hasClass(CLASSES.recurrenceGroupHidden)).toBe(true);
453452

454453
POM.popup.selectRepeatValue('weekly');
454+
await new Promise(process.nextTick);
455+
456+
const popupHeight = POM.popup.component.option('height');
457+
expect(popupHeight).toBeDefined();
458+
expect(typeof popupHeight).toBe('number');
459+
460+
expect(mainGroup.hasClass(CLASSES.mainGroupHidden)).toBe(true);
461+
expect(recurrenceGroup.hasClass(CLASSES.recurrenceGroupHidden)).toBe(false);
462+
463+
POM.popup.getBackButton().click();
455464

456-
expect(recurrenceGroup.hasClass('dx-scheduler-form-recurrence-hidden')).toBe(false);
465+
expect(POM.popup.component.option('height')).toBeUndefined();
466+
expect(mainGroup.hasClass(CLASSES.mainGroupHidden)).toBe(false);
467+
expect(recurrenceGroup.hasClass(CLASSES.recurrenceGroupHidden)).toBe(true);
457468
});
458469

459470
it('Check that after opening recurrence appointment current form is main form', async () => {
@@ -472,7 +483,7 @@ describe('Appointment Popup Form', () => {
472483

473484
const recurrenceGroup = $(POM.popup.recurrenceGroup);
474485

475-
expect(recurrenceGroup.hasClass('dx-scheduler-form-recurrence-hidden')).toBe(true);
486+
expect(recurrenceGroup.hasClass('dx-scheduler-form-recurrence-group-hidden')).toBe(true);
476487
});
477488

478489
it('Should discard recurrence changes when clicking \'cancel\' button in recurrence form', async () => {

packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,7 @@ export class AppointmentForm {
771771
}
772772

773773
showRecurrenceGroup(): void {
774-
// @ts-expect-error
775-
const overlayHeight = this.dxPopup.$overlayContent().height();
774+
const overlayHeight = this.dxPopup.$overlayContent().get(0).clientHeight;
776775
this.dxPopup.option('height', overlayHeight);
777776

778777
this._$mainGroup?.addClass(CLASSES.mainHidden);

packages/devextreme/js/__internal/scheduler/appointment_popup/m_recurrence_form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const CLASSES = {
2020
formIcon: 'dx-scheduler-form-icon',
2121

2222
recurrenceGroup: 'dx-scheduler-form-recurrence-group',
23-
recurrenceHidden: 'dx-scheduler-form-recurrence-hidden',
23+
recurrenceHidden: 'dx-scheduler-form-recurrence-group-hidden',
2424

2525
frequencyEditor: 'dx-scheduler-form-recurrence-frequency-editor',
2626
byMonthEditor: 'dx-scheduler-form-recurrence-by-month-editor',

0 commit comments

Comments
 (0)