@cdevhub/ngx-tw 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cdevhub-ngx-tw-command-palette-testing.mjs +7 -7
- package/fesm2022/cdevhub-ngx-tw-command-palette-testing.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-popover-testing.mjs +122 -0
- package/fesm2022/cdevhub-ngx-tw-popover-testing.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tooltip-testing.mjs +103 -0
- package/fesm2022/cdevhub-ngx-tw-tooltip-testing.mjs.map +1 -0
- package/index.json +1 -1
- package/package.json +9 -1
- package/types/cdevhub-ngx-tw-command-palette-testing.d.ts +7 -7
- package/types/cdevhub-ngx-tw-popover-testing.d.ts +89 -0
- package/types/cdevhub-ngx-tw-tooltip-testing.d.ts +83 -0
|
@@ -100,8 +100,8 @@ class CommandPaletteHarness extends ComponentHarness {
|
|
|
100
100
|
*
|
|
101
101
|
* **The overlay is still attached when this resolves.** The component defers
|
|
102
102
|
* the detach behind a leave animation, so a caller asserting on `isOpen()`
|
|
103
|
-
* immediately afterwards will still see `true`. Wait for the
|
|
104
|
-
* asserting —
|
|
103
|
+
* immediately afterwards will still see `true`. Wait for the detach before
|
|
104
|
+
* asserting — by reading the document, never by polling a harness method.
|
|
105
105
|
*
|
|
106
106
|
* That caveat is deliberate rather than hidden behind a poll. An earlier
|
|
107
107
|
* version looped on `isOpen()` until the panel detached, which reads better
|
|
@@ -112,11 +112,11 @@ class CommandPaletteHarness extends ComponentHarness {
|
|
|
112
112
|
* failing it. A harness that can hang is worse than one that makes the caller
|
|
113
113
|
* wait explicitly.
|
|
114
114
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
115
|
+
* Wait by polling the document for the panel to leave, under your own
|
|
116
|
+
* deadline — `document.querySelector('tw-command-palette-overlay') === null`
|
|
117
|
+
* needs no stabilization, so it can neither hang nor burn a fixed sleep. The
|
|
118
|
+
* `closes with Escape` case in `command-palette-harness.spec.ts` is the
|
|
119
|
+
* worked example, and is this method's coverage.
|
|
120
120
|
*/
|
|
121
121
|
async close() {
|
|
122
122
|
const input = await this.input();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdevhub-ngx-tw-command-palette-testing.mjs","sources":["../../../projects/ngx-tw/command-palette/testing/command-palette-item-harness.ts","../../../projects/ngx-tw/command-palette/testing/command-palette-harness.ts","../../../projects/ngx-tw/command-palette/testing/cdevhub-ngx-tw-command-palette-testing.ts"],"sourcesContent":["import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\n\n/** Filters accepted by `CommandPaletteItemHarness.with`. */\nexport interface CommandPaletteItemHarnessFilters extends BaseHarnessFilters {\n /** Match by the item's visible text, which includes its description when it has one. */\n text?: string | RegExp;\n /** Match the active (`aria-activedescendant`) item. */\n active?: boolean;\n /** Match disabled / enabled items. */\n disabled?: boolean;\n}\n\n/**\n * Harness for a single result row in an open `tw-command-palette`.\n *\n * These rows are `role=\"option\"` inside an activedescendant listbox: they never\n * receive DOM focus and have no keyboard handlers of their own. \"Active\" here\n * therefore means *referenced by the input's `aria-activedescendant`*, which the\n * component mirrors onto each row as `aria-selected`. It does **not** mean\n * `document.activeElement`.\n */\nexport class CommandPaletteItemHarness extends ComponentHarness {\n static hostSelector = '[role=\"option\"]';\n\n /** Predicate for `locatorFor` / `locatorForAll`. */\n static with(\n options: CommandPaletteItemHarnessFilters = {},\n ): HarnessPredicate<CommandPaletteItemHarness> {\n return new HarnessPredicate(CommandPaletteItemHarness, options)\n .addOption('text', options.text, async (harness, text) =>\n HarnessPredicate.stringMatches(await harness.getText(), text),\n )\n .addOption(\n 'active',\n options.active,\n async (harness, active) => (await harness.isActive()) === active,\n )\n .addOption(\n 'disabled',\n options.disabled,\n async (harness, disabled) => (await harness.isDisabled()) === disabled,\n );\n }\n\n /** The row's rendered text, trimmed. Includes the description when one is rendered. */\n async getText(): Promise<string> {\n return (await (await this.host()).text()).trim();\n }\n\n /** The row's DOM id, which is what `aria-activedescendant` points at. */\n async getId(): Promise<string | null> {\n return (await this.host()).getAttribute('id');\n }\n\n /**\n * Whether this row is the active descendant. Read from `aria-selected`, which\n * the component binds to the active id — not from DOM focus, which never moves\n * off the search input.\n */\n async isActive(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-selected')) === 'true';\n }\n\n /** Whether the row reports `aria-disabled=\"true\"`. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Clicks the row, activating the command. */\n async click(): Promise<void> {\n await (await this.host()).click();\n }\n}\n","import { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\nimport {\n CommandPaletteItemHarness,\n type CommandPaletteItemHarnessFilters,\n} from './command-palette-item-harness';\n\n/** Filters accepted by `CommandPaletteHarness.with`. */\nexport interface CommandPaletteHarnessFilters extends BaseHarnessFilters {\n /** Match by the palette's accessible label. */\n label?: string | RegExp;\n}\n\n/**\n * Harness for `tw-command-palette`.\n *\n * The palette renders into the CDK overlay container, outside the\n * `tw-command-palette` host, so this harness resolves the panel through\n * `documentRootLocatorFactory()`. A consumer loads it from the ordinary fixture\n * loader and still reaches the results.\n *\n * The palette is an **activedescendant listbox**: DOM focus stays on the search\n * input and the active row is identified only by `aria-activedescendant`. Every\n * \"active\" method here resolves that id reference — none of them consults\n * `document.activeElement`, which would always report the input.\n */\nexport class CommandPaletteHarness extends ComponentHarness {\n static hostSelector = 'tw-command-palette';\n\n private readonly panel =\n this.documentRootLocatorFactory().locatorForOptional('[role=\"dialog\"]');\n private readonly input =\n this.documentRootLocatorFactory().locatorForOptional('input[role=\"combobox\"]');\n\n /** Predicate for `locatorFor` / `locatorForAll`. */\n static with(\n options: CommandPaletteHarnessFilters = {},\n ): HarnessPredicate<CommandPaletteHarness> {\n return new HarnessPredicate(CommandPaletteHarness, options).addOption(\n 'label',\n options.label,\n async (harness, label) =>\n HarnessPredicate.stringMatches(await harness.getLabel(), label),\n );\n }\n\n /** Whether the palette overlay is currently attached. */\n async isOpen(): Promise<boolean> {\n return (await this.panel()) !== null;\n }\n\n /** The palette's accessible label, or `null` when it is closed. */\n async getLabel(): Promise<string | null> {\n const panel = await this.panel();\n return panel ? panel.getAttribute('aria-label') : null;\n }\n\n /** The current search query. Returns an empty string when the palette is closed. */\n async getQuery(): Promise<string> {\n const input = await this.input();\n return input ? input.getProperty<string>('value') : '';\n }\n\n /**\n * Types into the search input, replacing any existing query, then waits for\n * the results to settle.\n */\n async setQuery(query: string): Promise<void> {\n const input = await this.requireInput('setQuery');\n await input.clear();\n await input.sendKeys(query);\n await this.waitForTasksOutsideAngular();\n }\n\n /** Clears the search query. */\n async clearQuery(): Promise<void> {\n const input = await this.requireInput('clearQuery');\n await input.clear();\n await this.waitForTasksOutsideAngular();\n }\n\n /**\n * Sends Escape to the search input. No-op when the palette is already closed.\n *\n * **The overlay is still attached when this resolves.** The component defers\n * the detach behind a leave animation, so a caller asserting on `isOpen()`\n * immediately afterwards will still see `true`. Wait for the animation before\n * asserting — with a plain timer, not by polling a harness method.\n *\n * That caveat is deliberate rather than hidden behind a poll. An earlier\n * version looped on `isOpen()` until the panel detached, which reads better\n * but is unsound here: every harness call routes through\n * `fixture.whenStable()`, and under zoneless that can wait on a re-scheduled\n * timer and never resolve. A deadline checked *between* awaits cannot bound a\n * single await that never returns, so the loop hung the suite instead of\n * failing it. A harness that can hang is worse than one that makes the caller\n * wait explicitly.\n *\n * **This method is not covered by a spec.** A test driving it hung at the full\n * 15000ms budget in roughly one run in three: the harness calls it makes\n * around a leave animation route through `whenStable()`, which can wait on a\n * re-scheduled timer and never resolve. Escape dismissal itself is covered in\n * `command-palette.spec.ts`, directly against the component.\n */\n async close(): Promise<void> {\n const input = await this.input();\n if (!input) return;\n await input.sendKeys(TestKey.ESCAPE);\n }\n\n /** Moves the active descendant down one row. */\n async pressArrowDown(): Promise<void> {\n await (await this.requireInput('pressArrowDown')).sendKeys(TestKey.DOWN_ARROW);\n await this.waitForTasksOutsideAngular();\n }\n\n /** Moves the active descendant up one row. */\n async pressArrowUp(): Promise<void> {\n await (await this.requireInput('pressArrowUp')).sendKeys(TestKey.UP_ARROW);\n await this.waitForTasksOutsideAngular();\n }\n\n /** Activates the current active descendant with Enter. */\n async pressEnter(): Promise<void> {\n await (await this.requireInput('pressEnter')).sendKeys(TestKey.ENTER);\n await this.waitForTasksOutsideAngular();\n }\n\n /**\n * Every result row currently rendered. Returns an empty array when the palette\n * is closed.\n */\n async getItems(\n filters: CommandPaletteItemHarnessFilters = {},\n ): Promise<CommandPaletteItemHarness[]> {\n if (!(await this.panel())) return [];\n return this.documentRootLocatorFactory().locatorForAll(\n CommandPaletteItemHarness.with(filters),\n )();\n }\n\n /**\n * The labels of the rendered group headings, in DOM order. Ungrouped results\n * produce an empty array.\n */\n async getGroupLabels(): Promise<string[]> {\n if (!(await this.panel())) return [];\n const groups = await this.documentRootLocatorFactory().locatorForAll(\n '[role=\"group\"]',\n )();\n const labels = await Promise.all(\n groups.map((group) => group.getAttribute('aria-label')),\n );\n return labels.filter((label): label is string => label !== null);\n }\n\n /**\n * The text of the active row, resolved through the input's\n * `aria-activedescendant`, or `null` when nothing is active.\n */\n async getActiveItemText(): Promise<string | null> {\n const active = await this.getItems({ active: true });\n return active.length > 0 ? active[0].getText() : null;\n }\n\n /**\n * Clicks the first row whose text matches. Throws when nothing matches, rather\n * than failing silently.\n */\n async selectItem(text: string | RegExp): Promise<void> {\n const matches = await this.getItems({ text });\n if (matches.length === 0) {\n throw new Error(\n `CommandPaletteHarness.selectItem: no result matching ${String(text)}.`,\n );\n }\n await matches[0].click();\n await this.waitForTasksOutsideAngular();\n }\n\n /**\n * The search input, or a named error when the palette is closed. Every typing\n * and key method needs it, and \"cannot read property of null\" would not say why.\n */\n private async requireInput(method: string) {\n const input = await this.input();\n if (!input) {\n throw new Error(\n `CommandPaletteHarness.${method}: the palette is closed, so it has no search input.`,\n );\n }\n return input;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAaA;;;;;;;;AAQG;AACG,MAAO,yBAA0B,SAAQ,gBAAgB,CAAA;AAC7D,IAAA,OAAO,YAAY,GAAG,iBAAiB;;AAGvC,IAAA,OAAO,IAAI,CACT,OAAA,GAA4C,EAAE,EAAA;AAE9C,QAAA,OAAO,IAAI,gBAAgB,CAAC,yBAAyB,EAAE,OAAO;aAC3D,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,KACnD,gBAAgB,CAAC,aAAa,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC;aAE9D,SAAS,CACR,QAAQ,EACR,OAAO,CAAC,MAAM,EACd,OAAO,OAAO,EAAE,MAAM,KAAK,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,MAAM,MAAM;aAEjE,SAAS,CACR,UAAU,EACV,OAAO,CAAC,QAAQ,EAChB,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC,MAAM,OAAO,CAAC,UAAU,EAAE,MAAM,QAAQ,CACvE;IACL;;AAGA,IAAA,MAAM,OAAO,GAAA;AACX,QAAA,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE;IAClD;;AAGA,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC;IAC/C;AAEA;;;;AAIG;AACH,IAAA,MAAM,QAAQ,GAAA;AACZ,QAAA,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY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,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CACb,CAAA,qDAAA,EAAwD,MAAM,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG,CACxE;QACH;AACA,QAAA,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;AACxB,QAAA,MAAM,IAAI,CAAC,0BAA0B,EAAE;IACzC;AAEA;;;AAGG;IACK,MAAM,YAAY,CAAC,MAAc,EAAA;AACvC,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE;QAChC,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,CAAA,mDAAA,CAAqD,CACrF;QACH;AACA,QAAA,OAAO,KAAK;IACd;;;AChMF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cdevhub-ngx-tw-command-palette-testing.mjs","sources":["../../../projects/ngx-tw/command-palette/testing/command-palette-item-harness.ts","../../../projects/ngx-tw/command-palette/testing/command-palette-harness.ts","../../../projects/ngx-tw/command-palette/testing/cdevhub-ngx-tw-command-palette-testing.ts"],"sourcesContent":["import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\n\n/** Filters accepted by `CommandPaletteItemHarness.with`. */\nexport interface CommandPaletteItemHarnessFilters extends BaseHarnessFilters {\n /** Match by the item's visible text, which includes its description when it has one. */\n text?: string | RegExp;\n /** Match the active (`aria-activedescendant`) item. */\n active?: boolean;\n /** Match disabled / enabled items. */\n disabled?: boolean;\n}\n\n/**\n * Harness for a single result row in an open `tw-command-palette`.\n *\n * These rows are `role=\"option\"` inside an activedescendant listbox: they never\n * receive DOM focus and have no keyboard handlers of their own. \"Active\" here\n * therefore means *referenced by the input's `aria-activedescendant`*, which the\n * component mirrors onto each row as `aria-selected`. It does **not** mean\n * `document.activeElement`.\n */\nexport class CommandPaletteItemHarness extends ComponentHarness {\n static hostSelector = '[role=\"option\"]';\n\n /** Predicate for `locatorFor` / `locatorForAll`. */\n static with(\n options: CommandPaletteItemHarnessFilters = {},\n ): HarnessPredicate<CommandPaletteItemHarness> {\n return new HarnessPredicate(CommandPaletteItemHarness, options)\n .addOption('text', options.text, async (harness, text) =>\n HarnessPredicate.stringMatches(await harness.getText(), text),\n )\n .addOption(\n 'active',\n options.active,\n async (harness, active) => (await harness.isActive()) === active,\n )\n .addOption(\n 'disabled',\n options.disabled,\n async (harness, disabled) => (await harness.isDisabled()) === disabled,\n );\n }\n\n /** The row's rendered text, trimmed. Includes the description when one is rendered. */\n async getText(): Promise<string> {\n return (await (await this.host()).text()).trim();\n }\n\n /** The row's DOM id, which is what `aria-activedescendant` points at. */\n async getId(): Promise<string | null> {\n return (await this.host()).getAttribute('id');\n }\n\n /**\n * Whether this row is the active descendant. Read from `aria-selected`, which\n * the component binds to the active id — not from DOM focus, which never moves\n * off the search input.\n */\n async isActive(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-selected')) === 'true';\n }\n\n /** Whether the row reports `aria-disabled=\"true\"`. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Clicks the row, activating the command. */\n async click(): Promise<void> {\n await (await this.host()).click();\n }\n}\n","import { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\nimport type { BaseHarnessFilters } from '@angular/cdk/testing';\nimport {\n CommandPaletteItemHarness,\n type CommandPaletteItemHarnessFilters,\n} from './command-palette-item-harness';\n\n/** Filters accepted by `CommandPaletteHarness.with`. */\nexport interface CommandPaletteHarnessFilters extends BaseHarnessFilters {\n /** Match by the palette's accessible label. */\n label?: string | RegExp;\n}\n\n/**\n * Harness for `tw-command-palette`.\n *\n * The palette renders into the CDK overlay container, outside the\n * `tw-command-palette` host, so this harness resolves the panel through\n * `documentRootLocatorFactory()`. A consumer loads it from the ordinary fixture\n * loader and still reaches the results.\n *\n * The palette is an **activedescendant listbox**: DOM focus stays on the search\n * input and the active row is identified only by `aria-activedescendant`. Every\n * \"active\" method here resolves that id reference — none of them consults\n * `document.activeElement`, which would always report the input.\n */\nexport class CommandPaletteHarness extends ComponentHarness {\n static hostSelector = 'tw-command-palette';\n\n private readonly panel =\n this.documentRootLocatorFactory().locatorForOptional('[role=\"dialog\"]');\n private readonly input =\n this.documentRootLocatorFactory().locatorForOptional('input[role=\"combobox\"]');\n\n /** Predicate for `locatorFor` / `locatorForAll`. */\n static with(\n options: CommandPaletteHarnessFilters = {},\n ): HarnessPredicate<CommandPaletteHarness> {\n return new HarnessPredicate(CommandPaletteHarness, options).addOption(\n 'label',\n options.label,\n async (harness, label) =>\n HarnessPredicate.stringMatches(await harness.getLabel(), label),\n );\n }\n\n /** Whether the palette overlay is currently attached. */\n async isOpen(): Promise<boolean> {\n return (await this.panel()) !== null;\n }\n\n /** The palette's accessible label, or `null` when it is closed. */\n async getLabel(): Promise<string | null> {\n const panel = await this.panel();\n return panel ? panel.getAttribute('aria-label') : null;\n }\n\n /** The current search query. Returns an empty string when the palette is closed. */\n async getQuery(): Promise<string> {\n const input = await this.input();\n return input ? input.getProperty<string>('value') : '';\n }\n\n /**\n * Types into the search input, replacing any existing query, then waits for\n * the results to settle.\n */\n async setQuery(query: string): Promise<void> {\n const input = await this.requireInput('setQuery');\n await input.clear();\n await input.sendKeys(query);\n await this.waitForTasksOutsideAngular();\n }\n\n /** Clears the search query. */\n async clearQuery(): Promise<void> {\n const input = await this.requireInput('clearQuery');\n await input.clear();\n await this.waitForTasksOutsideAngular();\n }\n\n /**\n * Sends Escape to the search input. No-op when the palette is already closed.\n *\n * **The overlay is still attached when this resolves.** The component defers\n * the detach behind a leave animation, so a caller asserting on `isOpen()`\n * immediately afterwards will still see `true`. Wait for the detach before\n * asserting — by reading the document, never by polling a harness method.\n *\n * That caveat is deliberate rather than hidden behind a poll. An earlier\n * version looped on `isOpen()` until the panel detached, which reads better\n * but is unsound here: every harness call routes through\n * `fixture.whenStable()`, and under zoneless that can wait on a re-scheduled\n * timer and never resolve. A deadline checked *between* awaits cannot bound a\n * single await that never returns, so the loop hung the suite instead of\n * failing it. A harness that can hang is worse than one that makes the caller\n * wait explicitly.\n *\n * Wait by polling the document for the panel to leave, under your own\n * deadline — `document.querySelector('tw-command-palette-overlay') === null`\n * needs no stabilization, so it can neither hang nor burn a fixed sleep. The\n * `closes with Escape` case in `command-palette-harness.spec.ts` is the\n * worked example, and is this method's coverage.\n */\n async close(): Promise<void> {\n const input = await this.input();\n if (!input) return;\n await input.sendKeys(TestKey.ESCAPE);\n }\n\n /** Moves the active descendant down one row. */\n async pressArrowDown(): Promise<void> {\n await (await this.requireInput('pressArrowDown')).sendKeys(TestKey.DOWN_ARROW);\n await this.waitForTasksOutsideAngular();\n }\n\n /** Moves the active descendant up one row. */\n async pressArrowUp(): Promise<void> {\n await (await this.requireInput('pressArrowUp')).sendKeys(TestKey.UP_ARROW);\n await this.waitForTasksOutsideAngular();\n }\n\n /** Activates the current active descendant with Enter. */\n async pressEnter(): Promise<void> {\n await (await this.requireInput('pressEnter')).sendKeys(TestKey.ENTER);\n await this.waitForTasksOutsideAngular();\n }\n\n /**\n * Every result row currently rendered. Returns an empty array when the palette\n * is closed.\n */\n async getItems(\n filters: CommandPaletteItemHarnessFilters = {},\n ): Promise<CommandPaletteItemHarness[]> {\n if (!(await this.panel())) return [];\n return this.documentRootLocatorFactory().locatorForAll(\n CommandPaletteItemHarness.with(filters),\n )();\n }\n\n /**\n * The labels of the rendered group headings, in DOM order. Ungrouped results\n * produce an empty array.\n */\n async getGroupLabels(): Promise<string[]> {\n if (!(await this.panel())) return [];\n const groups = await this.documentRootLocatorFactory().locatorForAll(\n '[role=\"group\"]',\n )();\n const labels = await Promise.all(\n groups.map((group) => group.getAttribute('aria-label')),\n );\n return labels.filter((label): label is string => label !== null);\n }\n\n /**\n * The text of the active row, resolved through the input's\n * `aria-activedescendant`, or `null` when nothing is active.\n */\n async getActiveItemText(): Promise<string | null> {\n const active = await this.getItems({ active: true });\n return active.length > 0 ? active[0].getText() : null;\n }\n\n /**\n * Clicks the first row whose text matches. Throws when nothing matches, rather\n * than failing silently.\n */\n async selectItem(text: string | RegExp): Promise<void> {\n const matches = await this.getItems({ text });\n if (matches.length === 0) {\n throw new Error(\n `CommandPaletteHarness.selectItem: no result matching ${String(text)}.`,\n );\n }\n await matches[0].click();\n await this.waitForTasksOutsideAngular();\n }\n\n /**\n * The search input, or a named error when the palette is closed. Every typing\n * and key method needs it, and \"cannot read property of null\" would not say why.\n */\n private async requireInput(method: string) {\n const input = await this.input();\n if (!input) {\n throw new Error(\n `CommandPaletteHarness.${method}: the palette is closed, so it has no search input.`,\n );\n }\n return input;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAaA;;;;;;;;AAQG;AACG,MAAO,yBAA0B,SAAQ,gBAAgB,CAAA;AAC7D,IAAA,OAAO,YAAY,GAAG,iBAAiB;;AAGvC,IAAA,OAAO,IAAI,CACT,OAAA,GAA4C,EAAE,EAAA;AAE9C,QAAA,OAAO,IAAI,gBAAgB,CAAC,yBAAyB,EAAE,OAAO;aAC3D,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,OAAO,EAAE,IAAI,KACnD,gBAAgB,CAAC,aAAa,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC;aAE9D,SAAS,CACR,QAAQ,EACR,OAAO,CAAC,MAAM,EACd,OAAO,OAAO,EAAE,MAAM,KAAK,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,MAAM,MAAM;aAEjE,SAAS,CACR,UAAU,EACV,OAAO,CAAC,QAAQ,EAChB,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC,MAAM,OAAO,CAAC,UAAU,EAAE,MAAM,QAAQ,CACvE;IACL;;AAGA,IAAA,MAAM,OAAO,GAAA;AACX,QAAA,OAAO,CAAC,MAAM,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AAM,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACpD,QAAA,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI;IACvD;AAEA;;;AAGG;IACH,MAAM,UAAU,CAAC,IAAqB,EAAA;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC;AAC7C,QAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CACb,CAAA,qDAAA,EAAwD,MAAM,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG,CACxE;QACH;AACA,QAAA,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;AACxB,QAAA,MAAM,IAAI,CAAC,0BAA0B,EAAE;IACzC;AAEA;;;AAGG;IACK,MAAM,YAAY,CAAC,MAAc,EAAA;AACvC,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE;QAChC,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,CAAA,mDAAA,CAAqD,CACrF;QACH;AACA,QAAA,OAAO,KAAK;IACd;;;AChMF;;AAEG;;;;"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Harness for a `[twPopover]` trigger and the panel it opens.
|
|
5
|
+
*
|
|
6
|
+
* ## Loading it
|
|
7
|
+
*
|
|
8
|
+
* The host is the trigger, which lives in the fixture, so the ordinary
|
|
9
|
+
* `TestbedHarnessEnvironment.loader(fixture)` is correct. The panel renders into
|
|
10
|
+
* the CDK overlay container outside the fixture, and this harness resolves it
|
|
11
|
+
* internally via `documentRootLocatorFactory()` — a consumer never needs
|
|
12
|
+
* `documentRootLoader`.
|
|
13
|
+
*
|
|
14
|
+
* The host selector is the directive's static `data-tw-popover-trigger` marker.
|
|
15
|
+
* `[twPopover]` cannot be used: it takes a required `TemplateRef` or component
|
|
16
|
+
* type, so it is always property-bound and Angular renders no attribute for a
|
|
17
|
+
* bound input. The marker also makes the match exact, so no disambiguation
|
|
18
|
+
* against `aria-haspopup="dialog"` — which the two date-picker triggers also
|
|
19
|
+
* carry — is needed.
|
|
20
|
+
*
|
|
21
|
+
* ## Waiting for the panel
|
|
22
|
+
*
|
|
23
|
+
* Every method stabilizes the fixture the way CDK harnesses always do, which
|
|
24
|
+
* covers change detection but **not** the component's own timers: `popover.ts`
|
|
25
|
+
* detaches the panel behind a hard-coded 120 ms leave window driven by a plain
|
|
26
|
+
* `setTimeout`, which Angular's `PendingTasks` does not track, so
|
|
27
|
+
* `whenStable()` does not wait for it. {@link close} therefore dispatches
|
|
28
|
+
* Escape and returns while the panel is still attached. Poll the DOM for its
|
|
29
|
+
* removal — `document.querySelector('tw-popover-overlay')` — and only then read
|
|
30
|
+
* through the harness.
|
|
31
|
+
*
|
|
32
|
+
* ## The panel is detached, not disposed
|
|
33
|
+
*
|
|
34
|
+
* Unlike `tw-select`, closing a popover **detaches** the portal and keeps the
|
|
35
|
+
* `OverlayRef` for reuse; it is only rebuilt when `twPopoverBackdrop` or
|
|
36
|
+
* `twPopoverScrollStrategy` changes. The panel element is therefore absent while
|
|
37
|
+
* closed and present again after a reopen, on the same overlay.
|
|
38
|
+
*/
|
|
39
|
+
class PopoverHarness extends ComponentHarness {
|
|
40
|
+
static hostSelector = '[data-tw-popover-trigger]';
|
|
41
|
+
/** Predicate for `locatorFor` / `locatorForAll`. */
|
|
42
|
+
static with(options = {}) {
|
|
43
|
+
return new HarnessPredicate(PopoverHarness, options).addOption('triggerText', options.triggerText, async (h, text) => HarnessPredicate.stringMatches(await h.getTriggerText(), text));
|
|
44
|
+
}
|
|
45
|
+
/** The text currently rendered in the trigger, trimmed. */
|
|
46
|
+
async getTriggerText() {
|
|
47
|
+
return (await (await this.host()).text()).trim();
|
|
48
|
+
}
|
|
49
|
+
/** Whether the popover is open, read from the trigger's `aria-expanded`. */
|
|
50
|
+
async isOpen() {
|
|
51
|
+
return (await (await this.host()).getAttribute('aria-expanded')) === 'true';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Opens the popover by clicking the trigger. No-op when already open.
|
|
55
|
+
*
|
|
56
|
+
* This is the gesture for the default `twPopoverTriggerOn="click"`. A
|
|
57
|
+
* `'focus'`- or `'manual'`-triggered popover is opened through the directive's
|
|
58
|
+
* own `open()` (reachable via `exportAs: 'twPopover'`), not through a click.
|
|
59
|
+
*/
|
|
60
|
+
async open() {
|
|
61
|
+
const host = await this.host();
|
|
62
|
+
if ((await host.getAttribute('aria-expanded')) === 'true')
|
|
63
|
+
return;
|
|
64
|
+
await host.click();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Closes the popover by sending Escape to the trigger — the one dismissal
|
|
68
|
+
* that works for click, focus and manual triggers alike. No-op when already
|
|
69
|
+
* closed, and deliberately inert when `twPopoverCloseOnEscape` is `false`.
|
|
70
|
+
*
|
|
71
|
+
* Returns as soon as the key is dispatched. The panel detaches only after the
|
|
72
|
+
* 120 ms leave window; poll the DOM for its removal before asserting.
|
|
73
|
+
*/
|
|
74
|
+
async close() {
|
|
75
|
+
const host = await this.host();
|
|
76
|
+
if ((await host.getAttribute('aria-expanded')) !== 'true')
|
|
77
|
+
return;
|
|
78
|
+
await host.sendKeys(TestKey.ESCAPE);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Text rendered inside the panel, trimmed, or `null` when the popover is
|
|
82
|
+
* closed and the panel is detached.
|
|
83
|
+
*/
|
|
84
|
+
async getText() {
|
|
85
|
+
const panel = await this.getPanel();
|
|
86
|
+
return panel ? (await panel.text()).trim() : null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Whether the panel renders its directional arrow (`twPopoverArrow`). `false`
|
|
90
|
+
* while the popover is closed, because the panel does not exist then.
|
|
91
|
+
*/
|
|
92
|
+
async hasArrow() {
|
|
93
|
+
const id = await this.getPanelId();
|
|
94
|
+
if (!id)
|
|
95
|
+
return false;
|
|
96
|
+
// The arrow has no dedicated attribute hook: it is the panel wrapper's only
|
|
97
|
+
// `aria-hidden` grandchild span, with the content nested one level deeper.
|
|
98
|
+
const arrow = await this.documentRootLocatorFactory().locatorForOptional(`#${id} > div > span[aria-hidden="true"]`)();
|
|
99
|
+
return arrow !== null;
|
|
100
|
+
}
|
|
101
|
+
/** The panel element, or `null` when the popover is closed. */
|
|
102
|
+
async getPanel() {
|
|
103
|
+
const id = await this.getPanelId();
|
|
104
|
+
if (!id)
|
|
105
|
+
return null;
|
|
106
|
+
return this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The id of this trigger's own panel, or `null` when closed. Scoping by
|
|
110
|
+
* `aria-controls` keeps sibling popovers apart.
|
|
111
|
+
*/
|
|
112
|
+
async getPanelId() {
|
|
113
|
+
return (await this.host()).getAttribute('aria-controls');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Generated bundle index. Do not edit.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export { PopoverHarness };
|
|
122
|
+
//# sourceMappingURL=cdevhub-ngx-tw-popover-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdevhub-ngx-tw-popover-testing.mjs","sources":["../../../projects/ngx-tw/popover/testing/popover-harness.ts","../../../projects/ngx-tw/popover/testing/cdevhub-ngx-tw-popover-testing.ts"],"sourcesContent":["import { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\nimport type { BaseHarnessFilters, TestElement } from '@angular/cdk/testing';\n\n/** Filters accepted by `PopoverHarness.with`. */\nexport interface PopoverHarnessFilters extends BaseHarnessFilters {\n /** Match by the text rendered in the trigger. */\n triggerText?: string | RegExp;\n}\n\n/**\n * Harness for a `[twPopover]` trigger and the panel it opens.\n *\n * ## Loading it\n *\n * The host is the trigger, which lives in the fixture, so the ordinary\n * `TestbedHarnessEnvironment.loader(fixture)` is correct. The panel renders into\n * the CDK overlay container outside the fixture, and this harness resolves it\n * internally via `documentRootLocatorFactory()` — a consumer never needs\n * `documentRootLoader`.\n *\n * The host selector is the directive's static `data-tw-popover-trigger` marker.\n * `[twPopover]` cannot be used: it takes a required `TemplateRef` or component\n * type, so it is always property-bound and Angular renders no attribute for a\n * bound input. The marker also makes the match exact, so no disambiguation\n * against `aria-haspopup=\"dialog\"` — which the two date-picker triggers also\n * carry — is needed.\n *\n * ## Waiting for the panel\n *\n * Every method stabilizes the fixture the way CDK harnesses always do, which\n * covers change detection but **not** the component's own timers: `popover.ts`\n * detaches the panel behind a hard-coded 120 ms leave window driven by a plain\n * `setTimeout`, which Angular's `PendingTasks` does not track, so\n * `whenStable()` does not wait for it. {@link close} therefore dispatches\n * Escape and returns while the panel is still attached. Poll the DOM for its\n * removal — `document.querySelector('tw-popover-overlay')` — and only then read\n * through the harness.\n *\n * ## The panel is detached, not disposed\n *\n * Unlike `tw-select`, closing a popover **detaches** the portal and keeps the\n * `OverlayRef` for reuse; it is only rebuilt when `twPopoverBackdrop` or\n * `twPopoverScrollStrategy` changes. The panel element is therefore absent while\n * closed and present again after a reopen, on the same overlay.\n */\nexport class PopoverHarness extends ComponentHarness {\n static hostSelector = '[data-tw-popover-trigger]';\n\n /** Predicate for `locatorFor` / `locatorForAll`. */\n static with(options: PopoverHarnessFilters = {}): HarnessPredicate<PopoverHarness> {\n return new HarnessPredicate(PopoverHarness, options).addOption(\n 'triggerText',\n options.triggerText,\n async (h, text) => HarnessPredicate.stringMatches(await h.getTriggerText(), text),\n );\n }\n\n /** The text currently rendered in the trigger, trimmed. */\n async getTriggerText(): Promise<string> {\n return (await (await this.host()).text()).trim();\n }\n\n /** Whether the popover is open, read from the trigger's `aria-expanded`. */\n async isOpen(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-expanded')) === 'true';\n }\n\n /**\n * Opens the popover by clicking the trigger. No-op when already open.\n *\n * This is the gesture for the default `twPopoverTriggerOn=\"click\"`. A\n * `'focus'`- or `'manual'`-triggered popover is opened through the directive's\n * own `open()` (reachable via `exportAs: 'twPopover'`), not through a click.\n */\n async open(): Promise<void> {\n const host = await this.host();\n if ((await host.getAttribute('aria-expanded')) === 'true') return;\n await host.click();\n }\n\n /**\n * Closes the popover by sending Escape to the trigger — the one dismissal\n * that works for click, focus and manual triggers alike. No-op when already\n * closed, and deliberately inert when `twPopoverCloseOnEscape` is `false`.\n *\n * Returns as soon as the key is dispatched. The panel detaches only after the\n * 120 ms leave window; poll the DOM for its removal before asserting.\n */\n async close(): Promise<void> {\n const host = await this.host();\n if ((await host.getAttribute('aria-expanded')) !== 'true') return;\n await host.sendKeys(TestKey.ESCAPE);\n }\n\n /**\n * Text rendered inside the panel, trimmed, or `null` when the popover is\n * closed and the panel is detached.\n */\n async getText(): Promise<string | null> {\n const panel = await this.getPanel();\n return panel ? (await panel.text()).trim() : null;\n }\n\n /**\n * Whether the panel renders its directional arrow (`twPopoverArrow`). `false`\n * while the popover is closed, because the panel does not exist then.\n */\n async hasArrow(): Promise<boolean> {\n const id = await this.getPanelId();\n if (!id) return false;\n // The arrow has no dedicated attribute hook: it is the panel wrapper's only\n // `aria-hidden` grandchild span, with the content nested one level deeper.\n const arrow = await this.documentRootLocatorFactory().locatorForOptional(\n `#${id} > div > span[aria-hidden=\"true\"]`,\n )();\n return arrow !== null;\n }\n\n /** The panel element, or `null` when the popover is closed. */\n private async getPanel(): Promise<TestElement | null> {\n const id = await this.getPanelId();\n if (!id) return null;\n return this.documentRootLocatorFactory().locatorForOptional(`#${id}`)();\n }\n\n /**\n * The id of this trigger's own panel, or `null` when closed. Scoping by\n * `aria-controls` keeps sibling popovers apart.\n */\n private async getPanelId(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-controls');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;AACG,MAAO,cAAe,SAAQ,gBAAgB,CAAA;AAClD,IAAA,OAAO,YAAY,GAAG,2BAA2B;;AAGjD,IAAA,OAAO,IAAI,CAAC,OAAA,GAAiC,EAAE,EAAA;AAC7C,QAAA,OAAO,IAAI,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS,CAC5D,aAAa,EACb,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,EAAE,IAAI,KAAK,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAClF;IACH;;AAGA,IAAA,MAAM,cAAc,GAAA;AAClB,QAAA,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE;IAClD;;AAGA,IAAA,MAAM,MAAM,GAAA;AACV,QAAA,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,MAAM,MAAM;IAC7E;AAEA;;;;;;AAMG;AACH,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE;QAC9B,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,MAAM,MAAM;YAAE;AAC3D,QAAA,MAAM,IAAI,CAAC,KAAK,EAAE;IACpB;AAEA;;;;;;;AAOG;AACH,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE;QAC9B,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAA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
+
* Deliberately narrow: a tooltip's whole observable surface is *whether it is
|
|
7
|
+
* showing and what it says*. Position, delays, color, size and arrow are
|
|
8
|
+
* configuration, not state, and a harness method for any of them would freeze an
|
|
9
|
+
* API that may still move — so none is offered.
|
|
10
|
+
*
|
|
11
|
+
* ## Loading it
|
|
12
|
+
*
|
|
13
|
+
* The host is the trigger, which lives in the fixture, so the ordinary
|
|
14
|
+
* `TestbedHarnessEnvironment.loader(fixture)` is correct. The panel renders into
|
|
15
|
+
* the CDK overlay container outside the fixture, and this harness resolves it
|
|
16
|
+
* internally via `documentRootLocatorFactory()` — a consumer never needs
|
|
17
|
+
* `documentRootLoader`.
|
|
18
|
+
*
|
|
19
|
+
* The host selector is the directive's static `data-tw-tooltip-trigger` marker,
|
|
20
|
+
* which matches both spellings of the input: `twTooltip="literal"` and the bound
|
|
21
|
+
* `[twTooltip]="expr()"`, for which Angular renders no attribute at all. A
|
|
22
|
+
* harness matching the directive's own selector would silently miss every bound
|
|
23
|
+
* trigger.
|
|
24
|
+
*
|
|
25
|
+
* Unlike `MenuHarness` and `PopoverHarness`, a tooltip trigger carries no
|
|
26
|
+
* `aria-controls` linking it to its panel (`aria-describedby` points at CDK
|
|
27
|
+
* `AriaDescriber`'s shared hidden message element for string content), so the
|
|
28
|
+
* panel is resolved as "the tooltip showing in the document". That is exact for
|
|
29
|
+
* the hover/focus model, where only one tooltip is visible at a time, but a test
|
|
30
|
+
* that forces two open at once cannot tell them apart.
|
|
31
|
+
*
|
|
32
|
+
* ## Waiting for the panel
|
|
33
|
+
*
|
|
34
|
+
* Every method stabilizes the fixture the way CDK harnesses always do, which
|
|
35
|
+
* covers change detection but **not** the component's own timers: show and hide
|
|
36
|
+
* are driven by plain `setTimeout`s behind `twTooltipShowDelay` (200 ms by
|
|
37
|
+
* default) and `twTooltipHideDelay` (150 ms), which Angular's `PendingTasks`
|
|
38
|
+
* does not track, so `whenStable()` does not wait for them — not even at a delay
|
|
39
|
+
* of `0`. {@link show} and {@link hide} therefore dispatch the interaction and
|
|
40
|
+
* return before anything has attached or detached. Set both delays to `0` in the
|
|
41
|
+
* fixture, poll the DOM for the panel —
|
|
42
|
+
* `document.querySelector('tw-tooltip-overlay')` — and only then read through
|
|
43
|
+
* the harness.
|
|
44
|
+
*/
|
|
45
|
+
class TooltipHarness extends ComponentHarness {
|
|
46
|
+
static hostSelector = '[data-tw-tooltip-trigger]';
|
|
47
|
+
/** Resolves the tooltip panel, which lives outside this harness's host. */
|
|
48
|
+
panel = this.documentRootLocatorFactory().locatorForOptional('tw-tooltip-overlay');
|
|
49
|
+
/** Predicate for `locatorFor` / `locatorForAll`. */
|
|
50
|
+
static with(options = {}) {
|
|
51
|
+
return new HarnessPredicate(TooltipHarness, options).addOption('triggerText', options.triggerText, async (h, text) => HarnessPredicate.stringMatches(await h.getTriggerText(), text));
|
|
52
|
+
}
|
|
53
|
+
/** The text currently rendered in the trigger, trimmed. */
|
|
54
|
+
async getTriggerText() {
|
|
55
|
+
return (await (await this.host()).text()).trim();
|
|
56
|
+
}
|
|
57
|
+
/** Whether a tooltip panel is currently showing. */
|
|
58
|
+
async isOpen() {
|
|
59
|
+
return (await this.panel()) !== null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The tooltip's message, trimmed, or `null` when nothing is showing. Works
|
|
63
|
+
* for string and `TemplateRef` content alike.
|
|
64
|
+
*/
|
|
65
|
+
async getTooltipText() {
|
|
66
|
+
const panel = await this.panel();
|
|
67
|
+
return panel ? (await panel.text()).trim() : null;
|
|
68
|
+
}
|
|
69
|
+
/** Hovers the trigger. The panel appears once `twTooltipShowDelay` elapses. */
|
|
70
|
+
async show() {
|
|
71
|
+
await (await this.host()).hover();
|
|
72
|
+
}
|
|
73
|
+
/** Moves the pointer off the trigger. The panel detaches once `twTooltipHideDelay` elapses. */
|
|
74
|
+
async hide() {
|
|
75
|
+
await (await this.host()).mouseAway();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Focuses the trigger — the keyboard equivalent of {@link show}, and the path
|
|
79
|
+
* WCAG 2.1 SC 1.4.13 requires to work.
|
|
80
|
+
*
|
|
81
|
+
* Moves real DOM focus *and* dispatches `focusin`, because a programmatic
|
|
82
|
+
* `focus()` does not reliably raise `focusin` in every test DOM. The directive
|
|
83
|
+
* treats a repeated show as a no-op, so the belt-and-braces pair is safe.
|
|
84
|
+
*/
|
|
85
|
+
async focusTrigger() {
|
|
86
|
+
const host = await this.host();
|
|
87
|
+
await host.focus();
|
|
88
|
+
await host.dispatchEvent('focusin');
|
|
89
|
+
}
|
|
90
|
+
/** Blurs the trigger — the keyboard equivalent of {@link hide}. */
|
|
91
|
+
async blurTrigger() {
|
|
92
|
+
const host = await this.host();
|
|
93
|
+
await host.blur();
|
|
94
|
+
await host.dispatchEvent('focusout');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Generated bundle index. Do not edit.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
export { TooltipHarness };
|
|
103
|
+
//# sourceMappingURL=cdevhub-ngx-tw-tooltip-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdevhub-ngx-tw-tooltip-testing.mjs","sources":["../../../projects/ngx-tw/tooltip/testing/tooltip-harness.ts","../../../projects/ngx-tw/tooltip/testing/cdevhub-ngx-tw-tooltip-testing.ts"],"sourcesContent":["import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\nimport type { BaseHarnessFilters, TestElement } from '@angular/cdk/testing';\n\n/** Filters accepted by `TooltipHarness.with`. */\nexport interface TooltipHarnessFilters extends BaseHarnessFilters {\n /** Match by the text rendered in the trigger. */\n triggerText?: string | RegExp;\n}\n\n/**\n * Harness for a `[twTooltip]` trigger and the panel it shows.\n *\n * Deliberately narrow: a tooltip's whole observable surface is *whether it is\n * showing and what it says*. Position, delays, color, size and arrow are\n * configuration, not state, and a harness method for any of them would freeze an\n * API that may still move — so none is offered.\n *\n * ## Loading it\n *\n * The host is the trigger, which lives in the fixture, so the ordinary\n * `TestbedHarnessEnvironment.loader(fixture)` is correct. The panel renders into\n * the CDK overlay container outside the fixture, and this harness resolves it\n * internally via `documentRootLocatorFactory()` — a consumer never needs\n * `documentRootLoader`.\n *\n * The host selector is the directive's static `data-tw-tooltip-trigger` marker,\n * which matches both spellings of the input: `twTooltip=\"literal\"` and the bound\n * `[twTooltip]=\"expr()\"`, for which Angular renders no attribute at all. A\n * harness matching the directive's own selector would silently miss every bound\n * trigger.\n *\n * Unlike `MenuHarness` and `PopoverHarness`, a tooltip trigger carries no\n * `aria-controls` linking it to its panel (`aria-describedby` points at CDK\n * `AriaDescriber`'s shared hidden message element for string content), so the\n * panel is resolved as \"the tooltip showing in the document\". That is exact for\n * the hover/focus model, where only one tooltip is visible at a time, but a test\n * that forces two open at once cannot tell them apart.\n *\n * ## Waiting for the panel\n *\n * Every method stabilizes the fixture the way CDK harnesses always do, which\n * covers change detection but **not** the component's own timers: show and hide\n * are driven by plain `setTimeout`s behind `twTooltipShowDelay` (200 ms by\n * default) and `twTooltipHideDelay` (150 ms), which Angular's `PendingTasks`\n * does not track, so `whenStable()` does not wait for them — not even at a delay\n * of `0`. {@link show} and {@link hide} therefore dispatch the interaction and\n * return before anything has attached or detached. Set both delays to `0` in the\n * fixture, poll the DOM for the panel —\n * `document.querySelector('tw-tooltip-overlay')` — and only then read through\n * the harness.\n */\nexport class TooltipHarness extends ComponentHarness {\n static hostSelector = '[data-tw-tooltip-trigger]';\n\n /** Resolves the tooltip panel, which lives outside this harness's host. */\n private readonly panel =\n this.documentRootLocatorFactory().locatorForOptional('tw-tooltip-overlay');\n\n /** Predicate for `locatorFor` / `locatorForAll`. */\n static with(options: TooltipHarnessFilters = {}): HarnessPredicate<TooltipHarness> {\n return new HarnessPredicate(TooltipHarness, options).addOption(\n 'triggerText',\n options.triggerText,\n async (h, text) => HarnessPredicate.stringMatches(await h.getTriggerText(), text),\n );\n }\n\n /** The text currently rendered in the trigger, trimmed. */\n async getTriggerText(): Promise<string> {\n return (await (await this.host()).text()).trim();\n }\n\n /** Whether a tooltip panel is currently showing. */\n async isOpen(): Promise<boolean> {\n return (await this.panel()) !== null;\n }\n\n /**\n * The tooltip's message, trimmed, or `null` when nothing is showing. Works\n * for string and `TemplateRef` content alike.\n */\n async getTooltipText(): Promise<string | null> {\n const panel: TestElement | null = await this.panel();\n return panel ? (await panel.text()).trim() : null;\n }\n\n /** Hovers the trigger. The panel appears once `twTooltipShowDelay` elapses. */\n async show(): Promise<void> {\n await (await this.host()).hover();\n }\n\n /** Moves the pointer off the trigger. The panel detaches once `twTooltipHideDelay` elapses. */\n async hide(): Promise<void> {\n await (await this.host()).mouseAway();\n }\n\n /**\n * Focuses the trigger — the keyboard equivalent of {@link show}, and the path\n * WCAG 2.1 SC 1.4.13 requires to work.\n *\n * Moves real DOM focus *and* dispatches `focusin`, because a programmatic\n * `focus()` does not reliably raise `focusin` in every test DOM. The directive\n * treats a repeated show as a no-op, so the belt-and-braces pair is safe.\n */\n async focusTrigger(): Promise<void> {\n const host = await this.host();\n await host.focus();\n await host.dispatchEvent('focusin');\n }\n\n /** Blurs the trigger — the keyboard equivalent of {@link hide}. */\n async blurTrigger(): Promise<void> {\n const host = await this.host();\n await host.blur();\n await host.dispatchEvent('focusout');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCG;AACG,MAAO,cAAe,SAAQ,gBAAgB,CAAA;AAClD,IAAA,OAAO,YAAY,GAAG,2BAA2B;;IAGhC,KAAK,GACpB,IAAI,CAAC,0BAA0B,EAAE,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;;AAG5E,IAAA,OAAO,IAAI,CAAC,OAAA,GAAiC,EAAE,EAAA;AAC7C,QAAA,OAAO,IAAI,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,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