ngwr 11.0.0 → 11.2.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/action-sheet/styles/_index.scss +4 -1
- package/anchor/styles/_index.scss +2 -1
- package/calendar/styles/_index.scss +11 -2
- package/cascader/styles/_index.scss +3 -1
- package/circular-text/styles/_index.scss +11 -0
- package/command-palette/styles/_index.scss +14 -1
- package/context-menu/styles/_index.scss +2 -1
- package/falling-text/styles/_index.scss +2 -1
- package/fesm2022/ngwr-action-sheet-testing.mjs +313 -0
- package/fesm2022/ngwr-action-sheet-testing.mjs.map +1 -0
- package/fesm2022/ngwr-bar-chart-testing.mjs +89 -0
- package/fesm2022/ngwr-bar-chart-testing.mjs.map +1 -0
- package/fesm2022/ngwr-blur-text-testing.mjs +203 -0
- package/fesm2022/ngwr-blur-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-blur-text.mjs +15 -1
- package/fesm2022/ngwr-blur-text.mjs.map +1 -1
- package/fesm2022/ngwr-border-glow-testing.mjs +325 -0
- package/fesm2022/ngwr-border-glow-testing.mjs.map +1 -0
- package/fesm2022/ngwr-border-glow.mjs +2 -2
- package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
- package/fesm2022/ngwr-calendar-heatmap-testing.mjs +95 -0
- package/fesm2022/ngwr-calendar-heatmap-testing.mjs.map +1 -0
- package/fesm2022/ngwr-calendar-testing.mjs +368 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-calendar.mjs +43 -3
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +2 -2
- package/fesm2022/ngwr-cascader.mjs +14 -2
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +8 -0
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-circular-text-testing.mjs +230 -0
- package/fesm2022/ngwr-circular-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-circular-text.mjs +2 -2
- package/fesm2022/ngwr-circular-text.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker-testing.mjs +432 -0
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -0
- package/fesm2022/ngwr-color-picker.mjs +29 -3
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +25 -5
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs +10 -79
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-decrypt-text-testing.mjs +261 -0
- package/fesm2022/ngwr-decrypt-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-decrypt-text.mjs +6 -1
- package/fesm2022/ngwr-decrypt-text.mjs.map +1 -1
- package/fesm2022/ngwr-donut-chart-testing.mjs +93 -0
- package/fesm2022/ngwr-donut-chart-testing.mjs.map +1 -0
- package/fesm2022/ngwr-drag-drop.mjs +2 -2
- package/fesm2022/ngwr-drawer.mjs +36 -7
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +32 -2
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar-testing.mjs +446 -0
- package/fesm2022/ngwr-event-calendar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-event-calendar.mjs +43 -18
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-falling-text-testing.mjs +218 -0
- package/fesm2022/ngwr-falling-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-falling-text.mjs +2 -2
- package/fesm2022/ngwr-falling-text.mjs.map +1 -1
- package/fesm2022/ngwr-fuzzy-text-testing.mjs +134 -0
- package/fesm2022/ngwr-fuzzy-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-gauge-testing.mjs +86 -0
- package/fesm2022/ngwr-gauge-testing.mjs.map +1 -0
- package/fesm2022/ngwr-glitch-text-testing.mjs +181 -0
- package/fesm2022/ngwr-glitch-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-glitch-text.mjs +2 -2
- package/fesm2022/ngwr-gradient-text-testing.mjs +223 -0
- package/fesm2022/ngwr-gradient-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-gradient-text.mjs +2 -2
- package/fesm2022/ngwr-i18n-en.mjs +14 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +14 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper-testing.mjs +156 -0
- package/fesm2022/ngwr-image-cropper-testing.mjs.map +1 -0
- package/fesm2022/ngwr-image-cropper.mjs +10 -3
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +73 -6
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-knob-testing.mjs +220 -0
- package/fesm2022/ngwr-knob-testing.mjs.map +1 -0
- package/fesm2022/ngwr-lightbox-testing.mjs +223 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -0
- package/fesm2022/ngwr-lightbox.mjs +9 -2
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-line-chart-testing.mjs +119 -0
- package/fesm2022/ngwr-line-chart-testing.mjs.map +1 -0
- package/fesm2022/ngwr-list.mjs +2 -2
- package/fesm2022/ngwr-loading-bar.mjs +2 -2
- package/fesm2022/ngwr-marquee-testing.mjs +336 -0
- package/fesm2022/ngwr-marquee-testing.mjs.map +1 -0
- package/fesm2022/ngwr-marquee.mjs +2 -2
- package/fesm2022/ngwr-meter-group-testing.mjs +80 -0
- package/fesm2022/ngwr-meter-group-testing.mjs.map +1 -0
- package/fesm2022/ngwr-overlay.mjs +28 -1
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +14 -0
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-rotating-text-testing.mjs +220 -0
- package/fesm2022/ngwr-rotating-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-rotating-text.mjs +2 -2
- package/fesm2022/ngwr-rotating-text.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +70 -11
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-shiny-text-testing.mjs +237 -0
- package/fesm2022/ngwr-shiny-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-shiny-text.mjs +2 -2
- package/fesm2022/ngwr-slider.mjs +44 -6
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sparkline-testing.mjs +76 -0
- package/fesm2022/ngwr-sparkline-testing.mjs.map +1 -0
- package/fesm2022/ngwr-speed-dial-testing.mjs +279 -0
- package/fesm2022/ngwr-speed-dial-testing.mjs.map +1 -0
- package/fesm2022/ngwr-splash-cursor-testing.mjs +89 -0
- package/fesm2022/ngwr-splash-cursor-testing.mjs.map +1 -0
- package/fesm2022/ngwr-split-text-testing.mjs +224 -0
- package/fesm2022/ngwr-split-text-testing.mjs.map +1 -0
- package/fesm2022/ngwr-split-text.mjs +15 -1
- package/fesm2022/ngwr-split-text.mjs.map +1 -1
- package/fesm2022/ngwr-splitter-testing.mjs +245 -0
- package/fesm2022/ngwr-splitter-testing.mjs.map +1 -0
- package/fesm2022/ngwr-spotlight-card-testing.mjs +368 -0
- package/fesm2022/ngwr-spotlight-card-testing.mjs.map +1 -0
- package/fesm2022/ngwr-spotlight-card.mjs +2 -2
- package/fesm2022/ngwr-star-border-testing.mjs +172 -0
- package/fesm2022/ngwr-star-border-testing.mjs.map +1 -0
- package/fesm2022/ngwr-star-border.mjs +2 -2
- package/fesm2022/ngwr-table.mjs +13 -3
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +15 -1
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-tilt-card-testing.mjs +190 -0
- package/fesm2022/ngwr-tilt-card-testing.mjs.map +1 -0
- package/fesm2022/ngwr-tilt-card.mjs +21 -3
- package/fesm2022/ngwr-tilt-card.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +36 -7
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour-testing.mjs +173 -0
- package/fesm2022/ngwr-tour-testing.mjs.map +1 -0
- package/fesm2022/ngwr-tour.mjs +2 -2
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +10 -3
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typewriter-testing.mjs +228 -0
- package/fesm2022/ngwr-typewriter-testing.mjs.map +1 -0
- package/fesm2022/ngwr-typewriter.mjs +2 -2
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +2 -2
- package/fesm2022/ngwr-waves-testing.mjs +128 -0
- package/fesm2022/ngwr-waves-testing.mjs.map +1 -0
- package/fesm2022/ngwr-waves.mjs +2 -2
- package/fesm2022/ngwr-window-testing.mjs +361 -0
- package/fesm2022/ngwr-window-testing.mjs.map +1 -0
- package/fesm2022/ngwr-window.mjs +84 -10
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +7 -2
- package/i18n/en.json +16 -2
- package/i18n/ru.json +16 -2
- package/llms-full.txt +147 -0
- package/llms.txt +27 -8
- package/mcp/providers.js +29 -0
- package/mcp/tools.js +1 -29
- package/package.json +145 -1
- package/result/styles/_index.scss +3 -1
- package/segmented/styles/_index.scss +5 -1
- package/select/styles/_index.scss +3 -1
- package/skills/ngwr/SKILL.md +115 -0
- package/skills/ngwr/references/catalog.md +212 -0
- package/skills/ngwr/references/setup.md +73 -0
- package/stepper/styles/_index.scss +18 -2
- package/table/styles/_index.scss +3 -1
- package/theme/styles/_colors.scss +15 -2
- package/theme/styles/_dark.scss +24 -12
- package/tree/styles/_index.scss +4 -2
- package/types/ngwr-action-sheet-testing.d.ts +260 -0
- package/types/ngwr-bar-chart-testing.d.ts +77 -0
- package/types/ngwr-blur-text-testing.d.ts +180 -0
- package/types/ngwr-blur-text.d.ts +12 -0
- package/types/ngwr-border-glow-testing.d.ts +219 -0
- package/types/ngwr-calendar-heatmap-testing.d.ts +79 -0
- package/types/ngwr-calendar-testing.d.ts +277 -0
- package/types/ngwr-calendar.d.ts +10 -0
- package/types/ngwr-checkbox.d.ts +13 -0
- package/types/ngwr-circular-text-testing.d.ts +196 -0
- package/types/ngwr-color-picker-testing.d.ts +291 -0
- package/types/ngwr-color-picker.d.ts +13 -1
- package/types/ngwr-context-menu.d.ts +15 -1
- package/types/ngwr-date-picker-testing.d.ts +6 -66
- package/types/ngwr-decrypt-text-testing.d.ts +222 -0
- package/types/ngwr-donut-chart-testing.d.ts +79 -0
- package/types/ngwr-drawer.d.ts +12 -0
- package/types/ngwr-dropdown.d.ts +9 -0
- package/types/ngwr-event-calendar-testing.d.ts +301 -0
- package/types/ngwr-event-calendar.d.ts +9 -6
- package/types/ngwr-falling-text-testing.d.ts +186 -0
- package/types/ngwr-fuzzy-text-testing.d.ts +130 -0
- package/types/ngwr-gauge-testing.d.ts +71 -0
- package/types/ngwr-glitch-text-testing.d.ts +172 -0
- package/types/ngwr-gradient-text-testing.d.ts +173 -0
- package/types/ngwr-image-cropper-testing.d.ts +134 -0
- package/types/ngwr-image-cropper.d.ts +1 -0
- package/types/ngwr-input-number.d.ts +33 -1
- package/types/ngwr-knob-testing.d.ts +150 -0
- package/types/ngwr-lightbox-testing.d.ts +154 -0
- package/types/ngwr-lightbox.d.ts +6 -0
- package/types/ngwr-line-chart-testing.d.ts +93 -0
- package/types/ngwr-marquee-testing.d.ts +280 -0
- package/types/ngwr-meter-group-testing.d.ts +67 -0
- package/types/ngwr-overlay.d.ts +19 -1
- package/types/ngwr-rotating-text-testing.d.ts +191 -0
- package/types/ngwr-select.d.ts +32 -0
- package/types/ngwr-shiny-text-testing.d.ts +165 -0
- package/types/ngwr-slider.d.ts +15 -0
- package/types/ngwr-sparkline-testing.d.ts +69 -0
- package/types/ngwr-speed-dial-testing.d.ts +195 -0
- package/types/ngwr-splash-cursor-testing.d.ts +95 -0
- package/types/ngwr-split-text-testing.d.ts +209 -0
- package/types/ngwr-split-text.d.ts +12 -0
- package/types/ngwr-splitter-testing.d.ts +174 -0
- package/types/ngwr-spotlight-card-testing.d.ts +303 -0
- package/types/ngwr-star-border-testing.d.ts +135 -0
- package/types/ngwr-table.d.ts +10 -1
- package/types/ngwr-tilt-card-testing.d.ts +158 -0
- package/types/ngwr-tilt-card.d.ts +2 -0
- package/types/ngwr-toast.d.ts +14 -5
- package/types/ngwr-tour-testing.d.ts +143 -0
- package/types/ngwr-tree.d.ts +7 -0
- package/types/ngwr-typewriter-testing.d.ts +201 -0
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-waves-testing.d.ts +121 -0
- package/types/ngwr-window-testing.d.ts +263 -0
- package/types/ngwr-window.d.ts +27 -10
- package/window/styles/_index.scss +44 -16
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The alignments `<wr-split-text>` takes.
|
|
12
|
+
*
|
|
13
|
+
* Restated here because the component declares the union inline on its `textAlign`
|
|
14
|
+
* input and exports no name for it — a filter typed `string` would take a value the
|
|
15
|
+
* component cannot produce and then quietly match nothing.
|
|
16
|
+
*/
|
|
17
|
+
type WrSplitTextHarnessAlign = 'left' | 'center' | 'right' | 'justify';
|
|
18
|
+
/** Narrows which `<wr-split-text>` a harness query matches. */
|
|
19
|
+
interface WrSplitTextHarnessFilters extends BaseHarnessFilters {
|
|
20
|
+
/**
|
|
21
|
+
* Match the string the component announces — the readable copy, not the pieces.
|
|
22
|
+
* A string is an exact match, a RegExp is tested.
|
|
23
|
+
*
|
|
24
|
+
* Against the accessible copy rather than the host's own text, which holds the
|
|
25
|
+
* string twice: once readably and once as a span per character.
|
|
26
|
+
*/
|
|
27
|
+
readonly text?: string | RegExp;
|
|
28
|
+
/**
|
|
29
|
+
* Match on how many animated pieces the split produced — one per character, or one
|
|
30
|
+
* per word. The only number about the animation that reaches the DOM.
|
|
31
|
+
*/
|
|
32
|
+
readonly pieceCount?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Match on the alignment the host was given.
|
|
35
|
+
*
|
|
36
|
+
* The most useful of the three in practice: a page usually carries several of these
|
|
37
|
+
* and alignment is what tells a centred hero from a left-aligned caption, whereas
|
|
38
|
+
* their text is the thing a spec is usually trying not to hard-code.
|
|
39
|
+
*/
|
|
40
|
+
readonly textAlign?: WrSplitTextHarnessAlign;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @license
|
|
45
|
+
*
|
|
46
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
47
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Test harness for `<wr-split-text>`.
|
|
52
|
+
*
|
|
53
|
+
* **The tween is unreadable from a test, and the absent methods are absent for that
|
|
54
|
+
* reason.** Each piece is animated from a `from` motion state to a `to` one through the
|
|
55
|
+
* Web Animations API, started by an `IntersectionObserver`. A unit test has no layout,
|
|
56
|
+
* no compositor and no WAAPI, so there is no `getOpacity()` and no `getTransform()`:
|
|
57
|
+
* both would report the frozen staged value in jsdom and a value the compositor is not
|
|
58
|
+
* painting in a browser. There is no `getFromState()` / `getToState()` either — those
|
|
59
|
+
* objects only reach the DOM as staged inline styles, on the one path that throws here,
|
|
60
|
+
* so reporting them would mean re-deriving an input from a string the component may
|
|
61
|
+
* never have written. No `isAnimating()`, no `whenAnimationComplete()`: nothing in the
|
|
62
|
+
* document says a tween is running, and completion is the `animationComplete` OUTPUT,
|
|
63
|
+
* which the host binds. No `enterViewport()` / `trigger()`, because an observer is not
|
|
64
|
+
* reachable from a `TestElement` — and observation here is additionally gated behind
|
|
65
|
+
* `document.fonts.ready`, which jsdom does not have, so a `waitForFonts()` would resolve
|
|
66
|
+
* instantly and prove nothing about the gating it claimed to test. Nothing measures
|
|
67
|
+
* either: `getLineCount()` / `didItWrap()` would need layout (and `lines` is not a split
|
|
68
|
+
* this port supports), and the `overflow: hidden` mask with its descender compensation
|
|
69
|
+
* is a stylesheet, which a test runs none of.
|
|
70
|
+
*
|
|
71
|
+
* **What is real is the split, the accessible layer and the alignment.** The string is
|
|
72
|
+
* carried once in a visually-hidden span and every drawn piece is `aria-hidden`, so
|
|
73
|
+
* {@link getAccessibleText} is what is heard while {@link getPieces} is what is drawn —
|
|
74
|
+
* two questions, and a spec asserting only the second would pass on a component that
|
|
75
|
+
* spells the text out letter by letter. {@link getRenderedText} closes the loop by
|
|
76
|
+
* putting the pieces and the spaces back together: the split has to be lossless, and
|
|
77
|
+
* that comparison is what catches a dropped space or a halved surrogate pair. Whether
|
|
78
|
+
* the hidden copy is genuinely off-screen is CSS, so nothing here claims to know.
|
|
79
|
+
*
|
|
80
|
+
* **{@link getTextAlign} is the one input this component reflects**, written straight
|
|
81
|
+
* onto the host as an inline style — an honest read with no layout involved, unlike
|
|
82
|
+
* anything else about how the text is arranged. And {@link hasStagedMotion} is the one
|
|
83
|
+
* fact about the tween worth pinning: that the pieces were taken over, not that anything
|
|
84
|
+
* is moving.
|
|
85
|
+
*
|
|
86
|
+
* Driving the reveal is the spec's job — jsdom supplies neither half of it, and the font
|
|
87
|
+
* gate defers observation by a microtask:
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* // Before TestBed.createComponent — keep the callbacks so the spec can fire them.
|
|
91
|
+
* vi.stubGlobal('IntersectionObserver', StubObserver);
|
|
92
|
+
* // Otherwise `el.animate(...)` throws mid-stagger and leaves the DOM half-staged.
|
|
93
|
+
* Reflect.set(Element.prototype, 'animate', () => ({ cancel: () => undefined, onfinish: null }));
|
|
94
|
+
* // …and always settle before tearing down: observation is queued off a promise, and
|
|
95
|
+
* // landing after destroy() registers a teardown on a dead DestroyRef (NG0911).
|
|
96
|
+
* await fixture.whenStable();
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const hero = await loader.getHarness(WrSplitTextHarness.with({ textAlign: 'center' }));
|
|
102
|
+
*
|
|
103
|
+
* expect(await hero.getPieces()).toEqual(['H', 'e', 'l', 'l', 'o']);
|
|
104
|
+
* expect(await hero.getRenderedText()).toBe(await hero.getAccessibleText());
|
|
105
|
+
* expect(await hero.isTextHidden()).toBe(true);
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @see https://ngwr.dev/guides/testing
|
|
109
|
+
*/
|
|
110
|
+
declare class WrSplitTextHarness extends ComponentHarness {
|
|
111
|
+
static hostSelector: string;
|
|
112
|
+
/** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */
|
|
113
|
+
static with(options?: WrSplitTextHarnessFilters): HarnessPredicate<WrSplitTextHarness>;
|
|
114
|
+
private readonly pieces;
|
|
115
|
+
private readonly spaces;
|
|
116
|
+
/**
|
|
117
|
+
* The whole string, as the one readable copy holds it.
|
|
118
|
+
*
|
|
119
|
+
* All a screen reader gets, since every drawn piece is out of the tree — lose this
|
|
120
|
+
* span and the component becomes a nameless pile of hidden spans, with no other
|
|
121
|
+
* symptom anywhere in the DOM.
|
|
122
|
+
*
|
|
123
|
+
* Untrimmed, deliberately: leading and trailing whitespace is content the split has to
|
|
124
|
+
* carry, and {@link getRenderedText} is meant to compare equal to this. A trimmed read
|
|
125
|
+
* on one side of that comparison would forgive the case it exists to catch.
|
|
126
|
+
*/
|
|
127
|
+
getAccessibleText(): Promise<string>;
|
|
128
|
+
/**
|
|
129
|
+
* The animated pieces, in document order — one per character, or one per word.
|
|
130
|
+
*
|
|
131
|
+
* The split the stagger runs over: `['H', 'i']` at the default `splitType="chars"`
|
|
132
|
+
* against `['Hi', 'there']` for `"words"`, and `['a', '🚀']` for a surrogate pair the
|
|
133
|
+
* code-point split kept whole instead of halving into two broken glyphs. Whitespace is
|
|
134
|
+
* not here — it is drawn separately and never staggered, so see {@link getSpaceCount}.
|
|
135
|
+
*/
|
|
136
|
+
getPieces(): Promise<string[]>;
|
|
137
|
+
/**
|
|
138
|
+
* How many pieces the stagger runs over.
|
|
139
|
+
*
|
|
140
|
+
* `delay` × this is the real length of the effect, and the only number about the
|
|
141
|
+
* animation present in the document.
|
|
142
|
+
*/
|
|
143
|
+
getPieceCount(): Promise<number>;
|
|
144
|
+
/**
|
|
145
|
+
* How many whitespace runs sit between the pieces.
|
|
146
|
+
*
|
|
147
|
+
* Its own method because whitespace is deliberately excluded from the animated set:
|
|
148
|
+
* reclassifying spaces as pieces would leave {@link getRenderedText} identical, change
|
|
149
|
+
* the stagger count and the rhythm of the reveal, and show up nowhere else.
|
|
150
|
+
*/
|
|
151
|
+
getSpaceCount(): Promise<number>;
|
|
152
|
+
/**
|
|
153
|
+
* Everything the component drew, pieces and spaces together, in document order.
|
|
154
|
+
*
|
|
155
|
+
* The assertion this exists for is `getRenderedText() === getAccessibleText()`: the
|
|
156
|
+
* split must be lossless. A swallowed space, a re-split that dropped a character or a
|
|
157
|
+
* surrogate pair cut in half all leave the accessible copy intact and are invisible
|
|
158
|
+
* from anywhere else.
|
|
159
|
+
*/
|
|
160
|
+
getRenderedText(): Promise<string>;
|
|
161
|
+
/**
|
|
162
|
+
* Whether every drawn piece is out of the accessibility tree.
|
|
163
|
+
*
|
|
164
|
+
* The defect this component exists to avoid is a screen reader reading
|
|
165
|
+
* `H. e. l. l. o.`, and one piece missing `aria-hidden` brings it back — so this is
|
|
166
|
+
* all-or-nothing, across both element kinds: a readable space is heard as a pause in
|
|
167
|
+
* the middle of a word.
|
|
168
|
+
*
|
|
169
|
+
* Throws when the split produced nothing at all. An empty run of elements satisfies
|
|
170
|
+
* "every one of them is hidden" without anything being hidden, which is also what a
|
|
171
|
+
* component that stopped rendering its pieces would report.
|
|
172
|
+
*/
|
|
173
|
+
isTextHidden(): Promise<boolean>;
|
|
174
|
+
/**
|
|
175
|
+
* The alignment the host was given, as the component wrote it.
|
|
176
|
+
*
|
|
177
|
+
* Off the inline `style` attribute rather than through `getCssValue`, and the
|
|
178
|
+
* difference is not pedantry: computed style answers for an element nobody wrote to —
|
|
179
|
+
* with the inherited or user-agent value — so a host that stopped reflecting the input
|
|
180
|
+
* altogether would keep reporting a plausible `left` or `start`. The attribute is the
|
|
181
|
+
* fact being asserted.
|
|
182
|
+
*
|
|
183
|
+
* `null` means the host carries no alignment at all, which the component never does:
|
|
184
|
+
* the binding is unconditional and the input defaults to `'center'`.
|
|
185
|
+
*/
|
|
186
|
+
getTextAlign(): Promise<string | null>;
|
|
187
|
+
/**
|
|
188
|
+
* Whether the reveal has taken the pieces over — NOT whether anything is animating.
|
|
189
|
+
*
|
|
190
|
+
* Read off the inline `style` attribute the component writes itself, so it stays
|
|
191
|
+
* `true` once the reveal has finished: the tween commits its end state back to the
|
|
192
|
+
* same inline properties on `onfinish`. Anyone reaching for `isAnimating()` wants a
|
|
193
|
+
* frame, and there are no frames here.
|
|
194
|
+
*
|
|
195
|
+
* `false` is the answer worth asserting. It means no piece was written to, which is
|
|
196
|
+
* both the pre-trigger state and the reduced-motion promise — the component returns
|
|
197
|
+
* before staging anything, so a reader who asked for less motion cannot be left with
|
|
198
|
+
* text parked at `from.opacity: 0` by a tween that never runs.
|
|
199
|
+
*
|
|
200
|
+
* ANY piece counts, not all of them, and that is the conservative reading rather than
|
|
201
|
+
* a loose one: a stagger that stages the first piece and then throws leaves exactly
|
|
202
|
+
* one glyph invisible, which is a real failure — and one jsdom reproduces every time
|
|
203
|
+
* `Element.prototype.animate` is missing.
|
|
204
|
+
*/
|
|
205
|
+
hasStagedMotion(): Promise<boolean>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export { WrSplitTextHarness };
|
|
209
|
+
export type { WrSplitTextHarnessAlign, WrSplitTextHarnessFilters };
|
|
@@ -72,6 +72,18 @@ declare class WrSplitText {
|
|
|
72
72
|
private readonly isBrowser;
|
|
73
73
|
private readonly platform;
|
|
74
74
|
private hasAnimated;
|
|
75
|
+
/**
|
|
76
|
+
* The ONE observer, replaced rather than stacked.
|
|
77
|
+
*
|
|
78
|
+
* `startObserver()` used to `new IntersectionObserver(…)` and register its own
|
|
79
|
+
* `destroyRef.onDestroy` every time, and the effect below calls it on every
|
|
80
|
+
* `text` change after setting `hasAnimated = false` — so the guard at the top
|
|
81
|
+
* of `startObserver` never blocked that path. An off-screen element (the only
|
|
82
|
+
* case where the observer does not immediately disconnect itself) therefore
|
|
83
|
+
* leaked one live observer AND one destroy callback per change, all of them
|
|
84
|
+
* watching the same host and all of them able to fire `animate()`.
|
|
85
|
+
*/
|
|
86
|
+
private observer;
|
|
75
87
|
constructor();
|
|
76
88
|
private startObserver;
|
|
77
89
|
private animate;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Narrows which `<wr-splitter>` a harness query matches. */
|
|
11
|
+
interface WrSplitterHarnessFilters extends BaseHarnessFilters {
|
|
12
|
+
/**
|
|
13
|
+
* Match the splitter's own axis — `horizontal` for panes side by side. Note that
|
|
14
|
+
* this is the COMPONENT's word, which is the opposite of what the divider
|
|
15
|
+
* announces; see `WrSplitterHarness.getOrientation`.
|
|
16
|
+
*/
|
|
17
|
+
readonly orientation?: 'horizontal' | 'vertical';
|
|
18
|
+
/** Match the divider's accessible name, an exact string or a RegExp. */
|
|
19
|
+
readonly dividerLabel?: string | RegExp;
|
|
20
|
+
/** Match only enabled (`false`) or only disabled (`true`) splitters. */
|
|
21
|
+
readonly disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** The share of the splitter each pane is asking for, in percent. */
|
|
24
|
+
interface WrSplitterPaneSizes {
|
|
25
|
+
/** The start pane's `flex-basis` — the same number as the divider's position. */
|
|
26
|
+
readonly start: number;
|
|
27
|
+
/** The end pane's `flex-basis` — the remainder. */
|
|
28
|
+
readonly end: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @license
|
|
33
|
+
*
|
|
34
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
35
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/** The four arrow keys, by the direction a user would say out loud. */
|
|
39
|
+
type Arrow = 'left' | 'right' | 'up' | 'down';
|
|
40
|
+
/**
|
|
41
|
+
* Test harness for `<wr-splitter>` — two panes and the divider between them.
|
|
42
|
+
*
|
|
43
|
+
* **Everything here is the keyboard, and that is not a workaround.** The divider is
|
|
44
|
+
* dragged with a pointer in a browser, but the drag reads
|
|
45
|
+
* `getBoundingClientRect()` and turns a client coordinate into a percentage; jsdom
|
|
46
|
+
* lays nothing out, so every rect is 0×0 and a synthetic drag writes `NaN` into the
|
|
47
|
+
* position. The arrow keys reach the same state, are the accessible path anyway, and
|
|
48
|
+
* are what the WAI-ARIA separator pattern is judged on.
|
|
49
|
+
*
|
|
50
|
+
* **Two words for the axis, and they are opposites.** The component's
|
|
51
|
+
* `orientation="horizontal"` means the panes sit side by side, which needs a
|
|
52
|
+
* VERTICAL divider — so that is what `aria-orientation` says. {@link getOrientation}
|
|
53
|
+
* answers the component's word and {@link getDividerOrientation} the divider's; both
|
|
54
|
+
* are here because a spec that conflated them would look right and assert nothing.
|
|
55
|
+
*
|
|
56
|
+
* **Arrows follow the VISUAL axis.** Under `dir="rtl"` the start pane is the one on
|
|
57
|
+
* the right, so ArrowRight SHRINKS the position. {@link pressArrow} takes the key a
|
|
58
|
+
* user presses rather than a semantic direction, which is the only way a spec can
|
|
59
|
+
* pin that mirroring; {@link setPosition} walks with whichever key currently grows
|
|
60
|
+
* the number, and reports where it landed.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const splitter = await loader.getHarness(WrSplitterHarness);
|
|
65
|
+
*
|
|
66
|
+
* expect(await splitter.getPosition()).toBe(50);
|
|
67
|
+
* await splitter.setPosition(70);
|
|
68
|
+
* expect(await splitter.getPaneSizes()).toEqual({ start: 70, end: 30 });
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @see https://ngwr.dev/guides/testing
|
|
72
|
+
*/
|
|
73
|
+
declare class WrSplitterHarness extends ComponentHarness {
|
|
74
|
+
static hostSelector: string;
|
|
75
|
+
/** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */
|
|
76
|
+
static with(options?: WrSplitterHarnessFilters): HarnessPredicate<WrSplitterHarness>;
|
|
77
|
+
private readonly divider;
|
|
78
|
+
/**
|
|
79
|
+
* The splitter's own axis: `horizontal` when the panes sit side by side.
|
|
80
|
+
*
|
|
81
|
+
* Read from the host modifier rather than from `aria-orientation`, which says the
|
|
82
|
+
* opposite thing about the same layout — see {@link getDividerOrientation}.
|
|
83
|
+
*/
|
|
84
|
+
getOrientation(): Promise<'horizontal' | 'vertical'>;
|
|
85
|
+
/**
|
|
86
|
+
* What the divider announces — the INVERSE of {@link getOrientation}, and correct:
|
|
87
|
+
* a separator's orientation is the line it draws, not the axis it travels along.
|
|
88
|
+
*/
|
|
89
|
+
getDividerOrientation(): Promise<string | null>;
|
|
90
|
+
/** The divider's position as a percentage, from `aria-valuenow`. */
|
|
91
|
+
getPosition(): Promise<number>;
|
|
92
|
+
/** The lowest position the divider will accept, from `aria-valuemin`. */
|
|
93
|
+
getMinPosition(): Promise<number>;
|
|
94
|
+
/** The highest position the divider will accept, from `aria-valuemax`. */
|
|
95
|
+
getMaxPosition(): Promise<number>;
|
|
96
|
+
/**
|
|
97
|
+
* What each pane is asking for, in percent, from the `flex-basis` the component
|
|
98
|
+
* writes inline.
|
|
99
|
+
*
|
|
100
|
+
* This is the only evidence a spec without layout has that the panes followed the
|
|
101
|
+
* divider — a measured width is zero for both. They should always sum to 100:
|
|
102
|
+
* the end pane is `100 - position`, so a pair that does not is a component bug
|
|
103
|
+
* rather than a rounding artefact.
|
|
104
|
+
*/
|
|
105
|
+
getPaneSizes(): Promise<WrSplitterPaneSizes>;
|
|
106
|
+
/** The start pane's projected text, trimmed. */
|
|
107
|
+
getStartText(): Promise<string>;
|
|
108
|
+
/** The end pane's projected text, trimmed. */
|
|
109
|
+
getEndText(): Promise<string>;
|
|
110
|
+
/** The divider's accessible name — a focusable separator is a widget and needs one. */
|
|
111
|
+
getDividerLabel(): Promise<string | null>;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the splitter refuses to resize.
|
|
114
|
+
*
|
|
115
|
+
* From the divider's `aria-disabled`, which is the half a screen reader acts on.
|
|
116
|
+
* The component also drops the divider out of the tab order and paints a modifier
|
|
117
|
+
* on the host, and {@link isDividerFocusable} answers the first of those — worth
|
|
118
|
+
* asking separately, because a divider that is announced as disabled and still a
|
|
119
|
+
* tab stop is a control the keyboard can reach and not use.
|
|
120
|
+
*/
|
|
121
|
+
isDisabled(): Promise<boolean>;
|
|
122
|
+
/** Whether the divider is a tab stop (`tabindex="0"`). */
|
|
123
|
+
isDividerFocusable(): Promise<boolean>;
|
|
124
|
+
/** Move keyboard focus to the divider. */
|
|
125
|
+
focusDivider(): Promise<void>;
|
|
126
|
+
/** Whether the divider currently holds focus. */
|
|
127
|
+
isDividerFocused(): Promise<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* Press one arrow key on the divider.
|
|
130
|
+
*
|
|
131
|
+
* The key rather than a direction, deliberately: which way the position moves is a
|
|
132
|
+
* function of the key AND the reading direction, and a `grow()` / `shrink()` pair
|
|
133
|
+
* would hide exactly the behaviour worth asserting. An arrow off the splitter's own
|
|
134
|
+
* axis does nothing at all — the horizontal splitter ignores Up and Down.
|
|
135
|
+
*
|
|
136
|
+
* `shift` is the coarse step: 10 instead of 1.
|
|
137
|
+
*/
|
|
138
|
+
pressArrow(arrow: Arrow, options?: {
|
|
139
|
+
shift?: boolean;
|
|
140
|
+
}): Promise<void>;
|
|
141
|
+
/** Press Home — jumping to `minPosition`, whatever the reading direction. */
|
|
142
|
+
pressHome(): Promise<void>;
|
|
143
|
+
/** Press End — jumping to `maxPosition`. Semantic, so it never mirrors under RTL. */
|
|
144
|
+
pressEnd(): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Walk the divider to a position with the keyboard, and assert it landed there.
|
|
147
|
+
*
|
|
148
|
+
* Ten-unit hops first, then single steps — the same two strides a user has. It
|
|
149
|
+
* walks rather than assigning, because assigning would prove the harness can write
|
|
150
|
+
* a signal and nothing about the component: the clamp, the min / max and the
|
|
151
|
+
* mirroring all live on this path.
|
|
152
|
+
*
|
|
153
|
+
* Throws rather than half-arriving. A target outside `[min, max]` is unreachable by
|
|
154
|
+
* construction, and so is any target the walk cannot hit exactly — the position is a
|
|
155
|
+
* float that a previous drag may have left mid-step, and whole-unit keys cannot get
|
|
156
|
+
* off a fractional offset. Both say so, with where it actually stopped.
|
|
157
|
+
*/
|
|
158
|
+
setPosition(target: number): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Whether ArrowRight is currently the key that GROWS the position — true in LTR,
|
|
161
|
+
* false in RTL, where the start pane is the one on the right.
|
|
162
|
+
*
|
|
163
|
+
* Probed rather than read off `Directionality`, which a harness has no access to:
|
|
164
|
+
* press, look, and put it back. At the top of the range a growing press is clamped
|
|
165
|
+
* and would prove nothing, so the probe presses the other way there instead. The
|
|
166
|
+
* undo is conditional — a press that moved nothing has nothing to undo, and undoing
|
|
167
|
+
* it anyway would move the divider by one in the direction the probe was testing.
|
|
168
|
+
*/
|
|
169
|
+
private growsWithRight;
|
|
170
|
+
private numeric;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { WrSplitterHarness };
|
|
174
|
+
export type { WrSplitterHarnessFilters, WrSplitterPaneSizes };
|