@ember-joinery/test-support 1.0.1 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @ember-joinery/test-support
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9728270: `AppShell`: the frame of an app. It yields a header, a sidebar, the content, an aside and a
8
+ footer, each a landmark, and starts with a link that skips to the content. `@layout="alt"` runs
9
+ the sidebar the full height, and `@fullscreen` makes only the content scroll, below bars that
10
+ are materials. `AppShellHarness` drives it.
11
+ - 9728270: Inspector is a new component: a pane after the content it inspects, as SwiftUI's `.inspector()`. A narrow inspector shows the pane in a sheet. `InspectorHarness` drives it.
12
+ - 9728270: `NavigationBar` is new: the bar at the top of a screen on a phone, with `Leading`, `Title` and `Trailing` parts and a large title (`NavigationBarLargeTitle`) that scrolls under the bar. `NavigationBarHarness` drives it.
13
+ - 9728270: `NavigationStack` is new: push and pop navigation where the nested routes are the stack, with a back button, a view transition for each change of depth, and an edge swipe that goes back in an installed app. `NavigationStackHarness` drives it.
14
+ - 9728270: `Page`: one screen of an app. Its header has a nav, a title, a description, actions and a
15
+ footer row for tabs, over a body. `@variant="settings"` keeps the body in a readable column,
16
+ and a sticky header is a material. `PageHarness` drives it.
17
+ - 9728270: A new component, `PullToRefresh`: it wraps scrolling content and calls `@onRefresh` when a touch or a pen pulls the content down from the top. It yields `refresh` and `isRefreshing` for a button, and a live region announces the refresh. `PullToRefreshHarness` drives it.
18
+ - 9728270: SplitView is a new component: two or three resizable columns (a sidebar, an optional content list and a detail), as SwiftUI's `NavigationSplitView`. A narrow view shows one column at a time. `SplitViewHarness` drives it.
19
+ - 9728270: A new component, `StatusBar`: the bar at the bottom of a window, with `Leading`, `Center`, `Trailing` and `Item` parts. `Item @live={{true}}` is a polite live region. `StatusBarHarness` reads it.
20
+ - 9728270: A new component, `TabBar`: the tab bar of a phone or tablet app, a `<nav>` of links with `aria-current="page"` on the current one. It has a `bar` and a `floating` variant, a `top` placement, badges, a `Search` part, an `Accessory` part, and `@minimizeOnScroll`. `TabBarHarness` drives it.
21
+ - 9728270: A new component, `TitleBar`: the bar at the top of a window, after the macOS window toolbar. It has `unified`, `unified-compact` and `expanded` variants, `Leading`, `Title`, `Center`, `Trailing`, `Toolbar` and `TrafficLights` parts, a drag region (`app-region`), room for the native window controls (`@controls="start"` or `"overlay"`), and an inactive look while the window has no focus. `TitleBarHarness` reads it.
22
+ - 9728270: `Toolbar`: the WAI-ARIA toolbar. Its controls share one tab stop and the arrow keys move
23
+ between them. It has groups, a separator, a spacer, and `Leading`, `Center` and `Trailing`
24
+ thirds for a window's toolbar. `ToolbarHarness` drives it.
25
+ - 9728270: A new component, `WindowFrame`: a frame that looks and behaves as a desktop window, with `TitleBar`, `Sidebar`, `Body` and `StatusBar` regions. It has `window`, `settings`, `panel` and `hud` variants, `@fill` for the root of an Electron, Tauri or installed PWA app, and `@fullHeightSidebar`. `WindowFrameHarness` reads it.
26
+
3
27
  ## 1.0.1
4
28
 
5
29
  No changes in this release.
