|
| 1 | +import Scheduler from 'devextreme-testcafe-models/scheduler'; |
| 2 | +import { ClientFunction, Selector } from 'testcafe'; |
| 3 | +import url from '../../../../helpers/getPageUrl'; |
| 4 | +import { createWidget } from '../../../../helpers/createWidget'; |
| 5 | +import { appendElementTo } from '../../../../helpers/domUtils'; |
| 6 | + |
| 7 | +fixture.disablePageReloads`KeyboardNavigation.DateTable` |
| 8 | + .page(url(__dirname, '../../../container.html')); |
| 9 | + |
| 10 | +const PARENT_SELECTOR = '#parentContainer'; |
| 11 | +const SCHEDULER_SELECTOR = '#container'; |
| 12 | +const BOTTOM_BTN_ID = 'bottom-btn'; |
| 13 | +const BOTTOM_BTN_SELECTOR = `#${BOTTOM_BTN_ID}`; |
| 14 | + |
| 15 | +const setMacOsScrollableOptions = ClientFunction(() => { |
| 16 | + ($(SCHEDULER_SELECTOR) as any) |
| 17 | + .dxScheduler('instance') |
| 18 | + .getWorkSpaceScrollable() |
| 19 | + .option('useNative', true); |
| 20 | +}, { dependencies: { SCHEDULER_SELECTOR } }); |
| 21 | + |
| 22 | +[ |
| 23 | + 'day', |
| 24 | + 'week', |
| 25 | +].forEach((currentView) => { |
| 26 | + test(`Should pass focus to the next elements after date table on Mac devices (view: ${currentView})`, async (t) => { |
| 27 | + const bottomBtn = Selector(BOTTOM_BTN_SELECTOR); |
| 28 | + const scheduler = new Scheduler(SCHEDULER_SELECTOR); |
| 29 | + const usualAppointment = scheduler.getAppointment('Usual'); |
| 30 | + |
| 31 | + await t |
| 32 | + .click(usualAppointment.element) |
| 33 | + .pressKey('tab tab'); |
| 34 | + |
| 35 | + await t.expect(bottomBtn.focused).ok(); |
| 36 | + }).before(async () => { |
| 37 | + await appendElementTo(PARENT_SELECTOR, 'button', BOTTOM_BTN_ID); |
| 38 | + await createWidget('dxScheduler', { |
| 39 | + dataSource: [ |
| 40 | + { |
| 41 | + startDate: '2024-01-01T01:00:00', |
| 42 | + endDate: '2024-01-01T02:00:00', |
| 43 | + text: 'Usual', |
| 44 | + }, |
| 45 | + // NOTE: This case is reproduced only if view has allDay appointment |
| 46 | + { |
| 47 | + startDate: '2024-01-01T01:00:00', |
| 48 | + endDate: '2024-01-01T02:00:00', |
| 49 | + text: 'All-day', |
| 50 | + allDay: true, |
| 51 | + }, |
| 52 | + ], |
| 53 | + // NOTE: Scheduler should have a height limit for enabling native scroll container |
| 54 | + height: 300, |
| 55 | + currentDate: '2024-01-01', |
| 56 | + currentView, |
| 57 | + }); |
| 58 | + await setMacOsScrollableOptions(); |
| 59 | + }); |
| 60 | +}); |
0 commit comments