ngwr 13.0.0 → 14.0.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/README.md +13 -6
- package/color-picker/styles/_index.scss +43 -5
- package/fesm2022/ngwr-alert.mjs +5 -5
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +11 -1
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-blur-text.mjs +13 -2
- package/fesm2022/ngwr-blur-text.mjs.map +1 -1
- package/fesm2022/ngwr-border-glow.mjs +12 -3
- package/fesm2022/ngwr-border-glow.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +14 -3
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +4 -4
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar-testing.mjs +15 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +51 -5
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-circular-text.mjs +20 -1
- package/fesm2022/ngwr-circular-text.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker-testing.mjs +23 -7
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +89 -10
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +27 -3
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +13 -3
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-date-adapters-fns.mjs +101 -33
- package/fesm2022/ngwr-date-adapters-fns.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs +10 -2
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +103 -13
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +480 -79
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +22 -16
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +5 -2
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-drag-drop.mjs +30 -2
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +24 -18
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +8 -3
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +1 -1
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +52 -12
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-fuzzy-text.mjs +21 -4
- package/fesm2022/ngwr-fuzzy-text.mjs.map +1 -1
- package/fesm2022/ngwr-gradient-text.mjs +9 -2
- package/fesm2022/ngwr-gradient-text.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +63 -1
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +28 -1
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +150 -22
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon-adapters-feather.mjs +11 -0
- package/fesm2022/ngwr-icon-adapters-feather.mjs.map +1 -1
- package/fesm2022/ngwr-icon-adapters-lucide.mjs +22 -2
- package/fesm2022/ngwr-icon-adapters-lucide.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +474 -37
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +3 -3
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +21 -3
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +14 -7
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-knob-testing.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +20 -2
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar-router.mjs +73 -0
- package/fesm2022/ngwr-loading-bar-router.mjs.map +1 -0
- package/fesm2022/ngwr-loading-bar.mjs +21 -32
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
- package/fesm2022/ngwr-markdown.mjs +63 -11
- package/fesm2022/ngwr-markdown.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +104 -14
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +36 -7
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination-testing.mjs +11 -10
- package/fesm2022/ngwr-pagination-testing.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +65 -30
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +3 -2
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +2 -1
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +38 -1
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +93 -34
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-shiny-text.mjs +10 -3
- package/fesm2022/ngwr-shiny-text.mjs.map +1 -1
- package/fesm2022/ngwr-splitter-testing.mjs.map +1 -1
- package/fesm2022/ngwr-squircle.mjs +2 -1
- package/fesm2022/ngwr-squircle.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +35 -4
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +35 -12
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +158 -0
- package/fesm2022/ngwr-tabs-router.mjs.map +1 -0
- package/fesm2022/ngwr-tabs-testing.mjs +13 -11
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +104 -12
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +20 -1
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +1 -1
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +2 -2
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +18 -2
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +143 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window-testing.mjs +10 -2
- package/fesm2022/ngwr-window-testing.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +4 -4
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/i18n/en.json +33 -6
- package/i18n/ru.json +33 -6
- package/llms-full.txt +20 -11
- package/llms.txt +47 -16
- package/mcp/catalog.js +3 -3
- package/mcp/providers.js +11 -0
- package/package.json +11 -3
- package/schematics/migrations/v13/index.js +101 -0
- package/schematics/migrations/v14/index.js +422 -0
- package/schematics/migrations.json +10 -0
- package/schematics/page/templates.js +1 -1
- package/schematics/use/symbol-map.json +1 -0
- package/skills/ngwr/SKILL.md +4 -1
- package/skills/ngwr/references/catalog.md +2 -0
- package/skills/ngwr/references/setup.md +4 -0
- package/stepper/styles/_index.scss +19 -1
- package/textarea/styles/_index.scss +14 -6
- package/toast/styles/_index.scss +12 -4
- package/types/ngwr-alert.d.ts +3 -3
- package/types/ngwr-blur-text.d.ts +8 -0
- package/types/ngwr-breadcrumbs.d.ts +1 -0
- package/types/ngwr-button.d.ts +2 -2
- package/types/ngwr-calendar-testing.d.ts +21 -4
- package/types/ngwr-calendar.d.ts +37 -0
- package/types/ngwr-circular-text.d.ts +9 -0
- package/types/ngwr-collapse.d.ts +19 -15
- package/types/ngwr-color-picker-testing.d.ts +10 -4
- package/types/ngwr-color-picker.d.ts +70 -2
- package/types/ngwr-command-palette.d.ts +14 -0
- package/types/ngwr-context-menu.d.ts +1 -1
- package/types/ngwr-date-adapters-fns.d.ts +71 -29
- package/types/ngwr-date-picker-testing.d.ts +206 -185
- package/types/ngwr-date-picker.d.ts +7 -0
- package/types/ngwr-date.d.ts +143 -13
- package/types/ngwr-drag-drop.d.ts +19 -0
- package/types/ngwr-dropdown.d.ts +1 -1
- package/types/ngwr-event-calendar-testing.d.ts +12 -9
- package/types/ngwr-file-upload.d.ts +31 -3
- package/types/ngwr-fuzzy-text.d.ts +5 -0
- package/types/ngwr-i18n.d.ts +89 -7
- package/types/ngwr-icon-adapters-feather.d.ts +11 -0
- package/types/ngwr-icon.d.ts +42 -1
- package/types/ngwr-input-number.d.ts +1 -1
- package/types/ngwr-input-otp.d.ts +3 -0
- package/types/ngwr-input.d.ts +11 -4
- package/types/ngwr-knob-testing.d.ts +8 -4
- package/types/ngwr-knob.d.ts +18 -0
- package/types/ngwr-loading-bar-router.d.ts +35 -0
- package/types/ngwr-loading-bar.d.ts +19 -9
- package/types/ngwr-mention.d.ts +13 -0
- package/types/ngwr-pagination-testing.d.ts +11 -10
- package/types/ngwr-pagination.d.ts +39 -10
- package/types/ngwr-popconfirm.d.ts +1 -1
- package/types/ngwr-popover.d.ts +1 -1
- package/types/ngwr-select.d.ts +65 -10
- package/types/ngwr-shiny-text.d.ts +1 -0
- package/types/ngwr-splitter-testing.d.ts +9 -4
- package/types/ngwr-squircle.d.ts +1 -1
- package/types/ngwr-statistic.d.ts +22 -2
- package/types/ngwr-table.d.ts +24 -5
- package/types/ngwr-tabs-router.d.ts +67 -0
- package/types/ngwr-tabs-testing.d.ts +12 -10
- package/types/ngwr-tabs.d.ts +103 -6
- package/types/ngwr-textarea.d.ts +9 -0
- package/types/ngwr-tree.d.ts +7 -0
- package/types/ngwr-utils.d.ts +79 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window-testing.d.ts +11 -3
- package/types/ngwr-window.d.ts +11 -4
- package/window/styles/_index.scss +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { LocationStrategy } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, forwardRef, Directive } from '@angular/core';
|
|
4
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
|
6
|
+
import { filter, map, startWith } from 'rxjs';
|
|
7
|
+
import { WR_TABS_ROUTING } from 'ngwr/tabs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @license
|
|
11
|
+
*
|
|
12
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
13
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* How `routerLinkActive` matches when no `[routerLinkActiveOptions]` is given:
|
|
17
|
+
* a path PREFIX, so `/settings/profile` still selects a `/settings` tab, and a
|
|
18
|
+
* fragment or a matrix param never unselects one.
|
|
19
|
+
*/
|
|
20
|
+
const MATCH = {
|
|
21
|
+
paths: 'subset',
|
|
22
|
+
queryParams: 'subset',
|
|
23
|
+
fragment: 'ignored',
|
|
24
|
+
matrixParams: 'ignored',
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Router support for `<wr-tabs>`. Add it to the `imports` of the component that
|
|
28
|
+
* declares a strip whose `<wr-tab>`s carry a `routerLink`:
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { WrTab, WrTabs } from 'ngwr/tabs';
|
|
33
|
+
* import { WrTabsRouting } from 'ngwr/tabs/router';
|
|
34
|
+
*
|
|
35
|
+
* @Component({ imports: [WrTabs, WrTab, WrTabsRouting], template: `
|
|
36
|
+
* <wr-tabs wrTabsRouting>
|
|
37
|
+
* <wr-tab title="Overview" routerLink="overview" />
|
|
38
|
+
* <wr-tab title="Details" routerLink="details" />
|
|
39
|
+
* </wr-tabs>
|
|
40
|
+
* <router-outlet />
|
|
41
|
+
* ` })
|
|
42
|
+
* export class SettingsPage {}
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* Two mechanical edits per strip, both codemoddable: the symbol in `imports`,
|
|
46
|
+
* and `wrTabsRouting` on the element. An attribute rather than a selector on
|
|
47
|
+
* `wr-tabs` itself, for two reasons — where the router enters a template should
|
|
48
|
+
* be visible in that template, and the sandbox's selector map keys a `wr-` tag
|
|
49
|
+
* even when it is qualified, so `wr-tabs[wrTabsRouting]` would be a second claim
|
|
50
|
+
* on the `wr-tabs` tag. Putting it on an ANCESTOR of the strip also works: the
|
|
51
|
+
* token is read through the element injector, which walks up.
|
|
52
|
+
*
|
|
53
|
+
* **Why it is a separate entry point.** A directive listed in `imports: []`
|
|
54
|
+
* lands in the compiled component's `dependencies` whether or not the branch of
|
|
55
|
+
* the template that matches it ever runs, so `RouterLink` + `RouterLinkActive`
|
|
56
|
+
* on the strip charged every CONTENT tab strip 73.9 kB of `@angular/router` —
|
|
57
|
+
* 51% of what `ngwr/tabs` cost in an app that declares no routes. Measured with
|
|
58
|
+
* source-map attribution against a routerless baseline. `@angular/router` is
|
|
59
|
+
* already an optional peer dependency of the package; this is what makes that
|
|
60
|
+
* true in bytes.
|
|
61
|
+
*
|
|
62
|
+
* **Why a directive rather than a provider function.** A relative `routerLink`
|
|
63
|
+
* (`routerLink="overview"`) resolves against the `ActivatedRoute` of the
|
|
64
|
+
* component that declares the strip. A root-level provider would resolve every
|
|
65
|
+
* one of them against the root route instead, and quietly build the wrong
|
|
66
|
+
* hrefs; a directive on the element reads the same `ActivatedRoute` the old
|
|
67
|
+
* `RouterLink` inside the strip's template did.
|
|
68
|
+
*/
|
|
69
|
+
class WrTabsRouting {
|
|
70
|
+
router = inject(Router);
|
|
71
|
+
locationStrategy = inject(LocationStrategy);
|
|
72
|
+
route = inject(ActivatedRoute);
|
|
73
|
+
/**
|
|
74
|
+
* The current URL, as a signal, so `href()` and `isActive()` are reactive to
|
|
75
|
+
* navigation when read from a computed. `isActive` obviously has to be; so
|
|
76
|
+
* does `href`, because a RELATIVE link is resolved against the active route
|
|
77
|
+
* and its target moves when the route does — which is why `RouterLink`
|
|
78
|
+
* recomputes its own href on every navigation too.
|
|
79
|
+
*/
|
|
80
|
+
url = toSignal(this.router.events.pipe(filter((e) => e instanceof NavigationEnd), map(e => e.urlAfterRedirects), startWith(this.router.url)), { initialValue: this.router.url });
|
|
81
|
+
href(commands) {
|
|
82
|
+
// Read for the dependency, the same reason `isActive` does: a RELATIVE link
|
|
83
|
+
// resolves against the active route, so its target moves when the route
|
|
84
|
+
// does. Without this a strip inside `/users/:id` kept rendering
|
|
85
|
+
// `/users/1/profile` after navigating to user 2 — the click still routed,
|
|
86
|
+
// because `navigate()` rebuilds the tree, but the visible href pointed at
|
|
87
|
+
// the previous user. The docblock above already promised this; the code did
|
|
88
|
+
// not do it.
|
|
89
|
+
this.url();
|
|
90
|
+
// `prepareExternalUrl`, not a bare `serializeUrl`, because that is what
|
|
91
|
+
// `RouterLink` writes and the href exists precisely so the BROWSER can use
|
|
92
|
+
// it. Under `withHashLocation()` a serialized `/one` renders as an href the
|
|
93
|
+
// app does not serve: a plain click survives (`navigateByUrl` ignores the
|
|
94
|
+
// strategy and `preventDefault` stops the bad navigation) but cmd-click,
|
|
95
|
+
// middle-click, "open in new tab" and "copy link address" all take the href
|
|
96
|
+
// at face value — the four things rendering one is for. A `--base-href` is
|
|
97
|
+
// the same defect by another door.
|
|
98
|
+
return this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.tree(commands)));
|
|
99
|
+
}
|
|
100
|
+
isActive(commands) {
|
|
101
|
+
// Read for the dependency, not for the value: `isActive` asks the router,
|
|
102
|
+
// which is not a signal, so without this the computed that calls it would
|
|
103
|
+
// never recompute and the strip would announce its first selection forever.
|
|
104
|
+
this.url();
|
|
105
|
+
return this.router.isActive(this.tree(commands), MATCH);
|
|
106
|
+
}
|
|
107
|
+
navigate(commands, event) {
|
|
108
|
+
// Exactly the guard `RouterLink` applies: a middle click, or any click with
|
|
109
|
+
// a modifier held, belongs to the browser — preventing it would make a tab
|
|
110
|
+
// the one link on the page that cannot be opened in a new window.
|
|
111
|
+
if (event.button !== 0 || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey)
|
|
112
|
+
return;
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
void this.router.navigateByUrl(this.tree(commands));
|
|
115
|
+
}
|
|
116
|
+
tree(commands) {
|
|
117
|
+
// A bare string is one command, the way `[routerLink]="'overview'"` is —
|
|
118
|
+
// spread as characters it would navigate to `/o/v/e/r/v/i/e/w`.
|
|
119
|
+
const segments = typeof commands === 'string' ? [commands] : [...commands];
|
|
120
|
+
return this.router.createUrlTree(segments, { relativeTo: this.route });
|
|
121
|
+
}
|
|
122
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrTabsRouting, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
123
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: WrTabsRouting, isStandalone: true, selector: "[wrTabsRouting]", providers: [
|
|
124
|
+
{
|
|
125
|
+
provide: WR_TABS_ROUTING,
|
|
126
|
+
// eslint-disable-next-line @angular-eslint/no-forward-ref
|
|
127
|
+
useExisting: forwardRef(() => WrTabsRouting),
|
|
128
|
+
},
|
|
129
|
+
], exportAs: ["wrTabsRouting"], ngImport: i0 });
|
|
130
|
+
}
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: WrTabsRouting, decorators: [{
|
|
132
|
+
type: Directive,
|
|
133
|
+
args: [{
|
|
134
|
+
selector: '[wrTabsRouting]',
|
|
135
|
+
exportAs: 'wrTabsRouting',
|
|
136
|
+
providers: [
|
|
137
|
+
{
|
|
138
|
+
provide: WR_TABS_ROUTING,
|
|
139
|
+
// eslint-disable-next-line @angular-eslint/no-forward-ref
|
|
140
|
+
useExisting: forwardRef(() => WrTabsRouting),
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
}]
|
|
144
|
+
}] });
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @license
|
|
148
|
+
*
|
|
149
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
150
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Generated bundle index. Do not edit.
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
export { WrTabsRouting };
|
|
158
|
+
//# sourceMappingURL=ngwr-tabs-router.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-tabs-router.mjs","sources":["../../../projects/lib/tabs/router/tabs-routing.ts","../../../projects/lib/tabs/router/public-api.ts","../../../projects/lib/tabs/router/ngwr-tabs-router.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LocationStrategy } from '@angular/common';\nimport { Directive, forwardRef, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, type IsActiveMatchOptions, NavigationEnd, Router, type UrlTree } from '@angular/router';\n\nimport { filter, map, startWith } from 'rxjs';\n\nimport { WR_TABS_ROUTING, type WrTabsRoutingAdapter } from 'ngwr/tabs';\n\n/**\n * How `routerLinkActive` matches when no `[routerLinkActiveOptions]` is given:\n * a path PREFIX, so `/settings/profile` still selects a `/settings` tab, and a\n * fragment or a matrix param never unselects one.\n */\nconst MATCH: IsActiveMatchOptions = {\n paths: 'subset',\n queryParams: 'subset',\n fragment: 'ignored',\n matrixParams: 'ignored',\n};\n\n/**\n * Router support for `<wr-tabs>`. Add it to the `imports` of the component that\n * declares a strip whose `<wr-tab>`s carry a `routerLink`:\n *\n * @example\n * ```ts\n * import { WrTab, WrTabs } from 'ngwr/tabs';\n * import { WrTabsRouting } from 'ngwr/tabs/router';\n *\n * @Component({ imports: [WrTabs, WrTab, WrTabsRouting], template: `\n * <wr-tabs wrTabsRouting>\n * <wr-tab title=\"Overview\" routerLink=\"overview\" />\n * <wr-tab title=\"Details\" routerLink=\"details\" />\n * </wr-tabs>\n * <router-outlet />\n * ` })\n * export class SettingsPage {}\n * ```\n *\n * Two mechanical edits per strip, both codemoddable: the symbol in `imports`,\n * and `wrTabsRouting` on the element. An attribute rather than a selector on\n * `wr-tabs` itself, for two reasons — where the router enters a template should\n * be visible in that template, and the sandbox's selector map keys a `wr-` tag\n * even when it is qualified, so `wr-tabs[wrTabsRouting]` would be a second claim\n * on the `wr-tabs` tag. Putting it on an ANCESTOR of the strip also works: the\n * token is read through the element injector, which walks up.\n *\n * **Why it is a separate entry point.** A directive listed in `imports: []`\n * lands in the compiled component's `dependencies` whether or not the branch of\n * the template that matches it ever runs, so `RouterLink` + `RouterLinkActive`\n * on the strip charged every CONTENT tab strip 73.9 kB of `@angular/router` —\n * 51% of what `ngwr/tabs` cost in an app that declares no routes. Measured with\n * source-map attribution against a routerless baseline. `@angular/router` is\n * already an optional peer dependency of the package; this is what makes that\n * true in bytes.\n *\n * **Why a directive rather than a provider function.** A relative `routerLink`\n * (`routerLink=\"overview\"`) resolves against the `ActivatedRoute` of the\n * component that declares the strip. A root-level provider would resolve every\n * one of them against the root route instead, and quietly build the wrong\n * hrefs; a directive on the element reads the same `ActivatedRoute` the old\n * `RouterLink` inside the strip's template did.\n */\n@Directive({\n selector: '[wrTabsRouting]',\n exportAs: 'wrTabsRouting',\n providers: [\n {\n provide: WR_TABS_ROUTING,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrTabsRouting),\n },\n ],\n})\nexport class WrTabsRouting implements WrTabsRoutingAdapter {\n private readonly router = inject(Router);\n private readonly locationStrategy = inject(LocationStrategy);\n private readonly route = inject(ActivatedRoute);\n\n /**\n * The current URL, as a signal, so `href()` and `isActive()` are reactive to\n * navigation when read from a computed. `isActive` obviously has to be; so\n * does `href`, because a RELATIVE link is resolved against the active route\n * and its target moves when the route does — which is why `RouterLink`\n * recomputes its own href on every navigation too.\n */\n private readonly url = toSignal(\n this.router.events.pipe(\n filter((e): e is NavigationEnd => e instanceof NavigationEnd),\n map(e => e.urlAfterRedirects),\n startWith(this.router.url)\n ),\n { initialValue: this.router.url }\n );\n\n href(commands: string | readonly string[]): string {\n // Read for the dependency, the same reason `isActive` does: a RELATIVE link\n // resolves against the active route, so its target moves when the route\n // does. Without this a strip inside `/users/:id` kept rendering\n // `/users/1/profile` after navigating to user 2 — the click still routed,\n // because `navigate()` rebuilds the tree, but the visible href pointed at\n // the previous user. The docblock above already promised this; the code did\n // not do it.\n this.url();\n\n // `prepareExternalUrl`, not a bare `serializeUrl`, because that is what\n // `RouterLink` writes and the href exists precisely so the BROWSER can use\n // it. Under `withHashLocation()` a serialized `/one` renders as an href the\n // app does not serve: a plain click survives (`navigateByUrl` ignores the\n // strategy and `preventDefault` stops the bad navigation) but cmd-click,\n // middle-click, \"open in new tab\" and \"copy link address\" all take the href\n // at face value — the four things rendering one is for. A `--base-href` is\n // the same defect by another door.\n return this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.tree(commands)));\n }\n\n isActive(commands: string | readonly string[]): boolean {\n // Read for the dependency, not for the value: `isActive` asks the router,\n // which is not a signal, so without this the computed that calls it would\n // never recompute and the strip would announce its first selection forever.\n this.url();\n return this.router.isActive(this.tree(commands), MATCH);\n }\n\n navigate(commands: string | readonly string[], event: MouseEvent): void {\n // Exactly the guard `RouterLink` applies: a middle click, or any click with\n // a modifier held, belongs to the browser — preventing it would make a tab\n // the one link on the page that cannot be opened in a new window.\n if (event.button !== 0 || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;\n event.preventDefault();\n void this.router.navigateByUrl(this.tree(commands));\n }\n\n private tree(commands: string | readonly string[]): UrlTree {\n // A bare string is one command, the way `[routerLink]=\"'overview'\"` is —\n // spread as characters it would navigate to `/o/v/e/r/v/i/e/w`.\n const segments = typeof commands === 'string' ? [commands] : [...commands];\n return this.router.createUrlTree(segments, { relativeTo: this.route });\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport { WrTabsRouting } from './tabs-routing';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;AAKG;AAWH;;;;AAIG;AACH,MAAM,KAAK,GAAyB;AAClC,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,WAAW,EAAE,QAAQ;AACrB,IAAA,QAAQ,EAAE,SAAS;AACnB,IAAA,YAAY,EAAE,SAAS;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CG;MAYU,aAAa,CAAA;AACP,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC3C,IAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAE/C;;;;;;AAMG;IACc,GAAG,GA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IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACxE;uGAhEW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,SAAA,EARb;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;;AAExB,gBAAA,WAAW,EAAE,UAAU,CAAC,MAAM,aAAa,CAAC;AAC7C,aAAA;AACF,SAAA,EAAA,QAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAEU,aAAa,EAAA,UAAA,EAAA,CAAA;kBAXzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,eAAe;;AAExB,4BAAA,WAAW,EAAE,UAAU,CAAC,mBAAmB,CAAC;AAC7C,yBAAA;AACF,qBAAA;AACF,iBAAA;;;ACjFD;;;;;AAKG;;ACLH;;AAEG;;;;"}
|
|
@@ -65,7 +65,7 @@ class WrTabHarness extends ContentContainerComponentHarness {
|
|
|
65
65
|
*
|
|
66
66
|
* `aria-selected` first, because that is the state a screen reader acts on and
|
|
67
67
|
* the `--active` class is only what it looks like. Both shapes carry it now — a
|
|
68
|
-
* router tab publishes it off the same `
|
|
68
|
+
* router tab publishes it off the same `routerActive()` that paints the class —
|
|
69
69
|
* so the class is a fallback for a tab that has neither yet, not a second reading
|
|
70
70
|
* of the same thing. The order is not interchangeable: reading the class first
|
|
71
71
|
* would report a tab as selected while `aria-selected="false"` told assistive tech
|
|
@@ -177,11 +177,11 @@ class WrTabHarness extends ContentContainerComponentHarness {
|
|
|
177
177
|
* Activate this tab the way a pointer does.
|
|
178
178
|
*
|
|
179
179
|
* A disabled CONTENT tab is left alone: it is a real `<button disabled>`, which
|
|
180
|
-
* fires no click at all. A disabled ROUTER tab is
|
|
181
|
-
* `aria-disabled="true"` and `tabindex="-1"
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* on the resolved route rather than on the click.
|
|
180
|
+
* fires no click at all. A disabled ROUTER tab is an `<a>`, where `disabled` is
|
|
181
|
+
* not a thing — it carries `aria-disabled="true"` and `tabindex="-1"` to stay off
|
|
182
|
+
* the keyboard path, renders NO href, and the component drops the click rather
|
|
183
|
+
* than routing it. So the click lands and nothing moves, which is why a router
|
|
184
|
+
* strip's expectations belong on the resolved route rather than on the click.
|
|
185
185
|
*/
|
|
186
186
|
async click() {
|
|
187
187
|
return (await this.host()).click();
|
|
@@ -268,7 +268,7 @@ class WrTabHarness extends ContentContainerComponentHarness {
|
|
|
268
268
|
* renders exactly one panel: the selected tab's.
|
|
269
269
|
* - **Router** — one `routerLink` on any child switches the whole strip over. The
|
|
270
270
|
* tabs become `<a role="tab">`s whose `aria-selected` follows the resolved route
|
|
271
|
-
* (the same `
|
|
271
|
+
* (the same `routerActive()` that paints `--active`), the strip renders NO
|
|
272
272
|
* panel, and it stops being one tab stop — every enabled tab is a Tab stop of its
|
|
273
273
|
* own. The arrow keys still move focus, but they select nothing: the route does
|
|
274
274
|
* that.
|
|
@@ -416,9 +416,11 @@ class WrTabsHarness extends ComponentHarness {
|
|
|
416
416
|
*
|
|
417
417
|
* A router strip is otherwise fine here: the click starts a route change, the
|
|
418
418
|
* harness stabilizes the pending navigation before it re-reads the strip, and
|
|
419
|
-
* `
|
|
420
|
-
* guard, a redirect or an unmatched path that leaves the tab unselected.
|
|
421
|
-
*
|
|
419
|
+
* `routerActive()` has painted the selection by then — so this resolves. It is a
|
|
420
|
+
* guard, a redirect or an unmatched path that leaves the tab unselected. A
|
|
421
|
+
* DISABLED router tab is a different shape and no longer navigates: it renders
|
|
422
|
+
* no href and the component drops the click, so the click lands and nothing
|
|
423
|
+
* moves — see {@link WrTabHarness.click}.
|
|
422
424
|
*/
|
|
423
425
|
async select(filters) {
|
|
424
426
|
const [tab] = await this.getTabs(filters);
|
|
@@ -583,7 +585,7 @@ class WrTabsHarness extends ComponentHarness {
|
|
|
583
585
|
throw new Error(`WrTabsHarness.${method}(): "${await tab.getLabel()}" is still unselected after being clicked — ` +
|
|
584
586
|
'either it is a content tab carrying `disabled`, which fires no click at all, or this is a router ' +
|
|
585
587
|
'strip whose navigation did not land on this tab: a guard, a redirect or an unmatched path leaves ' +
|
|
586
|
-
'`
|
|
588
|
+
'`routerActive()` painting some other one.');
|
|
587
589
|
}
|
|
588
590
|
/**
|
|
589
591
|
* Send a key to the `role="tablist"` strip.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-tabs-testing.mjs","sources":["../../../projects/lib/tabs/testing/wr-tab-harness.ts","../../../projects/lib/tabs/testing/wr-tabs-harness.ts","../../../projects/lib/tabs/testing/ngwr-tabs-testing.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrTabHarnessFilters } from './interfaces';\n\n/**\n * Test harness for one tab of a `<wr-tabs>` strip — the header, and the panel it\n * controls.\n *\n * Its host is the RENDERED HEADER, not the `<wr-tab>` element. A `<wr-tab>` is\n * `display:none` and holds nothing but a `<ng-template>`: the label, the selection\n * state, the tab stop and the click target all live on the element the parent\n * renders for it, which is a `<button role=\"tab\">` in content mode and an\n * `<a role=\"tab\">` in router mode. A harness hosted on `wr-tab` would answer every\n * question with nothing.\n *\n * Also a CONTENT CONTAINER, scoped to the panel this tab controls, so\n * `tab.getHarness(WrButtonHarness…)` reaches the consumer's own components inside\n * the tab's content. The panel is not a descendant of the header — it is a sibling\n * of the whole strip — so it is resolved through the `aria-controls` id, which is\n * also the pairing {@link isPanelBound} checks. Only the SELECTED tab has a panel\n * to reach: `<wr-tabs>` renders one panel and destroys it on every switch.\n *\n * @example\n * ```ts\n * const tabs = await loader.getHarness(WrTabsHarness);\n * const [first] = await tabs.getTabs();\n *\n * expect(await first.isSelected()).toBe(true);\n * expect(await first.isPanelBound()).toBe(true);\n * await (await first.getHarness(WrButtonHarness.with({ text: 'Save' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTabHarness extends ContentContainerComponentHarness {\n /** The header the strip renders for a `<wr-tab>` — a `<button>`, or an `<a>` in router mode. */\n static hostSelector = '.wr-tabs__tab';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTabHarnessFilters = {}): HarnessPredicate<WrTabHarness> {\n return new HarnessPredicate(WrTabHarness, options)\n .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))\n .addOption('selected', options.selected, async (harness, selected) => (await harness.isSelected()) === selected)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /** The tab's visible label, trimmed — the `<wr-tab>`'s `title`. */\n async getLabel(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * The header's own id, which is what the panel points back at with\n * `aria-labelledby` — the tab is the panel's accessible name.\n *\n * Generated from the tab's `key`, so two strips on one page whose tabs share keys\n * publish the same ids and each panel then names whichever header came first.\n */\n async getId(): Promise<string | null> {\n return (await this.host()).getAttribute('id');\n }\n\n /**\n * Whether this is the strip's selected tab.\n *\n * `aria-selected` first, because that is the state a screen reader acts on and\n * the `--active` class is only what it looks like. Both shapes carry it now — a\n * router tab publishes it off the same `routerLinkActive` that paints the class —\n * so the class is a fallback for a tab that has neither yet, not a second reading\n * of the same thing. The order is not interchangeable: reading the class first\n * would report a tab as selected while `aria-selected=\"false\"` told assistive tech\n * otherwise.\n */\n async isSelected(): Promise<boolean> {\n const host = await this.host();\n const selected = await host.getAttribute('aria-selected');\n if (selected !== null) return selected === 'true';\n return host.hasClass('wr-tabs__tab--active');\n }\n\n /**\n * Whether the tab refuses activation.\n *\n * The two shapes say it differently and both are read: a content tab is a real\n * `<button>` and carries the native `disabled`, a router tab is an `<a>` — which\n * cannot be disabled natively — and carries `aria-disabled` with `tabindex=\"-1\"`.\n * The `--disabled` class is on both and is deliberately not the source: a class\n * says how the tab looks, these two say what it refuses.\n */\n async isDisabled(): Promise<boolean> {\n const host = await this.host();\n if ((await host.getAttribute('aria-disabled')) === 'true') return true;\n return (await host.getProperty<boolean | undefined>('disabled')) === true;\n }\n\n /** Whether this tab is a link — the router shape, where selection follows the route. */\n async isLink(): Promise<boolean> {\n return (await this.host()).matchesSelector('a');\n }\n\n /**\n * The resolved href of a router tab, or `null` for a content tab.\n *\n * `null` is the answer for a `<button>` rather than a gap — a content tab\n * navigates nowhere, it swaps a panel.\n */\n async getHref(): Promise<string | null> {\n return (await this.host()).getAttribute('href');\n }\n\n /**\n * Whether a Tab press can land on this header.\n *\n * A content strip is ONE tab stop and hands it to the selected tab; a router\n * strip makes every enabled tab a stop of its own. See\n * `WrTabsHarness.getTabStopLabels()` — the difference is a mode difference, not\n * a rounding error.\n *\n * A non-negative `tabindex` is not enough on its own, which is why `disabled` is\n * read too: `<wr-tabs>` gives the roving `tabindex=\"0\"` to whatever `active`\n * names without checking whether that tab is disabled, so a host binding `active`\n * to a disabled tab's key renders a `<button disabled tabindex=\"0\">` — which no\n * Tab press reaches. jsdom will focus such a button anyway, so this is the only\n * place a unit test can tell the difference.\n */\n async isTabStop(): Promise<boolean> {\n if (await this.isDisabled()) return false;\n const tabIndex = await (await this.host()).getAttribute('tabindex');\n return Number.parseInt(tabIndex ?? '-1', 10) >= 0;\n }\n\n /**\n * The id of the panel this tab controls, or `null` when it controls none.\n *\n * `null` for a router tab — the strip renders no panel in that mode, the consumer\n * drops a `<router-outlet>` after it — and that missing `aria-controls` is the\n * honest report: there is nothing for the header to point at.\n */\n async getPanelId(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-controls');\n }\n\n /** Whether this tab's panel is in the DOM right now — true only for the selected tab. */\n async hasPanel(): Promise<boolean> {\n return (await this.panelOrNull()) !== null;\n }\n\n /**\n * Whether the panel and this header really name each other.\n *\n * Both halves, because each covers a different failure: the header's\n * `aria-controls` has to reach the panel that is showing, and the panel's\n * `aria-labelledby` has to come back to THIS header. A panel wired to the wrong\n * tab looks perfect on screen — the right content is under the right header — and\n * announces the wrong name, which is the whole of a tabbed interface for anyone\n * not looking at it. It also has to be a `tabpanel`: the reference resolving to\n * some other element is a broken pairing, not a styling detail.\n *\n * Throws when there is no panel at all, which is a different fact from a broken\n * pairing — see {@link getPanelText}.\n */\n async isPanelBound(): Promise<boolean> {\n const panel = await this.panelOrThrow('isPanelBound');\n if ((await panel.getAttribute('role')) !== 'tabpanel') return false;\n return (await panel.getAttribute('aria-labelledby')) === (await this.getId());\n }\n\n /**\n * The text of this tab's panel, trimmed.\n *\n * Throws rather than answering `''` for a tab whose panel is not rendered, and\n * the message says which of the two reasons it is: `<wr-tabs>` keeps only the\n * selected tab's panel in the DOM (the content of every other tab sits in an\n * unrendered `<ng-template>`, so switching tabs destroys a panel and builds the\n * next one), and a router strip renders no panel at all.\n */\n async getPanelText(): Promise<string> {\n return (await this.panelOrThrow('getPanelText')).text();\n }\n\n /**\n * Activate this tab the way a pointer does.\n *\n * A disabled CONTENT tab is left alone: it is a real `<button disabled>`, which\n * fires no click at all. A disabled ROUTER tab is NOT — the anchor carries\n * `aria-disabled=\"true\"` and `tabindex=\"-1\"`, and nothing cancels its\n * `routerLink`, so a click on it still navigates. That is a gap in the component\n * rather than in this harness, and it is why a router strip's expectations belong\n * on the resolved route rather than on the click.\n */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move keyboard focus onto this header. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Take focus off this header. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether this header holds keyboard focus — the roving cursor, not the selection. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** `getHarness(…)` searches this tab's PANEL, which is where its content is. */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n // Both checks, in this order, so the failure names the reason — no panel in this\n // mode, or a panel that is not the one showing — instead of the CDK's generic\n // \"no element matching selector\".\n const id = await this.panelIdOrThrow('getHarness');\n await this.panelOrThrow('getHarness');\n return this.documentRootLocatorFactory().harnessLoaderFor(WrTabHarness.byId(id));\n }\n\n /** The panel element, or `null` when this tab has none rendered. */\n private async panelOrNull(): Promise<TestElement | null> {\n const id = await this.getPanelId();\n if (id === null) return null;\n // From the document root: the panel is a sibling of the strip, not a descendant\n // of the header this harness is hosted on.\n return this.documentRootLocatorFactory().locatorForOptional(WrTabHarness.byId(id))();\n }\n\n /** The panel element, or a failure naming which of the two reasons there isn't one. */\n private async panelOrThrow(method: string): Promise<TestElement> {\n await this.panelIdOrThrow(method);\n const panel = await this.panelOrNull();\n if (!panel) {\n throw new Error(\n `WrTabHarness.${method}(): the panel for \"${await this.getLabel()}\" is not rendered. <wr-tabs> keeps ` +\n 'only the SELECTED panel in the DOM — the content of every other tab waits in an unrendered ' +\n '<ng-template> — so select the tab first.'\n );\n }\n return panel;\n }\n\n /** This tab's `aria-controls`, or a failure saying a router strip has no panels. */\n private async panelIdOrThrow(method: string): Promise<string> {\n const id = await this.getPanelId();\n if (id === null) {\n throw new Error(\n `WrTabHarness.${method}(): \"${await this.getLabel()}\" controls no panel. A router strip renders none ` +\n '— its tabs navigate and the consumer drops a <router-outlet> after the strip — so assert the ' +\n 'routed content instead.'\n );\n }\n return id;\n }\n\n /**\n * An id selector that survives the id it is given.\n *\n * `[id=\"…\"]` rather than `#…`: the ids here are built from the consumer's `key`,\n * and a key holding a dot, a colon or a leading digit turns `#id` into a selector\n * that either throws or matches something else entirely.\n */\n private static byId(id: string): string {\n return `[id=\"${id}\"]`;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrTabHarnessFilters, WrTabsHarnessFilters, WrTabsHarnessSize } from './interfaces';\nimport { WrTabHarness } from './wr-tab-harness';\n\n/**\n * Test harness for `<wr-tabs>`, with {@link WrTabHarness} for one tab and the panel\n * it controls.\n *\n * The component has two modes and they answer \"which tab is active\" differently,\n * which is most of what this harness exists to keep straight:\n *\n * - **Content** — the tabs are `<button role=\"tab\">`s, the strip is ONE tab stop\n * (the roving `tabindex` sits on the selected tab), and the arrow keys ACTIVATE\n * the tab they move to, the APG's automatic-activation pattern. `<wr-tabs>`\n * renders exactly one panel: the selected tab's.\n * - **Router** — one `routerLink` on any child switches the whole strip over. The\n * tabs become `<a role=\"tab\">`s whose `aria-selected` follows the resolved route\n * (the same `routerLinkActive` that paints `--active`), the strip renders NO\n * panel, and it stops being one tab stop — every enabled tab is a Tab stop of its\n * own. The arrow keys still move focus, but they select nothing: the route does\n * that.\n *\n * So {@link getSelectedLabel} and {@link getFocusedLabel} are two different\n * questions, and {@link getTabStopLabels} is a third. They coincide in content mode\n * and come apart in router mode; a spec that asserts one and means another passes\n * through the bug.\n *\n * Everything here is driven from the KEYBOARD rather than by clicking a coordinate:\n * a unit test has no layout, so a hit test would answer with nothing, and the\n * keyboard is the accessible path anyway. {@link select} is the exception — a\n * no-arg click needs no coordinate.\n *\n * @example\n * ```ts\n * const tabs = await loader.getHarness(WrTabsHarness);\n *\n * expect(await tabs.getTabLabels()).toEqual(['One', 'Two', 'Three']);\n * await tabs.select({ label: 'Two' });\n * expect(await tabs.getPanelText()).toContain('Second panel');\n * ```\n *\n * @see https://ngwr.dev/reference/components/tabs\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTabsHarness extends ComponentHarness {\n static hostSelector = 'wr-tabs';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTabsHarnessFilters = {}): HarnessPredicate<WrTabsHarness> {\n return new HarnessPredicate(WrTabsHarness, options)\n .addOption('tabLabel', options.tabLabel, async (harness, label) => {\n for (const tab of await harness.getTabLabels()) {\n if (await HarnessPredicate.stringMatches(tab, label)) return true;\n }\n return false;\n })\n .addOption('selectedLabel', options.selectedLabel, async (harness, label) => {\n const selected = await harness.getSelectedLabel();\n return selected === null ? false : HarnessPredicate.stringMatches(selected, label);\n })\n .addOption('size', options.size, async (harness, size) => (await harness.getSize()) === size)\n .addOption('router', options.router, async (harness, router) => (await harness.isRouterMode()) === router);\n }\n\n /**\n * The role the strip announces — `tablist`.\n *\n * Read off the strip, not the host: `<wr-tabs>` carries the `wr-tabs` class and no\n * role of its own, and the `tablist` is the scrolling `.wr-tabs__strip` inside it.\n * Without that role the headers are a row of buttons: nothing tells a screen\n * reader how many tabs there are or which one of them is showing.\n */\n async getRole(): Promise<string | null> {\n return (await this.strip()).getAttribute('role');\n }\n\n /**\n * The axis the strip announces, which decides which arrow keys a screen-reader\n * user is told to press.\n *\n * `<wr-tabs>` ships one orientation — the strip is a horizontal scroller and hard\n * codes `aria-orientation=\"horizontal\"` — so today this always answers\n * `'horizontal'`. It is read from the DOM and normalized the way ARIA reads it:\n * anything that is not `vertical`, a missing attribute included, is `'horizontal'`,\n * the default for a `tablist`.\n *\n * Which means an assertion here catches a strip that starts ANNOUNCING `vertical`\n * while its arrow keys still walk the horizontal axis — and cannot catch the\n * mirror image, a vertical mode that forgets to update the attribute: that one\n * answers `'horizontal'` and looks unchanged. One attribute is all this reads.\n */\n async getOrientation(): Promise<'horizontal' | 'vertical'> {\n return (await (await this.strip()).getAttribute('aria-orientation')) === 'vertical' ? 'vertical' : 'horizontal';\n }\n\n /**\n * The size the strip renders at, from the host modifier.\n *\n * `md` is the default and paints no modifier of its own, so its absence is the\n * answer rather than a missing one.\n */\n async getSize(): Promise<WrTabsHarnessSize> {\n const host = await this.host();\n if (await host.hasClass('wr-tabs--sm')) return 'sm';\n if (await host.hasClass('wr-tabs--lg')) return 'lg';\n return 'md';\n }\n\n /**\n * Whether this strip navigates instead of swapping panels.\n *\n * Derived from what got RENDERED — a router tab is an `<a>` — rather than from the\n * `routerLink` inputs, because the switch is all-or-nothing: one `routerLink`\n * anywhere in the strip turns every tab into a link and drops the panel. A strip\n * with no tabs at all is content mode, which is what the component does with it.\n */\n async isRouterMode(): Promise<boolean> {\n const tabs = await this.getTabs();\n for (const tab of tabs) {\n if (await tab.isLink()) return true;\n }\n return false;\n }\n\n /**\n * This strip's tabs, in render order.\n *\n * Scoped to this strip rather than to the host, which is what keeps a `<wr-tabs>`\n * NESTED in a panel from answering for its parent: the inner strip is a descendant\n * of the outer host, so a host-wide query would hand back both sets of tabs as one\n * flat list.\n */\n async getTabs(filters: WrTabHarnessFilters = {}): Promise<WrTabHarness[]> {\n return (await this.stripLoader()).getAllHarnesses(WrTabHarness.with(filters));\n }\n\n /** The label of every tab, in render order. */\n async getTabLabels(): Promise<string[]> {\n const tabs = await this.getTabs();\n return Promise.all(tabs.map(tab => tab.getLabel()));\n }\n\n /**\n * The selected tab, or `null` when none is.\n *\n * A content strip always has one — it falls back to the first tab when `active`\n * matches nothing — so `null` means a router strip whose current route matches no\n * tab, or a strip with no tabs.\n */\n async getSelectedTab(): Promise<WrTabHarness | null> {\n const [selected] = await this.getTabs({ selected: true });\n return selected ?? null;\n }\n\n /** The label of the selected tab, or `null` when none is selected. */\n async getSelectedLabel(): Promise<string | null> {\n const selected = await this.getSelectedTab();\n return selected ? selected.getLabel() : null;\n }\n\n /**\n * Select the first tab matching the filters, the way a pointer does.\n *\n * Throws when nothing matches, naming the tabs that do exist, and throws again\n * when the tab is still unselected afterwards — with both causes named, because a\n * click that quietly did nothing surfaces as an unrelated assertion three lines\n * later. Those causes are a disabled CONTENT tab (a `<button disabled>` never sees\n * the click at all) and a router strip whose navigation did not land on this tab.\n *\n * A router strip is otherwise fine here: the click starts a route change, the\n * harness stabilizes the pending navigation before it re-reads the strip, and\n * `routerLinkActive` has painted the selection by then — so this resolves. It is a\n * guard, a redirect or an unmatched path that leaves the tab unselected. Note that\n * `disabled` does not stop a router tab at all; see {@link WrTabHarness.click}.\n */\n async select(filters: WrTabHarnessFilters): Promise<void> {\n const [tab] = await this.getTabs(filters);\n if (!tab) {\n const labels = await this.getTabLabels();\n const offered =\n labels.length > 0 ? `This strip offers: ${labels.join(', ')}.` : 'This strip renders no tabs at all.';\n throw new Error(`WrTabsHarness.select(): no tab matched ${JSON.stringify(filters)}. ${offered}`);\n }\n await this.activate(tab, 'select');\n }\n\n /**\n * Select the tab at this position in render order, counting from 0.\n *\n * Throws on an index the strip does not have, naming its length: a silent no-op\n * there reads as \"the tab did not react\" when the tab was never addressed.\n */\n async selectByIndex(index: number): Promise<void> {\n const tabs = await this.getTabs();\n const tab = tabs[index];\n if (!tab) {\n throw new Error(\n `WrTabsHarness.selectByIndex(): this strip has ${tabs.length} tab(s), so index ${index} is out of ` +\n 'range — they are numbered from 0 in render order.'\n );\n }\n await this.activate(tab, 'selectByIndex');\n }\n\n /**\n * The labels of every tab a Tab press can land on, in render order.\n *\n * A LIST rather than one label, because the count is the mode: a content strip\n * roves a single `tabindex=\"0\"` and answers with exactly one label — the selected\n * tab — while a router strip makes every enabled tab its own stop and answers with\n * all of them. Either way a disabled tab is never in here.\n */\n async getTabStopLabels(): Promise<string[]> {\n const labels: string[] = [];\n for (const tab of await this.getTabs()) {\n if (await tab.isTabStop()) labels.push(await tab.getLabel());\n }\n return labels;\n }\n\n /**\n * Whether the strip is a single tab stop — the roving-`tabindex` pattern the APG\n * asks a `tablist` for.\n *\n * True for a content strip, false for a router one, which puts every enabled tab\n * in the page tab order. A strip whose every tab is disabled has no stop at all\n * and answers `true`: nothing to rove, and Tab skips it.\n */\n async isRoving(): Promise<boolean> {\n return (await this.getTabStopLabels()).length <= 1;\n }\n\n /**\n * The label of the tab holding keyboard focus, or `null` when focus is elsewhere.\n *\n * The other answer to \"which tab is active\", and not the same as\n * {@link getSelectedLabel}: the arrow keys move this. In content mode they also\n * select what they land on, so the two stay together; in router mode focus walks\n * the strip while the selection stays on whatever the route resolved to.\n */\n async getFocusedLabel(): Promise<string | null> {\n for (const tab of await this.getTabs()) {\n if (await tab.isFocused()) return tab.getLabel();\n }\n return null;\n }\n\n /**\n * Put focus where a Tab press would put it — the first tab stop in render order.\n *\n * That is the selected tab in content mode, and the first enabled tab in a router\n * strip. Throws when the strip has no stop at all, because Tab then skips past it\n * rather than entering it — a content strip whose selected tab is disabled has\n * none, and neither has one whose every tab is disabled, or one with no tabs.\n */\n async focusTabStop(): Promise<void> {\n for (const tab of await this.getTabs()) {\n if (await tab.isTabStop()) {\n await tab.focus();\n return;\n }\n }\n\n throw new Error(\n 'WrTabsHarness.focusTabStop(): this strip has no tab stop — its selected tab is disabled, every tab ' +\n 'is disabled, or it renders no tabs — so Tab skips it rather than entering it.'\n );\n }\n\n /**\n * ArrowRight on the strip — one tab toward the visual RIGHT, wrapping at the end\n * and skipping disabled tabs.\n *\n * The physical key, because that is what a keyboard has. The component follows\n * visual order per the APG, so under `dir=\"rtl\"` this moves to the PREVIOUS tab —\n * a spec exercising a mirrored strip swaps this and {@link pressArrowLeft}.\n *\n * In content mode the tab it lands on is also SELECTED (automatic activation); in\n * router mode only focus moves.\n */\n async pressArrowRight(): Promise<void> {\n await this.press(TestKey.RIGHT_ARROW);\n }\n\n /** ArrowLeft on the strip — one tab toward the visual LEFT, mirrored under `dir=\"rtl\"`. */\n async pressArrowLeft(): Promise<void> {\n await this.press(TestKey.LEFT_ARROW);\n }\n\n /**\n * Home on the strip — the FIRST enabled tab.\n *\n * Home and End name a position in the tab list rather than an edge of the strip,\n * so unlike the arrows they read the same in both reading directions.\n */\n async pressHome(): Promise<void> {\n await this.press(TestKey.HOME);\n }\n\n /** End on the strip — the LAST enabled tab, in both reading directions. */\n async pressEnd(): Promise<void> {\n await this.press(TestKey.END);\n }\n\n /** Whether this strip is showing a panel at all — false for a router strip. */\n async hasPanel(): Promise<boolean> {\n const selected = await this.getSelectedTab();\n return selected === null ? false : selected.hasPanel();\n }\n\n /**\n * The text of the panel that is showing, trimmed — the selected tab's content, and\n * the only tab content in the DOM.\n *\n * Throws when nothing is selected. Delegates to the selected tab, so the panel it\n * reads is the one that tab's `aria-controls` points at rather than \"the first\n * `.wr-tabs__panel` around\" — the two are only the same page when the wiring is\n * right, and {@link WrTabHarness.isPanelBound} is what says whether it is.\n */\n async getPanelText(): Promise<string> {\n const selected = await this.getSelectedTab();\n if (!selected) {\n throw new Error(\n 'WrTabsHarness.getPanelText(): no tab is selected, so no panel is rendered. A router strip whose ' +\n 'route matches none of its tabs looks like this, as does a strip with no tabs.'\n );\n }\n return selected.getPanelText();\n }\n\n /**\n * Which edges of the strip are faded out, from the public `--fade-start` /\n * `--fade-end` host modifiers — the cue that there are more tabs than fit, on the\n * side they are on.\n *\n * The component computes these from the strip's scroll metrics, so in a unit test\n * both are always `false`: jsdom lays nothing out, every element measures 0x0, and\n * a strip that never overflows never fades. Assert this in a real browser, or\n * declare the metrics and dispatch a `scroll` the way the component's own spec\n * does.\n */\n async getFades(): Promise<{ start: boolean; end: boolean }> {\n const host = await this.host();\n return {\n start: await host.hasClass('wr-tabs--fade-start'),\n end: await host.hasClass('wr-tabs--fade-end'),\n };\n }\n\n /** Click a tab and check it took, or say which of the two reasons it did not. */\n private async activate(tab: WrTabHarness, method: string): Promise<void> {\n await tab.click();\n if (await tab.isSelected()) return;\n\n throw new Error(\n `WrTabsHarness.${method}(): \"${await tab.getLabel()}\" is still unselected after being clicked — ` +\n 'either it is a content tab carrying `disabled`, which fires no click at all, or this is a router ' +\n 'strip whose navigation did not land on this tab: a guard, a redirect or an unmatched path leaves ' +\n '`routerLinkActive` painting some other one.'\n );\n }\n\n /**\n * Send a key to the `role=\"tablist\"` strip.\n *\n * The strip owns the keydown handler, and a real user's keypress on the focused\n * header bubbles to exactly here — so this is the honest target, and the one that\n * still works when jsdom has left real focus on `<body>`. It is also the target\n * that leaves the headers alone: the CDK types into whatever element it is handed,\n * which on a `<button>` means writing a `value` attribute onto a tab.\n */\n private async press(key: TestKey): Promise<void> {\n await (await this.strip()).sendKeys(key);\n }\n\n /** This strip's own `role=\"tablist\"` element — the first one under the host. */\n private async strip(): Promise<TestElement> {\n return this.locatorFor('.wr-tabs__strip')();\n }\n\n /**\n * A loader rooted at this strip, so tab queries cannot reach a nested strip's tabs:\n * a nested `<wr-tabs>` lives in the PANEL, which is outside this element.\n */\n private async stripLoader(): Promise<HarnessLoader> {\n return this.locatorFactory.harnessLoaderFor('.wr-tabs__strip');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAWH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;AACG,MAAO,YAAa,SAAQ,gCAAgC,CAAA;;AAEhE,IAAA,OAAO,YAAY,GAAG,eAAe;;AAGrC,IAAA,OAAO,IAAI,CAAC,OAAA,GAA+B,EAAE,EAAA;AAC3C,QAAA,OAAO,IAAI,gBAAgB,CAAC,YAAY,EAAE,OAAO;aAC9C,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC;aAC/G,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC,MAAM,OAAO,CAAC,UAAU,EAAE,MAAM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,YAAA,KAAK,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;AACjD,YAAA,GAAG,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;SAC9C;IACH;;AAGQ,IAAA,MAAM,QAAQ,CAAC,GAAiB,EAAE,MAAc,EAAA;AACtD,QAAA,MAAM,GAAG,CAAC,KAAK,EAAE;AACjB,QAAA,IAAI,MAAM,GAAG,CAAC,UAAU,EAAE;YAAE;QAE5B,MAAM,IAAI,KAAK,CACb,CAAA,cAAA,EAAiB,MAAM,CAAA,KAAA,EAAQ,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAA,4CAAA,CAA8C;YAC/F,mGAAmG;YACnG,mGAAmG;AACnG,YAAA,6CAA6C,CAChD;IACH;AAEA;;;;;;;;AAQG;IACK,MAAM,KAAK,CAAC,GAAY,EAAA;AAC9B,QAAA,MAAM,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC;IAC1C;;AAGQ,IAAA,MAAM,KAAK,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;IAC7C;AAEA;;;AAGG;AACK,IAAA,MAAM,WAAW,GAAA;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;IAChE;;;AChZF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-tabs-testing.mjs","sources":["../../../projects/lib/tabs/testing/wr-tab-harness.ts","../../../projects/lib/tabs/testing/wr-tabs-harness.ts","../../../projects/lib/tabs/testing/ngwr-tabs-testing.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ContentContainerComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrTabHarnessFilters } from './interfaces';\n\n/**\n * Test harness for one tab of a `<wr-tabs>` strip — the header, and the panel it\n * controls.\n *\n * Its host is the RENDERED HEADER, not the `<wr-tab>` element. A `<wr-tab>` is\n * `display:none` and holds nothing but a `<ng-template>`: the label, the selection\n * state, the tab stop and the click target all live on the element the parent\n * renders for it, which is a `<button role=\"tab\">` in content mode and an\n * `<a role=\"tab\">` in router mode. A harness hosted on `wr-tab` would answer every\n * question with nothing.\n *\n * Also a CONTENT CONTAINER, scoped to the panel this tab controls, so\n * `tab.getHarness(WrButtonHarness…)` reaches the consumer's own components inside\n * the tab's content. The panel is not a descendant of the header — it is a sibling\n * of the whole strip — so it is resolved through the `aria-controls` id, which is\n * also the pairing {@link isPanelBound} checks. Only the SELECTED tab has a panel\n * to reach: `<wr-tabs>` renders one panel and destroys it on every switch.\n *\n * @example\n * ```ts\n * const tabs = await loader.getHarness(WrTabsHarness);\n * const [first] = await tabs.getTabs();\n *\n * expect(await first.isSelected()).toBe(true);\n * expect(await first.isPanelBound()).toBe(true);\n * await (await first.getHarness(WrButtonHarness.with({ text: 'Save' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTabHarness extends ContentContainerComponentHarness {\n /** The header the strip renders for a `<wr-tab>` — a `<button>`, or an `<a>` in router mode. */\n static hostSelector = '.wr-tabs__tab';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTabHarnessFilters = {}): HarnessPredicate<WrTabHarness> {\n return new HarnessPredicate(WrTabHarness, options)\n .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))\n .addOption('selected', options.selected, async (harness, selected) => (await harness.isSelected()) === selected)\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);\n }\n\n /** The tab's visible label, trimmed — the `<wr-tab>`'s `title`. */\n async getLabel(): Promise<string> {\n return (await this.host()).text();\n }\n\n /**\n * The header's own id, which is what the panel points back at with\n * `aria-labelledby` — the tab is the panel's accessible name.\n *\n * Generated from the tab's `key`, so two strips on one page whose tabs share keys\n * publish the same ids and each panel then names whichever header came first.\n */\n async getId(): Promise<string | null> {\n return (await this.host()).getAttribute('id');\n }\n\n /**\n * Whether this is the strip's selected tab.\n *\n * `aria-selected` first, because that is the state a screen reader acts on and\n * the `--active` class is only what it looks like. Both shapes carry it now — a\n * router tab publishes it off the same `routerActive()` that paints the class —\n * so the class is a fallback for a tab that has neither yet, not a second reading\n * of the same thing. The order is not interchangeable: reading the class first\n * would report a tab as selected while `aria-selected=\"false\"` told assistive tech\n * otherwise.\n */\n async isSelected(): Promise<boolean> {\n const host = await this.host();\n const selected = await host.getAttribute('aria-selected');\n if (selected !== null) return selected === 'true';\n return host.hasClass('wr-tabs__tab--active');\n }\n\n /**\n * Whether the tab refuses activation.\n *\n * The two shapes say it differently and both are read: a content tab is a real\n * `<button>` and carries the native `disabled`, a router tab is an `<a>` — which\n * cannot be disabled natively — and carries `aria-disabled` with `tabindex=\"-1\"`.\n * The `--disabled` class is on both and is deliberately not the source: a class\n * says how the tab looks, these two say what it refuses.\n */\n async isDisabled(): Promise<boolean> {\n const host = await this.host();\n if ((await host.getAttribute('aria-disabled')) === 'true') return true;\n return (await host.getProperty<boolean | undefined>('disabled')) === true;\n }\n\n /** Whether this tab is a link — the router shape, where selection follows the route. */\n async isLink(): Promise<boolean> {\n return (await this.host()).matchesSelector('a');\n }\n\n /**\n * The resolved href of a router tab, or `null` for a content tab.\n *\n * `null` is the answer for a `<button>` rather than a gap — a content tab\n * navigates nowhere, it swaps a panel.\n */\n async getHref(): Promise<string | null> {\n return (await this.host()).getAttribute('href');\n }\n\n /**\n * Whether a Tab press can land on this header.\n *\n * A content strip is ONE tab stop and hands it to the selected tab; a router\n * strip makes every enabled tab a stop of its own. See\n * `WrTabsHarness.getTabStopLabels()` — the difference is a mode difference, not\n * a rounding error.\n *\n * A non-negative `tabindex` is not enough on its own, which is why `disabled` is\n * read too: `<wr-tabs>` gives the roving `tabindex=\"0\"` to whatever `active`\n * names without checking whether that tab is disabled, so a host binding `active`\n * to a disabled tab's key renders a `<button disabled tabindex=\"0\">` — which no\n * Tab press reaches. jsdom will focus such a button anyway, so this is the only\n * place a unit test can tell the difference.\n */\n async isTabStop(): Promise<boolean> {\n if (await this.isDisabled()) return false;\n const tabIndex = await (await this.host()).getAttribute('tabindex');\n return Number.parseInt(tabIndex ?? '-1', 10) >= 0;\n }\n\n /**\n * The id of the panel this tab controls, or `null` when it controls none.\n *\n * `null` for a router tab — the strip renders no panel in that mode, the consumer\n * drops a `<router-outlet>` after it — and that missing `aria-controls` is the\n * honest report: there is nothing for the header to point at.\n */\n async getPanelId(): Promise<string | null> {\n return (await this.host()).getAttribute('aria-controls');\n }\n\n /** Whether this tab's panel is in the DOM right now — true only for the selected tab. */\n async hasPanel(): Promise<boolean> {\n return (await this.panelOrNull()) !== null;\n }\n\n /**\n * Whether the panel and this header really name each other.\n *\n * Both halves, because each covers a different failure: the header's\n * `aria-controls` has to reach the panel that is showing, and the panel's\n * `aria-labelledby` has to come back to THIS header. A panel wired to the wrong\n * tab looks perfect on screen — the right content is under the right header — and\n * announces the wrong name, which is the whole of a tabbed interface for anyone\n * not looking at it. It also has to be a `tabpanel`: the reference resolving to\n * some other element is a broken pairing, not a styling detail.\n *\n * Throws when there is no panel at all, which is a different fact from a broken\n * pairing — see {@link getPanelText}.\n */\n async isPanelBound(): Promise<boolean> {\n const panel = await this.panelOrThrow('isPanelBound');\n if ((await panel.getAttribute('role')) !== 'tabpanel') return false;\n return (await panel.getAttribute('aria-labelledby')) === (await this.getId());\n }\n\n /**\n * The text of this tab's panel, trimmed.\n *\n * Throws rather than answering `''` for a tab whose panel is not rendered, and\n * the message says which of the two reasons it is: `<wr-tabs>` keeps only the\n * selected tab's panel in the DOM (the content of every other tab sits in an\n * unrendered `<ng-template>`, so switching tabs destroys a panel and builds the\n * next one), and a router strip renders no panel at all.\n */\n async getPanelText(): Promise<string> {\n return (await this.panelOrThrow('getPanelText')).text();\n }\n\n /**\n * Activate this tab the way a pointer does.\n *\n * A disabled CONTENT tab is left alone: it is a real `<button disabled>`, which\n * fires no click at all. A disabled ROUTER tab is an `<a>`, where `disabled` is\n * not a thing — it carries `aria-disabled=\"true\"` and `tabindex=\"-1\"` to stay off\n * the keyboard path, renders NO href, and the component drops the click rather\n * than routing it. So the click lands and nothing moves, which is why a router\n * strip's expectations belong on the resolved route rather than on the click.\n */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Move keyboard focus onto this header. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Take focus off this header. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether this header holds keyboard focus — the roving cursor, not the selection. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** `getHarness(…)` searches this tab's PANEL, which is where its content is. */\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n // Both checks, in this order, so the failure names the reason — no panel in this\n // mode, or a panel that is not the one showing — instead of the CDK's generic\n // \"no element matching selector\".\n const id = await this.panelIdOrThrow('getHarness');\n await this.panelOrThrow('getHarness');\n return this.documentRootLocatorFactory().harnessLoaderFor(WrTabHarness.byId(id));\n }\n\n /** The panel element, or `null` when this tab has none rendered. */\n private async panelOrNull(): Promise<TestElement | null> {\n const id = await this.getPanelId();\n if (id === null) return null;\n // From the document root: the panel is a sibling of the strip, not a descendant\n // of the header this harness is hosted on.\n return this.documentRootLocatorFactory().locatorForOptional(WrTabHarness.byId(id))();\n }\n\n /** The panel element, or a failure naming which of the two reasons there isn't one. */\n private async panelOrThrow(method: string): Promise<TestElement> {\n await this.panelIdOrThrow(method);\n const panel = await this.panelOrNull();\n if (!panel) {\n throw new Error(\n `WrTabHarness.${method}(): the panel for \"${await this.getLabel()}\" is not rendered. <wr-tabs> keeps ` +\n 'only the SELECTED panel in the DOM — the content of every other tab waits in an unrendered ' +\n '<ng-template> — so select the tab first.'\n );\n }\n return panel;\n }\n\n /** This tab's `aria-controls`, or a failure saying a router strip has no panels. */\n private async panelIdOrThrow(method: string): Promise<string> {\n const id = await this.getPanelId();\n if (id === null) {\n throw new Error(\n `WrTabHarness.${method}(): \"${await this.getLabel()}\" controls no panel. A router strip renders none ` +\n '— its tabs navigate and the consumer drops a <router-outlet> after the strip — so assert the ' +\n 'routed content instead.'\n );\n }\n return id;\n }\n\n /**\n * An id selector that survives the id it is given.\n *\n * `[id=\"…\"]` rather than `#…`: the ids here are built from the consumer's `key`,\n * and a key holding a dot, a colon or a leading digit turns `#id` into a selector\n * that either throws or matches something else entirely.\n */\n private static byId(id: string): string {\n return `[id=\"${id}\"]`;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrTabHarnessFilters, WrTabsHarnessFilters, WrTabsHarnessSize } from './interfaces';\nimport { WrTabHarness } from './wr-tab-harness';\n\n/**\n * Test harness for `<wr-tabs>`, with {@link WrTabHarness} for one tab and the panel\n * it controls.\n *\n * The component has two modes and they answer \"which tab is active\" differently,\n * which is most of what this harness exists to keep straight:\n *\n * - **Content** — the tabs are `<button role=\"tab\">`s, the strip is ONE tab stop\n * (the roving `tabindex` sits on the selected tab), and the arrow keys ACTIVATE\n * the tab they move to, the APG's automatic-activation pattern. `<wr-tabs>`\n * renders exactly one panel: the selected tab's.\n * - **Router** — one `routerLink` on any child switches the whole strip over. The\n * tabs become `<a role=\"tab\">`s whose `aria-selected` follows the resolved route\n * (the same `routerActive()` that paints `--active`), the strip renders NO\n * panel, and it stops being one tab stop — every enabled tab is a Tab stop of its\n * own. The arrow keys still move focus, but they select nothing: the route does\n * that.\n *\n * So {@link getSelectedLabel} and {@link getFocusedLabel} are two different\n * questions, and {@link getTabStopLabels} is a third. They coincide in content mode\n * and come apart in router mode; a spec that asserts one and means another passes\n * through the bug.\n *\n * Everything here is driven from the KEYBOARD rather than by clicking a coordinate:\n * a unit test has no layout, so a hit test would answer with nothing, and the\n * keyboard is the accessible path anyway. {@link select} is the exception — a\n * no-arg click needs no coordinate.\n *\n * @example\n * ```ts\n * const tabs = await loader.getHarness(WrTabsHarness);\n *\n * expect(await tabs.getTabLabels()).toEqual(['One', 'Two', 'Three']);\n * await tabs.select({ label: 'Two' });\n * expect(await tabs.getPanelText()).toContain('Second panel');\n * ```\n *\n * @see https://ngwr.dev/reference/components/tabs\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTabsHarness extends ComponentHarness {\n static hostSelector = 'wr-tabs';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTabsHarnessFilters = {}): HarnessPredicate<WrTabsHarness> {\n return new HarnessPredicate(WrTabsHarness, options)\n .addOption('tabLabel', options.tabLabel, async (harness, label) => {\n for (const tab of await harness.getTabLabels()) {\n if (await HarnessPredicate.stringMatches(tab, label)) return true;\n }\n return false;\n })\n .addOption('selectedLabel', options.selectedLabel, async (harness, label) => {\n const selected = await harness.getSelectedLabel();\n return selected === null ? false : HarnessPredicate.stringMatches(selected, label);\n })\n .addOption('size', options.size, async (harness, size) => (await harness.getSize()) === size)\n .addOption('router', options.router, async (harness, router) => (await harness.isRouterMode()) === router);\n }\n\n /**\n * The role the strip announces — `tablist`.\n *\n * Read off the strip, not the host: `<wr-tabs>` carries the `wr-tabs` class and no\n * role of its own, and the `tablist` is the scrolling `.wr-tabs__strip` inside it.\n * Without that role the headers are a row of buttons: nothing tells a screen\n * reader how many tabs there are or which one of them is showing.\n */\n async getRole(): Promise<string | null> {\n return (await this.strip()).getAttribute('role');\n }\n\n /**\n * The axis the strip announces, which decides which arrow keys a screen-reader\n * user is told to press.\n *\n * `<wr-tabs>` ships one orientation — the strip is a horizontal scroller and hard\n * codes `aria-orientation=\"horizontal\"` — so today this always answers\n * `'horizontal'`. It is read from the DOM and normalized the way ARIA reads it:\n * anything that is not `vertical`, a missing attribute included, is `'horizontal'`,\n * the default for a `tablist`.\n *\n * Which means an assertion here catches a strip that starts ANNOUNCING `vertical`\n * while its arrow keys still walk the horizontal axis — and cannot catch the\n * mirror image, a vertical mode that forgets to update the attribute: that one\n * answers `'horizontal'` and looks unchanged. One attribute is all this reads.\n */\n async getOrientation(): Promise<'horizontal' | 'vertical'> {\n return (await (await this.strip()).getAttribute('aria-orientation')) === 'vertical' ? 'vertical' : 'horizontal';\n }\n\n /**\n * The size the strip renders at, from the host modifier.\n *\n * `md` is the default and paints no modifier of its own, so its absence is the\n * answer rather than a missing one.\n */\n async getSize(): Promise<WrTabsHarnessSize> {\n const host = await this.host();\n if (await host.hasClass('wr-tabs--sm')) return 'sm';\n if (await host.hasClass('wr-tabs--lg')) return 'lg';\n return 'md';\n }\n\n /**\n * Whether this strip navigates instead of swapping panels.\n *\n * Derived from what got RENDERED — a router tab is an `<a>` — rather than from the\n * `routerLink` inputs, because the switch is all-or-nothing: one `routerLink`\n * anywhere in the strip turns every tab into a link and drops the panel. A strip\n * with no tabs at all is content mode, which is what the component does with it.\n */\n async isRouterMode(): Promise<boolean> {\n const tabs = await this.getTabs();\n for (const tab of tabs) {\n if (await tab.isLink()) return true;\n }\n return false;\n }\n\n /**\n * This strip's tabs, in render order.\n *\n * Scoped to this strip rather than to the host, which is what keeps a `<wr-tabs>`\n * NESTED in a panel from answering for its parent: the inner strip is a descendant\n * of the outer host, so a host-wide query would hand back both sets of tabs as one\n * flat list.\n */\n async getTabs(filters: WrTabHarnessFilters = {}): Promise<WrTabHarness[]> {\n return (await this.stripLoader()).getAllHarnesses(WrTabHarness.with(filters));\n }\n\n /** The label of every tab, in render order. */\n async getTabLabels(): Promise<string[]> {\n const tabs = await this.getTabs();\n return Promise.all(tabs.map(tab => tab.getLabel()));\n }\n\n /**\n * The selected tab, or `null` when none is.\n *\n * A content strip always has one — it falls back to the first tab when `active`\n * matches nothing — so `null` means a router strip whose current route matches no\n * tab, or a strip with no tabs.\n */\n async getSelectedTab(): Promise<WrTabHarness | null> {\n const [selected] = await this.getTabs({ selected: true });\n return selected ?? null;\n }\n\n /** The label of the selected tab, or `null` when none is selected. */\n async getSelectedLabel(): Promise<string | null> {\n const selected = await this.getSelectedTab();\n return selected ? selected.getLabel() : null;\n }\n\n /**\n * Select the first tab matching the filters, the way a pointer does.\n *\n * Throws when nothing matches, naming the tabs that do exist, and throws again\n * when the tab is still unselected afterwards — with both causes named, because a\n * click that quietly did nothing surfaces as an unrelated assertion three lines\n * later. Those causes are a disabled CONTENT tab (a `<button disabled>` never sees\n * the click at all) and a router strip whose navigation did not land on this tab.\n *\n * A router strip is otherwise fine here: the click starts a route change, the\n * harness stabilizes the pending navigation before it re-reads the strip, and\n * `routerActive()` has painted the selection by then — so this resolves. It is a\n * guard, a redirect or an unmatched path that leaves the tab unselected. A\n * DISABLED router tab is a different shape and no longer navigates: it renders\n * no href and the component drops the click, so the click lands and nothing\n * moves — see {@link WrTabHarness.click}.\n */\n async select(filters: WrTabHarnessFilters): Promise<void> {\n const [tab] = await this.getTabs(filters);\n if (!tab) {\n const labels = await this.getTabLabels();\n const offered =\n labels.length > 0 ? `This strip offers: ${labels.join(', ')}.` : 'This strip renders no tabs at all.';\n throw new Error(`WrTabsHarness.select(): no tab matched ${JSON.stringify(filters)}. ${offered}`);\n }\n await this.activate(tab, 'select');\n }\n\n /**\n * Select the tab at this position in render order, counting from 0.\n *\n * Throws on an index the strip does not have, naming its length: a silent no-op\n * there reads as \"the tab did not react\" when the tab was never addressed.\n */\n async selectByIndex(index: number): Promise<void> {\n const tabs = await this.getTabs();\n const tab = tabs[index];\n if (!tab) {\n throw new Error(\n `WrTabsHarness.selectByIndex(): this strip has ${tabs.length} tab(s), so index ${index} is out of ` +\n 'range — they are numbered from 0 in render order.'\n );\n }\n await this.activate(tab, 'selectByIndex');\n }\n\n /**\n * The labels of every tab a Tab press can land on, in render order.\n *\n * A LIST rather than one label, because the count is the mode: a content strip\n * roves a single `tabindex=\"0\"` and answers with exactly one label — the selected\n * tab — while a router strip makes every enabled tab its own stop and answers with\n * all of them. Either way a disabled tab is never in here.\n */\n async getTabStopLabels(): Promise<string[]> {\n const labels: string[] = [];\n for (const tab of await this.getTabs()) {\n if (await tab.isTabStop()) labels.push(await tab.getLabel());\n }\n return labels;\n }\n\n /**\n * Whether the strip is a single tab stop — the roving-`tabindex` pattern the APG\n * asks a `tablist` for.\n *\n * True for a content strip, false for a router one, which puts every enabled tab\n * in the page tab order. A strip whose every tab is disabled has no stop at all\n * and answers `true`: nothing to rove, and Tab skips it.\n */\n async isRoving(): Promise<boolean> {\n return (await this.getTabStopLabels()).length <= 1;\n }\n\n /**\n * The label of the tab holding keyboard focus, or `null` when focus is elsewhere.\n *\n * The other answer to \"which tab is active\", and not the same as\n * {@link getSelectedLabel}: the arrow keys move this. In content mode they also\n * select what they land on, so the two stay together; in router mode focus walks\n * the strip while the selection stays on whatever the route resolved to.\n */\n async getFocusedLabel(): Promise<string | null> {\n for (const tab of await this.getTabs()) {\n if (await tab.isFocused()) return tab.getLabel();\n }\n return null;\n }\n\n /**\n * Put focus where a Tab press would put it — the first tab stop in render order.\n *\n * That is the selected tab in content mode, and the first enabled tab in a router\n * strip. Throws when the strip has no stop at all, because Tab then skips past it\n * rather than entering it — a content strip whose selected tab is disabled has\n * none, and neither has one whose every tab is disabled, or one with no tabs.\n */\n async focusTabStop(): Promise<void> {\n for (const tab of await this.getTabs()) {\n if (await tab.isTabStop()) {\n await tab.focus();\n return;\n }\n }\n\n throw new Error(\n 'WrTabsHarness.focusTabStop(): this strip has no tab stop — its selected tab is disabled, every tab ' +\n 'is disabled, or it renders no tabs — so Tab skips it rather than entering it.'\n );\n }\n\n /**\n * ArrowRight on the strip — one tab toward the visual RIGHT, wrapping at the end\n * and skipping disabled tabs.\n *\n * The physical key, because that is what a keyboard has. The component follows\n * visual order per the APG, so under `dir=\"rtl\"` this moves to the PREVIOUS tab —\n * a spec exercising a mirrored strip swaps this and {@link pressArrowLeft}.\n *\n * In content mode the tab it lands on is also SELECTED (automatic activation); in\n * router mode only focus moves.\n */\n async pressArrowRight(): Promise<void> {\n await this.press(TestKey.RIGHT_ARROW);\n }\n\n /** ArrowLeft on the strip — one tab toward the visual LEFT, mirrored under `dir=\"rtl\"`. */\n async pressArrowLeft(): Promise<void> {\n await this.press(TestKey.LEFT_ARROW);\n }\n\n /**\n * Home on the strip — the FIRST enabled tab.\n *\n * Home and End name a position in the tab list rather than an edge of the strip,\n * so unlike the arrows they read the same in both reading directions.\n */\n async pressHome(): Promise<void> {\n await this.press(TestKey.HOME);\n }\n\n /** End on the strip — the LAST enabled tab, in both reading directions. */\n async pressEnd(): Promise<void> {\n await this.press(TestKey.END);\n }\n\n /** Whether this strip is showing a panel at all — false for a router strip. */\n async hasPanel(): Promise<boolean> {\n const selected = await this.getSelectedTab();\n return selected === null ? false : selected.hasPanel();\n }\n\n /**\n * The text of the panel that is showing, trimmed — the selected tab's content, and\n * the only tab content in the DOM.\n *\n * Throws when nothing is selected. Delegates to the selected tab, so the panel it\n * reads is the one that tab's `aria-controls` points at rather than \"the first\n * `.wr-tabs__panel` around\" — the two are only the same page when the wiring is\n * right, and {@link WrTabHarness.isPanelBound} is what says whether it is.\n */\n async getPanelText(): Promise<string> {\n const selected = await this.getSelectedTab();\n if (!selected) {\n throw new Error(\n 'WrTabsHarness.getPanelText(): no tab is selected, so no panel is rendered. A router strip whose ' +\n 'route matches none of its tabs looks like this, as does a strip with no tabs.'\n );\n }\n return selected.getPanelText();\n }\n\n /**\n * Which edges of the strip are faded out, from the public `--fade-start` /\n * `--fade-end` host modifiers — the cue that there are more tabs than fit, on the\n * side they are on.\n *\n * The component computes these from the strip's scroll metrics, so in a unit test\n * both are always `false`: jsdom lays nothing out, every element measures 0x0, and\n * a strip that never overflows never fades. Assert this in a real browser, or\n * declare the metrics and dispatch a `scroll` the way the component's own spec\n * does.\n */\n async getFades(): Promise<{ start: boolean; end: boolean }> {\n const host = await this.host();\n return {\n start: await host.hasClass('wr-tabs--fade-start'),\n end: await host.hasClass('wr-tabs--fade-end'),\n };\n }\n\n /** Click a tab and check it took, or say which of the two reasons it did not. */\n private async activate(tab: WrTabHarness, method: string): Promise<void> {\n await tab.click();\n if (await tab.isSelected()) return;\n\n throw new Error(\n `WrTabsHarness.${method}(): \"${await tab.getLabel()}\" is still unselected after being clicked — ` +\n 'either it is a content tab carrying `disabled`, which fires no click at all, or this is a router ' +\n 'strip whose navigation did not land on this tab: a guard, a redirect or an unmatched path leaves ' +\n '`routerActive()` painting some other one.'\n );\n }\n\n /**\n * Send a key to the `role=\"tablist\"` strip.\n *\n * The strip owns the keydown handler, and a real user's keypress on the focused\n * header bubbles to exactly here — so this is the honest target, and the one that\n * still works when jsdom has left real focus on `<body>`. It is also the target\n * that leaves the headers alone: the CDK types into whatever element it is handed,\n * which on a `<button>` means writing a `value` attribute onto a tab.\n */\n private async press(key: TestKey): Promise<void> {\n await (await this.strip()).sendKeys(key);\n }\n\n /** This strip's own `role=\"tablist\"` element — the first one under the host. */\n private async strip(): Promise<TestElement> {\n return this.locatorFor('.wr-tabs__strip')();\n }\n\n /**\n * A loader rooted at this strip, so tab queries cannot reach a nested strip's tabs:\n * a nested `<wr-tabs>` lives in the PANEL, which is outside this element.\n */\n private async stripLoader(): Promise<HarnessLoader> {\n return this.locatorFactory.harnessLoaderFor('.wr-tabs__strip');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAWH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;AACG,MAAO,YAAa,SAAQ,gCAAgC,CAAA;;AAEhE,IAAA,OAAO,YAAY,GAAG,eAAe;;AAGrC,IAAA,OAAO,IAAI,CAAC,OAAA,GAA+B,EAAE,EAAA;AAC3C,QAAA,OAAO,IAAI,gBAAgB,CAAC,YAAY,EAAE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