@@ -0,0 +1,43 @@
1
+ import { Harness } from './harness.ts';
2
+ /**
3
+ * Drives an `<AppShell>` from `@ember-joinery/ember`: reaches its regions, reads how it is laid
4
+ * out, and follows its skip link.
5
+ *
6
+ * const shell = new AppShellHarness()
7
+ * assert.strictEqual(shell.layout, 'default')
8
+ * await shell.skipToMain()
9
+ * assert.true(shell.mainHasFocus)
10
+ *
11
+ * The shell wraps the app, so the parts inside it still belong to the components around them;
12
+ * its own regions are found by their `data-jn-app-shell-*` attributes. A page object can extend
13
+ * this class and declare the app's components with `@child`.
14
+ */
15
+ export declare class AppShellHarness extends Harness {
16
+ #private;
17
+ static component: string;
18
+ /** Its `@layout`: `default` (the header over the sidebar) or `alt` (the sidebar full height). */
19
+ get layout(): string | null;
20
+ /** Whether it fills the window and only its content scrolls. */
21
+ get isFullscreen(): boolean;
22
+ /** The header. Throws when it has none. */
23
+ get header(): HTMLElement;
24
+ /** The sidebar region. Throws when it has none. */
25
+ get sidebar(): HTMLElement;
26
+ /** The content, a `<main>`. Throws when it has none. */
27
+ get main(): HTMLElement;
28
+ /** The aside. Throws when it has none. */
29
+ get aside(): HTMLElement;
30
+ /** The footer. Throws when it has none. */
31
+ get footer(): HTMLElement;
32
+ /** Whether it has the region: `header`, `sidebar`, `main`, `aside` or `footer`. */
33
+ has(region: 'header' | 'sidebar' | 'main' | 'aside' | 'footer'): boolean;
34
+ /** The skip link. Throws when it has none. */
35
+ get skipLink(): HTMLAnchorElement;
36
+ /** The skip link's text, or `''` when the shell has none. */
37
+ get skipLinkLabel(): string;
38
+ /** Whether focus is on the content, as after the skip link. */
39
+ get mainHasFocus(): boolean;
40
+ /** Follows the skip link, which moves focus to the content. */
41
+ skipToMain(): Promise<void>;
42
+ }
43
+ //# sourceMappingURL=app-shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAMtC;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,SAAQ,OAAO;;IAC1C,OAAgB,SAAS,SAAc;IAYvC,iGAAiG;IACjG,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAE1B;IAED,gEAAgE;IAChE,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,2CAA2C;IAC3C,IAAI,MAAM,IAAI,WAAW,CAExB;IAED,mDAAmD;IACnD,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,wDAAwD;IACxD,IAAI,IAAI,IAAI,WAAW,CAEtB;IAED,0CAA0C;IAC1C,IAAI,KAAK,IAAI,WAAW,CAEvB;IAED,2CAA2C;IAC3C,IAAI,MAAM,IAAI,WAAW,CAExB;IAED,mFAAmF;IACnF,GAAG,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO;IAIxE,8CAA8C;IAC9C,IAAI,QAAQ,IAAI,iBAAiB,CAEhC;IAED,6DAA6D;IAC7D,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,+DAA+D;IAC/D,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,+DAA+D;IACzD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlC"}
@@ -0,0 +1,78 @@
1
+ import { click } from '@ember/test-helpers';
2
+ import { Harness } from "./harness.js";
3
+ function text(element) {
4
+ return (element?.textContent ?? '').replace(/\s+/g, ' ').trim();
5
+ }
6
+ /**
7
+ * Drives an `<AppShell>` from `@ember-joinery/ember`: reaches its regions, reads how it is laid
8
+ * out, and follows its skip link.
9
+ *
10
+ * const shell = new AppShellHarness()
11
+ * assert.strictEqual(shell.layout, 'default')
12
+ * await shell.skipToMain()
13
+ * assert.true(shell.mainHasFocus)
14
+ *
15
+ * The shell wraps the app, so the parts inside it still belong to the components around them;
16
+ * its own regions are found by their `data-jn-app-shell-*` attributes. A page object can extend
17
+ * this class and declare the app's components with `@child`.
18
+ */
19
+ export class AppShellHarness extends Harness {
20
+ static component = 'app-shell';
21
+ #query(region) {
22
+ return this.element.querySelector(`:scope > [data-jn-app-shell-${region}]`);
23
+ }
24
+ #region(region) {
25
+ const element = this.#query(region);
26
+ if (!element)
27
+ throw new Error(`Joinery harness: no ${region} in ${this}`);
28
+ return element;
29
+ }
30
+ /** Its `@layout`: `default` (the header over the sidebar) or `alt` (the sidebar full height). */
31
+ get layout() {
32
+ return this.element.getAttribute('data-layout');
33
+ }
34
+ /** Whether it fills the window and only its content scrolls. */
35
+ get isFullscreen() {
36
+ return this.element.hasAttribute('data-fullscreen');
37
+ }
38
+ /** The header. Throws when it has none. */
39
+ get header() {
40
+ return this.#region('header');
41
+ }
42
+ /** The sidebar region. Throws when it has none. */
43
+ get sidebar() {
44
+ return this.#region('sidebar');
45
+ }
46
+ /** The content, a `<main>`. Throws when it has none. */
47
+ get main() {
48
+ return this.#region('main');
49
+ }
50
+ /** The aside. Throws when it has none. */
51
+ get aside() {
52
+ return this.#region('aside');
53
+ }
54
+ /** The footer. Throws when it has none. */
55
+ get footer() {
56
+ return this.#region('footer');
57
+ }
58
+ /** Whether it has the region: `header`, `sidebar`, `main`, `aside` or `footer`. */
59
+ has(region) {
60
+ return this.#query(region) !== null;
61
+ }
62
+ /** The skip link. Throws when it has none. */
63
+ get skipLink() {
64
+ return this.#region('skip-link');
65
+ }
66
+ /** The skip link's text, or `''` when the shell has none. */
67
+ get skipLinkLabel() {
68
+ return text(this.#query('skip-link'));
69
+ }
70
+ /** Whether focus is on the content, as after the skip link. */
71
+ get mainHasFocus() {
72
+ return this.element.ownerDocument.activeElement === this.#query('main');
73
+ }
74
+ /** Follows the skip link, which moves focus to the content. */
75
+ async skipToMain() {
76
+ await click(this.#region('skip-link'));
77
+ }
78
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './accordion.ts';
2
2
  export * from './alert-dialog.ts';
3
3
  export * from './alert.ts';
4
+ export * from './app-shell.ts';
4
5
  export * from './aspect-ratio.ts';
5
6
  export * from './attachment.ts';
6
7
  export * from './avatar.ts';
@@ -34,6 +35,7 @@ export * from './icon.ts';
34
35
  export * from './input-group.ts';
35
36
  export * from './input-otp.ts';
36
37
  export * from './input.ts';
38
+ export * from './inspector.ts';
37
39
  export * from './item.ts';
38
40
  export * from './kbd.ts';
39
41
  export * from './keys.ts';
@@ -46,12 +48,16 @@ export * from './message-scroller.ts';
46
48
  export * from './message.ts';
47
49
  export * from './native-form.ts';
48
50
  export * from './native-select.ts';
51
+ export * from './navigation-bar.ts';
49
52
  export * from './navigation-menu.ts';
53
+ export * from './navigation-stack.ts';
50
54
  export * from './observers.ts';
55
+ export * from './page.ts';
51
56
  export * from './pagination.ts';
52
57
  export * from './pointer.ts';
53
58
  export * from './popover.ts';
54
59
  export * from './progress.ts';
60
+ export * from './pull-to-refresh.ts';
55
61
  export * from './questionnaire.ts';
56
62
  export * from './radio-group.ts';
57
63
  export * from './rating.ts';
@@ -70,17 +76,23 @@ export * from './sidebar.ts';
70
76
  export * from './skeleton.ts';
71
77
  export * from './slider.ts';
72
78
  export * from './spinner.ts';
79
+ export * from './split-view.ts';
80
+ export * from './status-bar.ts';
73
81
  export * from './sticky-footer.ts';
74
82
  export * from './switch.ts';
83
+ export * from './tab-bar.ts';
75
84
  export * from './table.ts';
76
85
  export * from './tabs.ts';
77
86
  export * from './test-hooks.ts';
78
87
  export * from './textarea.ts';
88
+ export * from './title-bar.ts';
79
89
  export * from './toaster.ts';
80
90
  export * from './toggle-group.ts';
81
91
  export * from './toggle.ts';
92
+ export * from './toolbar.ts';
82
93
  export * from './tooltip.ts';
83
94
  export * from './trace.ts';
84
95
  export * from './translator.ts';
96
+ export * from './window-frame.ts';
85
97
  export * from './zoetrope.ts';
86
98
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC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AAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  export * from "./accordion.js";
4
4
  export * from "./alert-dialog.js";
5
5
  export * from "./alert.js";
6
+ export * from "./app-shell.js";
6
7
  export * from "./aspect-ratio.js";
7
8
  export * from "./attachment.js";
8
9
  export * from "./avatar.js";
@@ -36,6 +37,7 @@ export * from "./icon.js";
36
37
  export * from "./input-group.js";
37
38
  export * from "./input-otp.js";
38
39
  export * from "./input.js";
40
+ export * from "./inspector.js";
39
41
  export * from "./item.js";
40
42
  export * from "./kbd.js";
41
43
  export * from "./keys.js";
@@ -48,12 +50,16 @@ export * from "./message-scroller.js";
48
50
  export * from "./message.js";
49
51
  export * from "./native-form.js";
50
52
  export * from "./native-select.js";
53
+ export * from "./navigation-bar.js";
51
54
  export * from "./navigation-menu.js";
55
+ export * from "./navigation-stack.js";
52
56
  export * from "./observers.js";
57
+ export * from "./page.js";
53
58
  export * from "./pagination.js";
54
59
  export * from "./pointer.js";
55
60
  export * from "./popover.js";
56
61
  export * from "./progress.js";
62
+ export * from "./pull-to-refresh.js";
57
63
  export * from "./questionnaire.js";
58
64
  export * from "./radio-group.js";
59
65
  export * from "./rating.js";
@@ -72,16 +78,22 @@ export * from "./sidebar.js";
72
78
  export * from "./skeleton.js";
73
79
  export * from "./slider.js";
74
80
  export * from "./spinner.js";
81
+ export * from "./split-view.js";
82
+ export * from "./status-bar.js";
75
83
  export * from "./sticky-footer.js";
76
84
  export * from "./switch.js";
85
+ export * from "./tab-bar.js";
77
86
  export * from "./table.js";
78
87
  export * from "./tabs.js";
79
88
  export * from "./test-hooks.js";
80
89
  export * from "./textarea.js";
90
+ export * from "./title-bar.js";
81
91
  export * from "./toaster.js";
82
92
  export * from "./toggle-group.js";
83
93
  export * from "./toggle.js";
94
+ export * from "./toolbar.js";
84
95
  export * from "./tooltip.js";
85
96
  export * from "./trace.js";
86
97
  export * from "./translator.js";
98
+ export * from "./window-frame.js";
87
99
  export * from "./zoetrope.js";
@@ -0,0 +1,47 @@
1
+ import { Harness } from './harness.ts';
2
+ import { type KeyModifiers } from './focus.ts';
3
+ import { SheetHarness } from './sheet.ts';
4
+ /**
5
+ * Drives an `<Inspector>` from `@ember-joinery/ember`: reads if its pane is open, reaches its
6
+ * content and its pane, and uses its trigger.
7
+ *
8
+ * const inspector = new InspectorHarness('document') // <Inspector @name="document">
9
+ * await inspector.close()
10
+ * assert.false(inspector.isOpen)
11
+ *
12
+ * In a narrow layout the pane is a sheet: `sheet` is its `SheetHarness`. The inspector wraps the
13
+ * app, so the parts inside it still belong to the components around them; its own elements are
14
+ * found by their `data-jn-inspector-*` attributes.
15
+ */
16
+ export declare class InspectorHarness extends Harness {
17
+ static component: string;
18
+ /** Whether the pane is open: the sheet, in a narrow layout. */
19
+ get isOpen(): boolean;
20
+ /** Whether it is narrower than its `@compactBreakpoint`, so the pane is a sheet. */
21
+ get isCompact(): boolean;
22
+ /** The content it inspects. Throws when it has none. */
23
+ get content(): HTMLElement;
24
+ /** The pane: the `<aside>`, or the sheet's content in a narrow layout. `null` while closed. */
25
+ get pane(): HTMLElement | null;
26
+ /** The pane's name for assistive technology, or `''` while it is closed. */
27
+ get label(): string;
28
+ /** The text of the pane's `Title`, or `''`. */
29
+ get title(): string;
30
+ /** The trigger, or `null` when it has none. */
31
+ get trigger(): HTMLElement | null;
32
+ /** The sheet that holds the pane in a narrow layout. */
33
+ get sheet(): SheetHarness;
34
+ /** The resize handle of a `@resizable` pane, or `null`. */
35
+ get separator(): HTMLElement | null;
36
+ /** The open pane's width in CSS pixels. */
37
+ get width(): number;
38
+ /** Clicks the trigger. Throws when it has none. */
39
+ toggle(): Promise<void>;
40
+ /** Opens the pane with the trigger, if it is closed. */
41
+ open(): Promise<void>;
42
+ /** Closes the pane, if it is open: with the trigger, or with Escape for the sheet. */
43
+ close(): Promise<void>;
44
+ /** Focuses the resize handle and presses a key on it: an arrow key, `Home` or `End`. */
45
+ pressSeparator(key: string, modifiers?: KeyModifiers): Promise<void>;
46
+ }
47
+ //# sourceMappingURL=inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAMzC;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,OAAgB,SAAS,SAAc;IAEvC,+DAA+D;IAC/D,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,oFAAoF;IACpF,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,wDAAwD;IACxD,IAAI,OAAO,IAAI,WAAW,CAIzB;IAED,+FAA+F;IAC/F,IAAI,IAAI,IAAI,WAAW,GAAG,IAAI,CAG7B;IAED,4EAA4E;IAC5E,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,+CAA+C;IAC/C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,+CAA+C;IAC/C,IAAI,OAAO,IAAI,WAAW,GAAG,IAAI,CAOhC;IAED,wDAAwD;IACxD,IAAI,KAAK,IAAI,YAAY,CAExB;IAED,2DAA2D;IAC3D,IAAI,SAAS,IAAI,WAAW,GAAG,IAAI,CAElC;IAED,2CAA2C;IAC3C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,mDAAmD;IAC7C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAM7B,wDAAwD;IAClD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,sFAAsF;IAChF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B,wFAAwF;IAClF,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAM/E"}
@@ -0,0 +1,97 @@
1
+ import { click, focus } from '@ember/test-helpers';
2
+ import { Harness } from "./harness.js";
3
+ import { pressKey } from "./focus.js";
4
+ import { SheetHarness } from "./sheet.js";
5
+ function text(element) {
6
+ return (element?.textContent ?? '').replace(/\s+/g, ' ').trim();
7
+ }
8
+ /**
9
+ * Drives an `<Inspector>` from `@ember-joinery/ember`: reads if its pane is open, reaches its
10
+ * content and its pane, and uses its trigger.
11
+ *
12
+ * const inspector = new InspectorHarness('document') // <Inspector @name="document">
13
+ * await inspector.close()
14
+ * assert.false(inspector.isOpen)
15
+ *
16
+ * In a narrow layout the pane is a sheet: `sheet` is its `SheetHarness`. The inspector wraps the
17
+ * app, so the parts inside it still belong to the components around them; its own elements are
18
+ * found by their `data-jn-inspector-*` attributes.
19
+ */
20
+ export class InspectorHarness extends Harness {
21
+ static component = 'inspector';
22
+ /** Whether the pane is open: the sheet, in a narrow layout. */
23
+ get isOpen() {
24
+ return this.element.getAttribute('data-state') === 'open';
25
+ }
26
+ /** Whether it is narrower than its `@compactBreakpoint`, so the pane is a sheet. */
27
+ get isCompact() {
28
+ return this.element.hasAttribute('data-compact');
29
+ }
30
+ /** The content it inspects. Throws when it has none. */
31
+ get content() {
32
+ const content = this.element.querySelector(':scope > [data-jn-inspector-content]');
33
+ if (!content)
34
+ throw new Error(`Joinery harness: no content in ${this}`);
35
+ return content;
36
+ }
37
+ /** The pane: the `<aside>`, or the sheet's content in a narrow layout. `null` while closed. */
38
+ get pane() {
39
+ if (this.isCompact)
40
+ return this.sheet.content;
41
+ return this.element.querySelector(':scope > [data-jn-inspector-pane]');
42
+ }
43
+ /** The pane's name for assistive technology, or `''` while it is closed. */
44
+ get label() {
45
+ return this.isCompact ? this.sheet.label : (this.pane?.getAttribute('aria-label') ?? '');
46
+ }
47
+ /** The text of the pane's `Title`, or `''`. */
48
+ get title() {
49
+ return text(this.pane?.querySelector('[data-jn-inspector-title]') ?? null);
50
+ }
51
+ /** The trigger, or `null` when it has none. */
52
+ get trigger() {
53
+ const root = this.element;
54
+ return ([...root.querySelectorAll('[data-jn-inspector-trigger]')].find(element => element.closest('[data-jn-inspector]') === root) ?? null);
55
+ }
56
+ /** The sheet that holds the pane in a narrow layout. */
57
+ get sheet() {
58
+ return this.child(SheetHarness);
59
+ }
60
+ /** The resize handle of a `@resizable` pane, or `null`. */
61
+ get separator() {
62
+ return this.element.querySelector(':scope > [data-jn-inspector-separator]');
63
+ }
64
+ /** The open pane's width in CSS pixels. */
65
+ get width() {
66
+ return this.pane?.offsetWidth ?? 0;
67
+ }
68
+ /** Clicks the trigger. Throws when it has none. */
69
+ async toggle() {
70
+ const trigger = this.trigger;
71
+ if (!trigger)
72
+ throw new Error(`Joinery harness: no trigger in ${this}`);
73
+ await click(trigger);
74
+ }
75
+ /** Opens the pane with the trigger, if it is closed. */
76
+ async open() {
77
+ if (!this.isOpen)
78
+ await this.toggle();
79
+ }
80
+ /** Closes the pane, if it is open: with the trigger, or with Escape for the sheet. */
81
+ async close() {
82
+ if (!this.isOpen)
83
+ return;
84
+ if (this.isCompact)
85
+ await this.sheet.pressEscape();
86
+ else
87
+ await this.toggle();
88
+ }
89
+ /** Focuses the resize handle and presses a key on it: an arrow key, `Home` or `End`. */
90
+ async pressSeparator(key, modifiers = {}) {
91
+ const separator = this.separator;
92
+ if (!separator)
93
+ throw new Error(`Joinery harness: no resize handle in ${this}`);
94
+ await focus(separator);
95
+ await pressKey(key, modifiers);
96
+ }
97
+ }
@@ -0,0 +1,30 @@
1
+ import { Harness } from './harness.ts';
2
+ /**
3
+ * Drives a `<NavigationBar>` from `@ember-joinery/ember`: reads its title and its large title,
4
+ * and reaches its parts.
5
+ *
6
+ * const bar = new NavigationBarHarness('contacts') // <NavigationBar @name="contacts">
7
+ * assert.strictEqual(bar.title, 'Contacts')
8
+ * assert.true(bar.hasLargeTitle)
9
+ * await bar.find(ButtonHarness, 'add').click()
10
+ */
11
+ export declare class NavigationBarHarness extends Harness {
12
+ static component: string;
13
+ /** The title's text, or `''` without one. */
14
+ get title(): string;
15
+ /** The title's element, a heading, or `null`. */
16
+ get titleElement(): HTMLElement | null;
17
+ /** The start of the bar, or `null`. */
18
+ get leading(): HTMLElement | null;
19
+ /** The end of the bar, or `null`. */
20
+ get trailing(): HTMLElement | null;
21
+ /** Whether the bar is for a screen with a large title (`@largeTitle`). */
22
+ get hasLargeTitle(): boolean;
23
+ /** The large title's element: the first one after the bar in the document, or `null`. */
24
+ get largeTitleElement(): HTMLElement | null;
25
+ /** The large title's text, or `''` without one. */
26
+ get largeTitle(): string;
27
+ /** Whether the bar stays at the top while the content scrolls (`position: sticky`). */
28
+ get isSticky(): boolean;
29
+ }
30
+ //# sourceMappingURL=navigation-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-bar.d.ts","sourceRoot":"","sources":["../src/navigation-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAMtC;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,OAAO;IAC/C,OAAgB,SAAS,SAAmB;IAE5C,6CAA6C;IAC7C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,iDAAiD;IACjD,IAAI,YAAY,IAAI,WAAW,GAAG,IAAI,CAErC;IAED,uCAAuC;IACvC,IAAI,OAAO,IAAI,WAAW,GAAG,IAAI,CAEhC;IAED,qCAAqC;IACrC,IAAI,QAAQ,IAAI,WAAW,GAAG,IAAI,CAEjC;IAED,0EAA0E;IAC1E,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,yFAAyF;IACzF,IAAI,iBAAiB,IAAI,WAAW,GAAG,IAAI,CAW1C;IAED,mDAAmD;IACnD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,uFAAuF;IACvF,IAAI,QAAQ,IAAI,OAAO,CAEtB;CACF"}
@@ -0,0 +1,52 @@
1
+ import { Harness } from "./harness.js";
2
+ function text(element) {
3
+ return (element?.textContent ?? '').replace(/\s+/g, ' ').trim();
4
+ }
5
+ /**
6
+ * Drives a `<NavigationBar>` from `@ember-joinery/ember`: reads its title and its large title,
7
+ * and reaches its parts.
8
+ *
9
+ * const bar = new NavigationBarHarness('contacts') // <NavigationBar @name="contacts">
10
+ * assert.strictEqual(bar.title, 'Contacts')
11
+ * assert.true(bar.hasLargeTitle)
12
+ * await bar.find(ButtonHarness, 'add').click()
13
+ */
14
+ export class NavigationBarHarness extends Harness {
15
+ static component = 'navigation-bar';
16
+ /** The title's text, or `''` without one. */
17
+ get title() {
18
+ return text(this.titleElement);
19
+ }
20
+ /** The title's element, a heading, or `null`. */
21
+ get titleElement() {
22
+ return this.queryPart('title');
23
+ }
24
+ /** The start of the bar, or `null`. */
25
+ get leading() {
26
+ return this.queryPart('leading');
27
+ }
28
+ /** The end of the bar, or `null`. */
29
+ get trailing() {
30
+ return this.queryPart('trailing');
31
+ }
32
+ /** Whether the bar is for a screen with a large title (`@largeTitle`). */
33
+ get hasLargeTitle() {
34
+ return this.element.hasAttribute('data-large-title');
35
+ }
36
+ /** The large title's element: the first one after the bar in the document, or `null`. */
37
+ get largeTitleElement() {
38
+ if (!this.hasLargeTitle)
39
+ return null;
40
+ const bar = this.element;
41
+ const all = bar.ownerDocument.querySelectorAll('[data-slot="navigation-bar-large-title"]');
42
+ return ([...all].find(element => bar.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING) ?? null);
43
+ }
44
+ /** The large title's text, or `''` without one. */
45
+ get largeTitle() {
46
+ return text(this.largeTitleElement);
47
+ }
48
+ /** Whether the bar stays at the top while the content scrolls (`position: sticky`). */
49
+ get isSticky() {
50
+ return getComputedStyle(this.element).position === 'sticky';
51
+ }
52
+ }
@@ -0,0 +1,36 @@
1
+ import { Harness } from './harness.ts';
2
+ /**
3
+ * Drives a `<NavigationStack>` from `@ember-joinery/ember`: reads its depth and direction, and
4
+ * goes back with its back button or with an edge swipe.
5
+ *
6
+ * const stack = new NavigationStackHarness('contacts') // <NavigationStack @name="contacts">
7
+ * assert.strictEqual(stack.depth, 1)
8
+ * await stack.back()
9
+ * assert.strictEqual(stack.direction, 'pop')
10
+ *
11
+ * The stack wraps the app's screens, so the parts inside it still belong to the components
12
+ * around them. A page object can extend this class and declare the screens' components with
13
+ * `@child`.
14
+ */
15
+ export declare class NavigationStackHarness extends Harness {
16
+ static component: string;
17
+ /** How many screens are below the current screen: 0 on the first screen. */
18
+ get depth(): number;
19
+ /** Whether there is a screen to go back to. */
20
+ get canGoBack(): boolean;
21
+ /** Which way the last change of depth went: `push` or `pop`. */
22
+ get direction(): string | null;
23
+ /** Whether a swipe from the inline-start edge goes back (`data-edge-swipe`). */
24
+ get isEdgeSwipeActive(): boolean;
25
+ /** The element that holds the screens, which a view transition slides. */
26
+ get content(): HTMLElement;
27
+ /** Its own back button, or `null` when the stack shows none: not one of a stack inside it. */
28
+ get backButton(): HTMLElement | null;
29
+ /** The back button's text, or `''` without one. */
30
+ get backLabel(): string;
31
+ /** Clicks the back button. Throws when the stack shows none. */
32
+ back(): Promise<void>;
33
+ /** Swipes with a touch from the inline-start edge, 120px toward the inline end. */
34
+ swipeBack(): Promise<void>;
35
+ }
36
+ //# sourceMappingURL=navigation-stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-stack.d.ts","sourceRoot":"","sources":["../src/navigation-stack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,SAAQ,OAAO;IACjD,OAAgB,SAAS,SAAqB;IAE9C,4EAA4E;IAC5E,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,+CAA+C;IAC/C,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,gEAAgE;IAChE,IAAI,SAAS,IAAI,MAAM,GAAG,IAAI,CAE7B;IAED,gFAAgF;IAChF,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED,0EAA0E;IAC1E,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,8FAA8F;IAC9F,IAAI,UAAU,IAAI,WAAW,GAAG,IAAI,CAOnC;IAED,mDAAmD;IACnD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,gEAAgE;IAC1D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,mFAAmF;IAC7E,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAWjC"}
@@ -0,0 +1,67 @@
1
+ import { click } from '@ember/test-helpers';
2
+ import { Harness } from "./harness.js";
3
+ import { sendPointer } from "./send-pointer.js";
4
+ /**
5
+ * Drives a `<NavigationStack>` from `@ember-joinery/ember`: reads its depth and direction, and
6
+ * goes back with its back button or with an edge swipe.
7
+ *
8
+ * const stack = new NavigationStackHarness('contacts') // <NavigationStack @name="contacts">
9
+ * assert.strictEqual(stack.depth, 1)
10
+ * await stack.back()
11
+ * assert.strictEqual(stack.direction, 'pop')
12
+ *
13
+ * The stack wraps the app's screens, so the parts inside it still belong to the components
14
+ * around them. A page object can extend this class and declare the screens' components with
15
+ * `@child`.
16
+ */
17
+ export class NavigationStackHarness extends Harness {
18
+ static component = 'navigation-stack';
19
+ /** How many screens are below the current screen: 0 on the first screen. */
20
+ get depth() {
21
+ return Number(this.element.getAttribute('data-depth'));
22
+ }
23
+ /** Whether there is a screen to go back to. */
24
+ get canGoBack() {
25
+ return this.depth > 0;
26
+ }
27
+ /** Which way the last change of depth went: `push` or `pop`. */
28
+ get direction() {
29
+ return this.element.getAttribute('data-direction');
30
+ }
31
+ /** Whether a swipe from the inline-start edge goes back (`data-edge-swipe`). */
32
+ get isEdgeSwipeActive() {
33
+ return this.element.hasAttribute('data-edge-swipe');
34
+ }
35
+ /** The element that holds the screens, which a view transition slides. */
36
+ get content() {
37
+ return this.element.querySelector(':scope > [data-jn-navigation-stack-content]');
38
+ }
39
+ /** Its own back button, or `null` when the stack shows none: not one of a stack inside it. */
40
+ get backButton() {
41
+ const root = this.element;
42
+ return ([...root.querySelectorAll('[data-jn-navigation-stack-back]')].find(button => button.closest('[data-jn-navigation-stack]') === root) ?? null);
43
+ }
44
+ /** The back button's text, or `''` without one. */
45
+ get backLabel() {
46
+ return (this.backButton?.textContent ?? '').replace(/\s+/g, ' ').trim();
47
+ }
48
+ /** Clicks the back button. Throws when the stack shows none. */
49
+ async back() {
50
+ const button = this.backButton;
51
+ if (!button)
52
+ throw new Error(`Joinery harness: no back button in ${this}`);
53
+ await click(button);
54
+ }
55
+ /** Swipes with a touch from the inline-start edge, 120px toward the inline end. */
56
+ async swipeBack() {
57
+ const root = this.element;
58
+ const { left, right, top } = root.getBoundingClientRect();
59
+ const rtl = getComputedStyle(root).direction === 'rtl';
60
+ const from = rtl ? right - 5 : left + 5;
61
+ const to = rtl ? from - 120 : from + 120;
62
+ const init = { pointerType: 'touch', clientY: top + 5 };
63
+ await sendPointer(root, 'pointerdown', { ...init, clientX: from });
64
+ await sendPointer(root, 'pointermove', { ...init, clientX: to });
65
+ await sendPointer(root, 'pointerup', { ...init, clientX: to, buttons: 0 });
66
+ }
67
+ }