Skip to content

Commit 1df0ea7

Browse files
committed
test: add test
1 parent 532bbc7 commit 1df0ea7

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

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

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,72 @@ describe('Appointment Popup Form', () => {
14681468
expect(POM.popup.component.option('showCloseButton')).toBe(true);
14691469
expect(POM.popup.component.option('enableBodyScroll')).toBe(true);
14701470
});
1471+
1472+
it('should apply wrapperAttr configuration to popup', async () => {
1473+
const { scheduler, POM } = await createScheduler({
1474+
...getDefaultConfig(),
1475+
editing: {
1476+
allowAdding: true,
1477+
allowUpdating: true,
1478+
popup: {
1479+
wrapperAttr: {
1480+
id: 'test',
1481+
},
1482+
},
1483+
},
1484+
});
1485+
1486+
scheduler.showAppointmentPopup(commonAppointment);
1487+
1488+
const wrapperAttr = POM.popup.component.option('wrapperAttr');
1489+
expect(wrapperAttr.id).toBe('test');
1490+
expect(wrapperAttr.class).toBeDefined();
1491+
});
1492+
1493+
it('should call onShowing callback when popup is shown', async () => {
1494+
const onShowing = jest.fn();
1495+
const { scheduler, POM } = await createScheduler({
1496+
...getDefaultConfig(),
1497+
editing: {
1498+
allowAdding: true,
1499+
allowUpdating: true,
1500+
popup: {
1501+
onShowing,
1502+
},
1503+
},
1504+
});
1505+
1506+
scheduler.showAppointmentPopup(commonAppointment);
1507+
1508+
expect(POM.popup.component.option('visible')).toBe(true);
1509+
expect(onShowing).toHaveBeenCalled();
1510+
expect(onShowing).toHaveBeenCalledTimes(1);
1511+
});
1512+
1513+
it('should call onHiding callback when popup is hidden', async () => {
1514+
const onHiding = jest.fn();
1515+
const { scheduler, POM } = await createScheduler({
1516+
...getDefaultConfig(),
1517+
editing: {
1518+
allowAdding: true,
1519+
allowUpdating: true,
1520+
popup: {
1521+
onHiding,
1522+
},
1523+
},
1524+
});
1525+
1526+
scheduler.showAppointmentPopup(commonAppointment);
1527+
1528+
expect(POM.popup.component.option('visible')).toBe(true);
1529+
expect(onHiding).not.toHaveBeenCalled();
1530+
1531+
POM.popup.getCancelButton().click();
1532+
1533+
expect(POM.popup.component.option('visible')).toBe(false);
1534+
expect(onHiding).toHaveBeenCalled();
1535+
expect(onHiding).toHaveBeenCalledTimes(1);
1536+
});
14711537
});
14721538
});
14731539

0 commit comments

Comments
 (0)