import { type Page, type Locator, expect } from '@playwright/test'; import { awaitBundle, awaitFixtureBuilt } from '../bundle'; // Deliberately not `extends Window`: `windowTypes.ts` already declares `hot` globally with the full // instance type, which has no `TEXTAREA`, and narrowing it here would be a TS2430 conflict. Every // access goes through this local view, cast once. interface FixtureWindow { hot: { selectCell(row: number, col: number): boolean; getActiveEditor(): { TEXTAREA?: HTMLElement; isOpened(): boolean } | undefined; }; } /** * Page object for the `imeFastEdit` fixture (`demo/intl-date-editor-ime-fast-edit.html`): a 2 x 3 grid * with an `intl-date` first column (the third, `intl-time`, is for the a11y scan), built with * `imeFastEdit: true`. * * With `imeFastEdit` the focus manager does not leave the browser focus on the selected cell. Once the * selection ends, a debounced `select()` (1 ms, `FocusGridManager#refocusDelay`) moves it to the active * editor's input, so an IME composition can start without the editor being opened first. The move is * asynchronous, so a spec waits for it with a web-first `toBeFocused()` on `editorInput` and never * reads the active element straight after selecting. */ export class IntlDateEditorImeFastEditPage { /** The Playwright page the fixture is driven through. */ readonly page: Page; /** The active theme, passed through to the fixture URL. */ readonly theme: string; /** The active bundle, passed through to the fixture URL. */ readonly bundle: string; /** The `intl-date` editor's native date input (the editor's `TEXTAREA`). */ readonly editorInput: Locator; /** * Wires up the page object for one theme/bundle leg. */ constructor(page: Page, theme = 'main', bundle = 'umd') { this.page = page; this.theme = theme; this.bundle = bundle; // The fixture's only date column is column 0, so the grid builds one `` // (the text column's editor is a `