@ember-joinery/test-support 0.0.0-stage → 1.0.1
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 +550 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +356 -2
- package/addon-main.cjs +4 -0
- package/dist/-private/checkable.d.ts +21 -0
- package/dist/-private/checkable.d.ts.map +1 -0
- package/dist/-private/checkable.js +80 -0
- package/dist/-private/control.d.ts +18 -0
- package/dist/-private/control.d.ts.map +1 -0
- package/dist/-private/control.js +55 -0
- package/dist/-private/menu.d.ts +145 -0
- package/dist/-private/menu.d.ts.map +1 -0
- package/dist/-private/menu.js +322 -0
- package/dist/-private/overlay.d.ts +9 -0
- package/dist/-private/overlay.d.ts.map +1 -0
- package/dist/-private/overlay.js +39 -0
- package/dist/-private/showing.d.ts +7 -0
- package/dist/-private/showing.d.ts.map +1 -0
- package/dist/-private/showing.js +10 -0
- package/dist/-private/size.d.ts +10 -0
- package/dist/-private/size.d.ts.map +1 -0
- package/dist/-private/size.js +24 -0
- package/dist/-private/tree.d.ts +34 -0
- package/dist/-private/tree.d.ts.map +1 -0
- package/dist/-private/tree.js +80 -0
- package/dist/accordion.d.ts +62 -0
- package/dist/accordion.d.ts.map +1 -0
- package/dist/accordion.js +112 -0
- package/dist/alert-dialog.d.ts +24 -0
- package/dist/alert-dialog.d.ts.map +1 -0
- package/dist/alert-dialog.js +37 -0
- package/dist/alert.d.ts +27 -0
- package/dist/alert.d.ts.map +1 -0
- package/dist/alert.js +43 -0
- package/dist/aspect-ratio.d.ts +21 -0
- package/dist/aspect-ratio.d.ts.map +1 -0
- package/dist/aspect-ratio.js +30 -0
- package/dist/attachment.d.ts +86 -0
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +156 -0
- package/dist/avatar.d.ts +65 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +106 -0
- package/dist/badge.d.ts +29 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +49 -0
- package/dist/breadcrumb.d.ts +36 -0
- package/dist/breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb.js +80 -0
- package/dist/bubble.d.ts +56 -0
- package/dist/bubble.d.ts.map +1 -0
- package/dist/bubble.js +94 -0
- package/dist/button-group.d.ts +34 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +62 -0
- package/dist/button.d.ts +37 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +77 -0
- package/dist/calendar.d.ts +115 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +276 -0
- package/dist/card.d.ts +31 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +49 -0
- package/dist/checkbox.d.ts +46 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +84 -0
- package/dist/child.d.ts +29 -0
- package/dist/child.d.ts.map +1 -0
- package/dist/child.js +27 -0
- package/dist/collapsible.d.ts +44 -0
- package/dist/collapsible.d.ts.map +1 -0
- package/dist/collapsible.js +83 -0
- package/dist/color-scheme.d.ts +44 -0
- package/dist/color-scheme.d.ts.map +1 -0
- package/dist/color-scheme.js +123 -0
- package/dist/combobox.d.ts +114 -0
- package/dist/combobox.d.ts.map +1 -0
- package/dist/combobox.js +293 -0
- package/dist/command.d.ts +92 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +183 -0
- package/dist/context-menu.d.ts +37 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +59 -0
- package/dist/date-picker.d.ts +48 -0
- package/dist/date-picker.d.ts.map +1 -0
- package/dist/date-picker.js +136 -0
- package/dist/dialog.d.ts +64 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +142 -0
- package/dist/drawer.d.ts +63 -0
- package/dist/drawer.d.ts.map +1 -0
- package/dist/drawer.js +136 -0
- package/dist/dropdown-menu.d.ts +35 -0
- package/dist/dropdown-menu.d.ts.map +1 -0
- package/dist/dropdown-menu.js +49 -0
- package/dist/empty.d.ts +29 -0
- package/dist/empty.d.ts.map +1 -0
- package/dist/empty.js +47 -0
- package/dist/field.d.ts +86 -0
- package/dist/field.d.ts.map +1 -0
- package/dist/field.js +150 -0
- package/dist/file-drop.d.ts +74 -0
- package/dist/file-drop.d.ts.map +1 -0
- package/dist/file-drop.js +137 -0
- package/dist/focus.d.ts +54 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +174 -0
- package/dist/harness.d.ts +90 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +189 -0
- package/dist/heading.d.ts +16 -0
- package/dist/heading.d.ts.map +1 -0
- package/dist/heading.js +19 -0
- package/dist/hero.d.ts +21 -0
- package/dist/hero.d.ts.map +1 -0
- package/dist/hero.js +28 -0
- package/dist/hover-card.d.ts +46 -0
- package/dist/hover-card.d.ts.map +1 -0
- package/dist/hover-card.js +85 -0
- package/dist/icon.d.ts +10 -0
- package/dist/icon.d.ts.map +1 -0
- package/dist/icon.js +13 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +87 -0
- package/dist/input-group.d.ts +55 -0
- package/dist/input-group.d.ts.map +1 -0
- package/dist/input-group.js +103 -0
- package/dist/input-otp.d.ts +103 -0
- package/dist/input-otp.d.ts.map +1 -0
- package/dist/input-otp.js +293 -0
- package/dist/input.d.ts +53 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +90 -0
- package/dist/item.d.ts +63 -0
- package/dist/item.d.ts.map +1 -0
- package/dist/item.js +104 -0
- package/dist/kbd.d.ts +28 -0
- package/dist/kbd.d.ts.map +1 -0
- package/dist/kbd.js +36 -0
- package/dist/keys.d.ts +20 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +32 -0
- package/dist/label.d.ts +24 -0
- package/dist/label.d.ts.map +1 -0
- package/dist/label.js +39 -0
- package/dist/layers.d.ts +42 -0
- package/dist/layers.d.ts.map +1 -0
- package/dist/layers.js +70 -0
- package/dist/link.d.ts +44 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +60 -0
- package/dist/marker.d.ts +42 -0
- package/dist/marker.d.ts.map +1 -0
- package/dist/marker.js +73 -0
- package/dist/menubar.d.ts +76 -0
- package/dist/menubar.d.ts.map +1 -0
- package/dist/menubar.js +139 -0
- package/dist/message-scroller.d.ts +101 -0
- package/dist/message-scroller.d.ts.map +1 -0
- package/dist/message-scroller.js +215 -0
- package/dist/message.d.ts +48 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/message.js +72 -0
- package/dist/native-form.d.ts +44 -0
- package/dist/native-form.d.ts.map +1 -0
- package/dist/native-form.js +111 -0
- package/dist/native-select.d.ts +56 -0
- package/dist/native-select.d.ts.map +1 -0
- package/dist/native-select.js +100 -0
- package/dist/navigation-menu.d.ts +97 -0
- package/dist/navigation-menu.d.ts.map +1 -0
- package/dist/navigation-menu.js +207 -0
- package/dist/observers.d.ts +21 -0
- package/dist/observers.d.ts.map +1 -0
- package/dist/observers.js +34 -0
- package/dist/pagination.d.ts +39 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +71 -0
- package/dist/pointer.d.ts +38 -0
- package/dist/pointer.d.ts.map +1 -0
- package/dist/pointer.js +82 -0
- package/dist/popover.d.ts +50 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +90 -0
- package/dist/progress.d.ts +38 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +81 -0
- package/dist/questionnaire.d.ts +117 -0
- package/dist/questionnaire.d.ts.map +1 -0
- package/dist/questionnaire.js +240 -0
- package/dist/radio-group.d.ts +53 -0
- package/dist/radio-group.d.ts.map +1 -0
- package/dist/radio-group.js +95 -0
- package/dist/rating.d.ts +67 -0
- package/dist/rating.d.ts.map +1 -0
- package/dist/rating.js +160 -0
- package/dist/resizable.d.ts +76 -0
- package/dist/resizable.d.ts.map +1 -0
- package/dist/resizable.js +138 -0
- package/dist/routing.d.ts +36 -0
- package/dist/routing.d.ts.map +1 -0
- package/dist/routing.js +50 -0
- package/dist/roving-focus.d.ts +38 -0
- package/dist/roving-focus.d.ts.map +1 -0
- package/dist/roving-focus.js +60 -0
- package/dist/scroll-area.d.ts +58 -0
- package/dist/scroll-area.d.ts.map +1 -0
- package/dist/scroll-area.js +153 -0
- package/dist/scroller.d.ts +41 -0
- package/dist/scroller.d.ts.map +1 -0
- package/dist/scroller.js +65 -0
- package/dist/select.d.ts +98 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +203 -0
- package/dist/selectors.d.ts +44 -0
- package/dist/selectors.d.ts.map +1 -0
- package/dist/selectors.js +63 -0
- package/dist/send-pointer.d.ts +17 -0
- package/dist/send-pointer.d.ts.map +1 -0
- package/dist/send-pointer.js +35 -0
- package/dist/separator.d.ts +26 -0
- package/dist/separator.d.ts.map +1 -0
- package/dist/separator.js +40 -0
- package/dist/shadowed.d.ts +55 -0
- package/dist/shadowed.d.ts.map +1 -0
- package/dist/shadowed.js +97 -0
- package/dist/sheet.d.ts +14 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +15 -0
- package/dist/sidebar.d.ts +159 -0
- package/dist/sidebar.d.ts.map +1 -0
- package/dist/sidebar.js +299 -0
- package/dist/skeleton.d.ts +18 -0
- package/dist/skeleton.d.ts.map +1 -0
- package/dist/skeleton.js +25 -0
- package/dist/slider.d.ts +66 -0
- package/dist/slider.d.ts.map +1 -0
- package/dist/slider.js +155 -0
- package/dist/spinner.d.ts +10 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +13 -0
- package/dist/sticky-footer.d.ts +33 -0
- package/dist/sticky-footer.d.ts.map +1 -0
- package/dist/sticky-footer.js +65 -0
- package/dist/switch.d.ts +44 -0
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.js +77 -0
- package/dist/table.d.ts +41 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +100 -0
- package/dist/tabs.d.ts +66 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +149 -0
- package/dist/test-hooks.d.ts +9 -0
- package/dist/test-hooks.d.ts.map +1 -0
- package/dist/test-hooks.js +1 -0
- package/dist/textarea.d.ts +47 -0
- package/dist/textarea.d.ts.map +1 -0
- package/dist/textarea.js +78 -0
- package/dist/toaster.d.ts +172 -0
- package/dist/toaster.d.ts.map +1 -0
- package/dist/toaster.js +307 -0
- package/dist/toggle-group.d.ts +51 -0
- package/dist/toggle-group.d.ts.map +1 -0
- package/dist/toggle-group.js +97 -0
- package/dist/toggle.d.ts +21 -0
- package/dist/toggle.d.ts.map +1 -0
- package/dist/toggle.js +26 -0
- package/dist/tooltip.d.ts +48 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +91 -0
- package/dist/trace.d.ts +118 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +196 -0
- package/dist/translator.d.ts +34 -0
- package/dist/translator.d.ts.map +1 -0
- package/dist/translator.js +75 -0
- package/dist/zoetrope.d.ts +51 -0
- package/dist/zoetrope.d.ts.map +1 -0
- package/dist/zoetrope.js +94 -0
- package/package.json +68 -3
package/dist/link.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Harness } from './harness.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Drives a `<Link>` from `@ember-joinery/primitives/link`, internal or external: where it goes,
|
|
4
|
+
* whether it is the current page (read from `aria-current`), whether it leaves the app, and
|
|
5
|
+
* following it.
|
|
6
|
+
*
|
|
7
|
+
* const forum = new LinkHarness('forum') // <Link @name="forum">
|
|
8
|
+
* await forum.follow()
|
|
9
|
+
* assert.true(forum.isCurrent)
|
|
10
|
+
*/
|
|
11
|
+
export declare class LinkHarness extends Harness {
|
|
12
|
+
static component: string | readonly string[];
|
|
13
|
+
/** Its `href`, as written. */
|
|
14
|
+
get href(): string | null;
|
|
15
|
+
/** The text it shows, whitespace collapsed. */
|
|
16
|
+
get text(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Its `aria-current`: `page` on the current route, `true` wherever a link with
|
|
19
|
+
* `@activeOnSubPaths` is active (its own route included), and `null` when it isn't current.
|
|
20
|
+
*/
|
|
21
|
+
get current(): string | null;
|
|
22
|
+
/** Whether it is the current page, or a section the current page is in (`aria-current`). */
|
|
23
|
+
get isCurrent(): boolean;
|
|
24
|
+
/** Whether it opens in a new tab (`target="_blank"`), as a link that leaves the app does. */
|
|
25
|
+
get opensInNewTab(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the page it opens is told nothing about this one: `rel` has `noopener` and
|
|
28
|
+
* `noreferrer`.
|
|
29
|
+
*/
|
|
30
|
+
get isIsolated(): boolean;
|
|
31
|
+
/** Clicks it, as a user would: a link to one of the app's routes transitions. */
|
|
32
|
+
follow(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drives an `<ExternalLink>` from `@ember-joinery/primitives/external-link`: a `LinkHarness`
|
|
36
|
+
* that drives only those.
|
|
37
|
+
*
|
|
38
|
+
* const mdn = new ExternalLinkHarness()
|
|
39
|
+
* assert.true(mdn.opensInNewTab && mdn.isIsolated)
|
|
40
|
+
*/
|
|
41
|
+
export declare class ExternalLinkHarness extends LinkHarness {
|
|
42
|
+
static component: string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,OAAO;IACtC,OAAgB,SAAS,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAA4B;IAEjF,8BAA8B;IAC9B,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;IAED,+CAA+C;IAC/C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED,4FAA4F;IAC5F,IAAI,SAAS,IAAI,OAAO,CAGvB;IAED,6FAA6F;IAC7F,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,OAAO,CAGxB;IAED,iFAAiF;IAC3E,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,OAAgB,SAAS,SAAkB;CAC5C"}
|
package/dist/link.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { click } from '@ember/test-helpers';
|
|
2
|
+
import { Harness } from "./harness.js";
|
|
3
|
+
/**
|
|
4
|
+
* Drives a `<Link>` from `@ember-joinery/primitives/link`, internal or external: where it goes,
|
|
5
|
+
* whether it is the current page (read from `aria-current`), whether it leaves the app, and
|
|
6
|
+
* following it.
|
|
7
|
+
*
|
|
8
|
+
* const forum = new LinkHarness('forum') // <Link @name="forum">
|
|
9
|
+
* await forum.follow()
|
|
10
|
+
* assert.true(forum.isCurrent)
|
|
11
|
+
*/
|
|
12
|
+
export class LinkHarness extends Harness {
|
|
13
|
+
static component = ['link', 'external-link'];
|
|
14
|
+
/** Its `href`, as written. */
|
|
15
|
+
get href() {
|
|
16
|
+
return this.element.getAttribute('href');
|
|
17
|
+
}
|
|
18
|
+
/** The text it shows, whitespace collapsed. */
|
|
19
|
+
get text() {
|
|
20
|
+
return (this.element.textContent ?? '').replace(/\s+/g, ' ').trim();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Its `aria-current`: `page` on the current route, `true` wherever a link with
|
|
24
|
+
* `@activeOnSubPaths` is active (its own route included), and `null` when it isn't current.
|
|
25
|
+
*/
|
|
26
|
+
get current() {
|
|
27
|
+
return this.element.getAttribute('aria-current');
|
|
28
|
+
}
|
|
29
|
+
/** Whether it is the current page, or a section the current page is in (`aria-current`). */
|
|
30
|
+
get isCurrent() {
|
|
31
|
+
const current = this.current;
|
|
32
|
+
return current !== null && current !== 'false';
|
|
33
|
+
}
|
|
34
|
+
/** Whether it opens in a new tab (`target="_blank"`), as a link that leaves the app does. */
|
|
35
|
+
get opensInNewTab() {
|
|
36
|
+
return this.element.getAttribute('target') === '_blank';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Whether the page it opens is told nothing about this one: `rel` has `noopener` and
|
|
40
|
+
* `noreferrer`.
|
|
41
|
+
*/
|
|
42
|
+
get isIsolated() {
|
|
43
|
+
const rel = (this.element.getAttribute('rel') ?? '').split(/\s+/);
|
|
44
|
+
return rel.includes('noopener') && rel.includes('noreferrer');
|
|
45
|
+
}
|
|
46
|
+
/** Clicks it, as a user would: a link to one of the app's routes transitions. */
|
|
47
|
+
async follow() {
|
|
48
|
+
await click(this.element);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Drives an `<ExternalLink>` from `@ember-joinery/primitives/external-link`: a `LinkHarness`
|
|
53
|
+
* that drives only those.
|
|
54
|
+
*
|
|
55
|
+
* const mdn = new ExternalLinkHarness()
|
|
56
|
+
* assert.true(mdn.opensInNewTab && mdn.isIsolated)
|
|
57
|
+
*/
|
|
58
|
+
export class ExternalLinkHarness extends LinkHarness {
|
|
59
|
+
static component = 'external-link';
|
|
60
|
+
}
|
package/dist/marker.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Harness } from './harness.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Drives a `<Marker>` from `@ember-joinery/ember`, or an element made a marker with its
|
|
4
|
+
* `asMarker` modifier. It reads the marker's text, look and role, and clicks or focuses one
|
|
5
|
+
* that is a link or a button:
|
|
6
|
+
*
|
|
7
|
+
* const thinking = new MarkerHarness('thinking') // <Marker @name="thinking" role="status">
|
|
8
|
+
* assert.true(thinking.isStatus)
|
|
9
|
+
* assert.strictEqual(thinking.text, 'Thinking...')
|
|
10
|
+
*/
|
|
11
|
+
export declare class MarkerHarness extends Harness {
|
|
12
|
+
static component: string;
|
|
13
|
+
/** All the text it shows, whitespace collapsed. */
|
|
14
|
+
get text(): string;
|
|
15
|
+
/** Its accessible name: its `aria-label`, else its text (the icon is hidden). */
|
|
16
|
+
get label(): string;
|
|
17
|
+
/** Its `@variant`: `default`, `separator` or `border`. */
|
|
18
|
+
get variant(): string | null;
|
|
19
|
+
/** The role it was given, such as `status`, or `null`. */
|
|
20
|
+
get role(): string | null;
|
|
21
|
+
/** Whether assistive technology announces it as it changes: `role="status"`. */
|
|
22
|
+
get isStatus(): boolean;
|
|
23
|
+
/** The icon's slot. Throws when it has none. */
|
|
24
|
+
get icon(): HTMLElement;
|
|
25
|
+
/** Whether it has an icon. */
|
|
26
|
+
get hasIcon(): boolean;
|
|
27
|
+
/** Its content. Throws when it has none. */
|
|
28
|
+
get content(): HTMLElement;
|
|
29
|
+
/** Whether it is a link: an `<a href>`. */
|
|
30
|
+
get isLink(): boolean;
|
|
31
|
+
/** Where it links to, or `null` when it isn't a link. */
|
|
32
|
+
get href(): string | null;
|
|
33
|
+
/** Whether it is a button. */
|
|
34
|
+
get isButton(): boolean;
|
|
35
|
+
/** Whether it has focus. */
|
|
36
|
+
get isFocused(): boolean;
|
|
37
|
+
/** Clicks it, as a user would: follows a link marker, presses a button one. */
|
|
38
|
+
click(): Promise<void>;
|
|
39
|
+
/** Moves focus to it, as tabbing to a link or button marker would. */
|
|
40
|
+
focus(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../src/marker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAMtC;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,OAAgB,SAAS,SAAW;IAEpC,mDAAmD;IACnD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,iFAAiF;IACjF,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,0DAA0D;IAC1D,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED,0DAA0D;IAC1D,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;IAED,gFAAgF;IAChF,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,gDAAgD;IAChD,IAAI,IAAI,IAAI,WAAW,CAEtB;IAED,8BAA8B;IAC9B,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,4CAA4C;IAC5C,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,2CAA2C;IAC3C,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,yDAAyD;IACzD,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;IAED,8BAA8B;IAC9B,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,4BAA4B;IAC5B,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,+EAA+E;IACzE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,sEAAsE;IAChE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/marker.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { click, focus } 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 a `<Marker>` from `@ember-joinery/ember`, or an element made a marker with its
|
|
8
|
+
* `asMarker` modifier. It reads the marker's text, look and role, and clicks or focuses one
|
|
9
|
+
* that is a link or a button:
|
|
10
|
+
*
|
|
11
|
+
* const thinking = new MarkerHarness('thinking') // <Marker @name="thinking" role="status">
|
|
12
|
+
* assert.true(thinking.isStatus)
|
|
13
|
+
* assert.strictEqual(thinking.text, 'Thinking...')
|
|
14
|
+
*/
|
|
15
|
+
export class MarkerHarness extends Harness {
|
|
16
|
+
static component = 'marker';
|
|
17
|
+
/** All the text it shows, whitespace collapsed. */
|
|
18
|
+
get text() {
|
|
19
|
+
return text(this.element);
|
|
20
|
+
}
|
|
21
|
+
/** Its accessible name: its `aria-label`, else its text (the icon is hidden). */
|
|
22
|
+
get label() {
|
|
23
|
+
return this.element.getAttribute('aria-label')?.trim() || this.text;
|
|
24
|
+
}
|
|
25
|
+
/** Its `@variant`: `default`, `separator` or `border`. */
|
|
26
|
+
get variant() {
|
|
27
|
+
return this.element.getAttribute('data-variant');
|
|
28
|
+
}
|
|
29
|
+
/** The role it was given, such as `status`, or `null`. */
|
|
30
|
+
get role() {
|
|
31
|
+
return this.element.getAttribute('role');
|
|
32
|
+
}
|
|
33
|
+
/** Whether assistive technology announces it as it changes: `role="status"`. */
|
|
34
|
+
get isStatus() {
|
|
35
|
+
return this.role === 'status';
|
|
36
|
+
}
|
|
37
|
+
/** The icon's slot. Throws when it has none. */
|
|
38
|
+
get icon() {
|
|
39
|
+
return this.part('icon');
|
|
40
|
+
}
|
|
41
|
+
/** Whether it has an icon. */
|
|
42
|
+
get hasIcon() {
|
|
43
|
+
return this.queryPart('icon') !== null;
|
|
44
|
+
}
|
|
45
|
+
/** Its content. Throws when it has none. */
|
|
46
|
+
get content() {
|
|
47
|
+
return this.part('content');
|
|
48
|
+
}
|
|
49
|
+
/** Whether it is a link: an `<a href>`. */
|
|
50
|
+
get isLink() {
|
|
51
|
+
return this.element instanceof HTMLAnchorElement && this.element.hasAttribute('href');
|
|
52
|
+
}
|
|
53
|
+
/** Where it links to, or `null` when it isn't a link. */
|
|
54
|
+
get href() {
|
|
55
|
+
return this.isLink ? this.element.getAttribute('href') : null;
|
|
56
|
+
}
|
|
57
|
+
/** Whether it is a button. */
|
|
58
|
+
get isButton() {
|
|
59
|
+
return this.element instanceof HTMLButtonElement;
|
|
60
|
+
}
|
|
61
|
+
/** Whether it has focus. */
|
|
62
|
+
get isFocused() {
|
|
63
|
+
return this.element.ownerDocument.activeElement === this.element;
|
|
64
|
+
}
|
|
65
|
+
/** Clicks it, as a user would: follows a link marker, presses a button one. */
|
|
66
|
+
async click() {
|
|
67
|
+
await click(this.element);
|
|
68
|
+
}
|
|
69
|
+
/** Moves focus to it, as tabbing to a link or button marker would. */
|
|
70
|
+
async focus() {
|
|
71
|
+
await focus(this.element);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Harness } from './harness.ts';
|
|
2
|
+
import { MenuLevel } from './-private/menu.ts';
|
|
3
|
+
/**
|
|
4
|
+
* One menu of a menubar: its trigger, in the bar, and its content and items, with a
|
|
5
|
+
* [Dropdown Menu harness's](./dropdown-menu.ts) members for those (`items`, `select()`,
|
|
6
|
+
* `sub()`…). Its content is found through the trigger's `aria-controls`, so it is `null` while
|
|
7
|
+
* the menu is closed.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MenubarMenuLevel extends MenuLevel {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(trigger: () => HTMLElement);
|
|
12
|
+
/** Its trigger in the menubar. */
|
|
13
|
+
get trigger(): HTMLElement;
|
|
14
|
+
/** Whether it is open, from the trigger's `aria-expanded`. */
|
|
15
|
+
get isOpen(): boolean;
|
|
16
|
+
/** Whether its trigger is disabled. */
|
|
17
|
+
get isTriggerDisabled(): boolean;
|
|
18
|
+
/** The content's accessible name: its trigger's text. */
|
|
19
|
+
get label(): string;
|
|
20
|
+
/** The content's text, whitespace collapsed. */
|
|
21
|
+
get text(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Presses the trigger as a pointer does: it opens the menu when it is closed, and closes it
|
|
24
|
+
* when it is open. Focus goes to the content, not an item.
|
|
25
|
+
*/
|
|
26
|
+
toggle(): Promise<void>;
|
|
27
|
+
/** Opens it with a press on its trigger, unless it is open. */
|
|
28
|
+
open(): Promise<void>;
|
|
29
|
+
/** Closes it with a press on its trigger, unless it is closed. */
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Opens it from the keyboard: focus on its trigger, then `key` (Enter, Space or ArrowDown).
|
|
33
|
+
* Focus goes to its first item.
|
|
34
|
+
*/
|
|
35
|
+
openWithKeyboard(key?: 'Enter' | ' ' | 'ArrowDown'): Promise<void>;
|
|
36
|
+
/** Moves the pointer onto its trigger: while another menu is open, that opens this one. */
|
|
37
|
+
hoverTrigger(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Drives a `<Menubar>` from `@ember-joinery/ember` or `@ember-joinery/primitives/menubar`. Its
|
|
41
|
+
* menus are found by their triggers' text, and read through ARIA: a trigger's `aria-expanded`
|
|
42
|
+
* says its menu is open, and the items' roles and `aria-checked` what they are.
|
|
43
|
+
*
|
|
44
|
+
* const menubar = new MenubarHarness()
|
|
45
|
+
* assert.deepEqual(menubar.menus, ['File', 'Edit', 'View'])
|
|
46
|
+
* const file = menubar.menu('File')
|
|
47
|
+
* await file.open()
|
|
48
|
+
* assert.deepEqual(file.items, ['New Tab', 'New Window', 'Share', 'Print...'])
|
|
49
|
+
* await pressKey('ArrowRight') // Edit opens
|
|
50
|
+
* assert.strictEqual(menubar.openMenu, 'Edit')
|
|
51
|
+
* await menubar.menu('Edit').select('Undo')
|
|
52
|
+
*/
|
|
53
|
+
export declare class MenubarHarness extends Harness {
|
|
54
|
+
static component: string;
|
|
55
|
+
/** Each menu's trigger, in order. */
|
|
56
|
+
get triggers(): HTMLElement[];
|
|
57
|
+
/** Each menu's name: its trigger's text, in order. */
|
|
58
|
+
get menus(): string[];
|
|
59
|
+
/** The trigger whose text is `label`. Throws when there is none. */
|
|
60
|
+
trigger(label: string): HTMLElement;
|
|
61
|
+
/** The menu whose trigger's text is `label`. */
|
|
62
|
+
menu(label: string): MenubarMenuLevel;
|
|
63
|
+
/** The name of the menu that is open, or `null`. */
|
|
64
|
+
get openMenu(): string | null;
|
|
65
|
+
/** Whether a menu is open. */
|
|
66
|
+
get isOpen(): boolean;
|
|
67
|
+
/** The name of the menu whose trigger has focus, or `null`. */
|
|
68
|
+
get focusedTrigger(): string | null;
|
|
69
|
+
/** The name of the menu whose trigger Tab lands on (`tabindex="0"`), or `null`. */
|
|
70
|
+
get tabStop(): string | null;
|
|
71
|
+
/** Presses Escape where focus is: it closes the open menu. */
|
|
72
|
+
pressEscape(): Promise<void>;
|
|
73
|
+
/** A press outside the menubar and its menus. */
|
|
74
|
+
pressOutside(): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=menubar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menubar.d.ts","sourceRoot":"","sources":["../src/menubar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAItC,OAAO,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAA;AAI9D;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;;gBAGjC,OAAO,EAAE,MAAM,WAAW;IAQtC,kCAAkC;IAClC,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,8DAA8D;IAC9D,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,uCAAuC;IACvC,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED,yDAAyD;IACzD,IAAI,KAAK,IAAI,MAAM,CAGlB;IAED,gDAAgD;IAChD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,+DAA+D;IACzD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,kEAAkE;IAC5D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;OAGG;IACG,gBAAgB,CAAC,GAAG,GAAE,OAAO,GAAG,GAAG,GAAG,WAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjF,2FAA2F;IACrF,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAe,SAAQ,OAAO;IACzC,OAAgB,SAAS,SAAY;IAErC,qCAAqC;IACrC,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IAED,sDAAsD;IACtD,IAAI,KAAK,IAAI,MAAM,EAAE,CAEpB;IAED,oEAAoE;IACpE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAUnC,gDAAgD;IAChD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAIrC,oDAAoD;IACpD,IAAI,QAAQ,IAAI,MAAM,GAAG,IAAI,CAG5B;IAED,8BAA8B;IAC9B,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,+DAA+D;IAC/D,IAAI,cAAc,IAAI,MAAM,GAAG,IAAI,CAIlC;IAED,mFAAmF;IACnF,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAG3B;IAED,8DAA8D;IACxD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlC,iDAAiD;IAC3C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
|
package/dist/menubar.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { focus } from '@ember/test-helpers';
|
|
2
|
+
import { Harness } from "./harness.js";
|
|
3
|
+
import { pressEscape, pressOutside } from "./layers.js";
|
|
4
|
+
import { hover } from "./pointer.js";
|
|
5
|
+
import { pressKey } from "./focus.js";
|
|
6
|
+
import { MenuLevel, pressAsBrowser } from "./-private/menu.js";
|
|
7
|
+
import { NotFoundError } from "./-private/tree.js";
|
|
8
|
+
import { accessibleName, text } from "./-private/overlay.js";
|
|
9
|
+
/**
|
|
10
|
+
* One menu of a menubar: its trigger, in the bar, and its content and items, with a
|
|
11
|
+
* [Dropdown Menu harness's](./dropdown-menu.ts) members for those (`items`, `select()`,
|
|
12
|
+
* `sub()`…). Its content is found through the trigger's `aria-controls`, so it is `null` while
|
|
13
|
+
* the menu is closed.
|
|
14
|
+
*/
|
|
15
|
+
export class MenubarMenuLevel extends MenuLevel {
|
|
16
|
+
#trigger;
|
|
17
|
+
constructor(trigger) {
|
|
18
|
+
super(() => {
|
|
19
|
+
const id = trigger().getAttribute('aria-controls');
|
|
20
|
+
return id ? document.getElementById(id) : null;
|
|
21
|
+
});
|
|
22
|
+
this.#trigger = trigger;
|
|
23
|
+
}
|
|
24
|
+
/** Its trigger in the menubar. */
|
|
25
|
+
get trigger() {
|
|
26
|
+
return this.#trigger();
|
|
27
|
+
}
|
|
28
|
+
/** Whether it is open, from the trigger's `aria-expanded`. */
|
|
29
|
+
get isOpen() {
|
|
30
|
+
return this.trigger.getAttribute('aria-expanded') === 'true';
|
|
31
|
+
}
|
|
32
|
+
/** Whether its trigger is disabled. */
|
|
33
|
+
get isTriggerDisabled() {
|
|
34
|
+
return this.trigger.hasAttribute('data-disabled');
|
|
35
|
+
}
|
|
36
|
+
/** The content's accessible name: its trigger's text. */
|
|
37
|
+
get label() {
|
|
38
|
+
const content = this.content;
|
|
39
|
+
return content ? accessibleName(content) : '';
|
|
40
|
+
}
|
|
41
|
+
/** The content's text, whitespace collapsed. */
|
|
42
|
+
get text() {
|
|
43
|
+
return text(this.content);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Presses the trigger as a pointer does: it opens the menu when it is closed, and closes it
|
|
47
|
+
* when it is open. Focus goes to the content, not an item.
|
|
48
|
+
*/
|
|
49
|
+
async toggle() {
|
|
50
|
+
await pressAsBrowser(this.trigger);
|
|
51
|
+
}
|
|
52
|
+
/** Opens it with a press on its trigger, unless it is open. */
|
|
53
|
+
async open() {
|
|
54
|
+
if (!this.isOpen)
|
|
55
|
+
await this.toggle();
|
|
56
|
+
}
|
|
57
|
+
/** Closes it with a press on its trigger, unless it is closed. */
|
|
58
|
+
async close() {
|
|
59
|
+
if (this.isOpen)
|
|
60
|
+
await this.toggle();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Opens it from the keyboard: focus on its trigger, then `key` (Enter, Space or ArrowDown).
|
|
64
|
+
* Focus goes to its first item.
|
|
65
|
+
*/
|
|
66
|
+
async openWithKeyboard(key = 'Enter') {
|
|
67
|
+
await focus(this.trigger);
|
|
68
|
+
await pressKey(key);
|
|
69
|
+
}
|
|
70
|
+
/** Moves the pointer onto its trigger: while another menu is open, that opens this one. */
|
|
71
|
+
async hoverTrigger() {
|
|
72
|
+
await hover(this.trigger);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Drives a `<Menubar>` from `@ember-joinery/ember` or `@ember-joinery/primitives/menubar`. Its
|
|
77
|
+
* menus are found by their triggers' text, and read through ARIA: a trigger's `aria-expanded`
|
|
78
|
+
* says its menu is open, and the items' roles and `aria-checked` what they are.
|
|
79
|
+
*
|
|
80
|
+
* const menubar = new MenubarHarness()
|
|
81
|
+
* assert.deepEqual(menubar.menus, ['File', 'Edit', 'View'])
|
|
82
|
+
* const file = menubar.menu('File')
|
|
83
|
+
* await file.open()
|
|
84
|
+
* assert.deepEqual(file.items, ['New Tab', 'New Window', 'Share', 'Print...'])
|
|
85
|
+
* await pressKey('ArrowRight') // Edit opens
|
|
86
|
+
* assert.strictEqual(menubar.openMenu, 'Edit')
|
|
87
|
+
* await menubar.menu('Edit').select('Undo')
|
|
88
|
+
*/
|
|
89
|
+
export class MenubarHarness extends Harness {
|
|
90
|
+
static component = 'menubar';
|
|
91
|
+
/** Each menu's trigger, in order. */
|
|
92
|
+
get triggers() {
|
|
93
|
+
return this.parts('trigger');
|
|
94
|
+
}
|
|
95
|
+
/** Each menu's name: its trigger's text, in order. */
|
|
96
|
+
get menus() {
|
|
97
|
+
return this.triggers.map(text);
|
|
98
|
+
}
|
|
99
|
+
/** The trigger whose text is `label`. Throws when there is none. */
|
|
100
|
+
trigger(label) {
|
|
101
|
+
const trigger = this.triggers.find(element => text(element) === label);
|
|
102
|
+
if (!trigger) {
|
|
103
|
+
throw new NotFoundError(`no menu "${label}" in ${this} (there are: ${this.menus.map(each => `"${each}"`).join(', ')})`);
|
|
104
|
+
}
|
|
105
|
+
return trigger;
|
|
106
|
+
}
|
|
107
|
+
/** The menu whose trigger's text is `label`. */
|
|
108
|
+
menu(label) {
|
|
109
|
+
return new MenubarMenuLevel(() => this.trigger(label));
|
|
110
|
+
}
|
|
111
|
+
/** The name of the menu that is open, or `null`. */
|
|
112
|
+
get openMenu() {
|
|
113
|
+
const open = this.triggers.find(trigger => trigger.getAttribute('aria-expanded') === 'true');
|
|
114
|
+
return open ? text(open) : null;
|
|
115
|
+
}
|
|
116
|
+
/** Whether a menu is open. */
|
|
117
|
+
get isOpen() {
|
|
118
|
+
return this.openMenu !== null;
|
|
119
|
+
}
|
|
120
|
+
/** The name of the menu whose trigger has focus, or `null`. */
|
|
121
|
+
get focusedTrigger() {
|
|
122
|
+
const active = document.activeElement;
|
|
123
|
+
const trigger = this.triggers.find(element => element === active);
|
|
124
|
+
return trigger ? text(trigger) : null;
|
|
125
|
+
}
|
|
126
|
+
/** The name of the menu whose trigger Tab lands on (`tabindex="0"`), or `null`. */
|
|
127
|
+
get tabStop() {
|
|
128
|
+
const trigger = this.triggers.find(element => element.getAttribute('tabindex') === '0');
|
|
129
|
+
return trigger ? text(trigger) : null;
|
|
130
|
+
}
|
|
131
|
+
/** Presses Escape where focus is: it closes the open menu. */
|
|
132
|
+
async pressEscape() {
|
|
133
|
+
await pressEscape();
|
|
134
|
+
}
|
|
135
|
+
/** A press outside the menubar and its menus. */
|
|
136
|
+
async pressOutside() {
|
|
137
|
+
await pressOutside();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Harness } from './harness.ts';
|
|
2
|
+
/** The edges a message scroller can still scroll toward. */
|
|
3
|
+
export interface MessageScrollerEdges {
|
|
4
|
+
start: boolean;
|
|
5
|
+
end: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Drives a `<MessageScroller>` (or the headless `MessageScrollerRoot`) from Joinery: where the
|
|
9
|
+
* transcript is scrolled to, which rows are in view, its scroll buttons, and scrolling it as a
|
|
10
|
+
* reader does, by wheel or by key, which a programmatic scroll doesn't:
|
|
11
|
+
*
|
|
12
|
+
* const chat = new MessageScrollerHarness('chat') // <s.Root @name="chat">
|
|
13
|
+
* assert.true(chat.isAtEnd)
|
|
14
|
+
* await chat.scrollBy(-200) // the reader scrolls up
|
|
15
|
+
* assert.true(chat.canScrollToEnd)
|
|
16
|
+
* await chat.clickButton() // "jump to latest"
|
|
17
|
+
* assert.strictEqual(chat.itemTop('turn-3'), 64)
|
|
18
|
+
*
|
|
19
|
+
* Its actions wait for the scroller to settle: its frames, a smooth scroll's end, and the
|
|
20
|
+
* observers' reports.
|
|
21
|
+
*/
|
|
22
|
+
export declare class MessageScrollerHarness extends Harness {
|
|
23
|
+
#private;
|
|
24
|
+
static component: string;
|
|
25
|
+
/** The viewport, the part that scrolls. */
|
|
26
|
+
get viewport(): HTMLElement;
|
|
27
|
+
/** The content, around the rows. */
|
|
28
|
+
get content(): HTMLElement;
|
|
29
|
+
/** The viewport's accessible name: `Messages` unless it was given another. */
|
|
30
|
+
get label(): string;
|
|
31
|
+
/** Every row, in order. */
|
|
32
|
+
get items(): HTMLElement[];
|
|
33
|
+
/** The `@messageId` of each row that has one, in order. */
|
|
34
|
+
get messageIds(): string[];
|
|
35
|
+
/** The row with this `@messageId`. Throws when there is none. */
|
|
36
|
+
item(messageId: string): HTMLElement;
|
|
37
|
+
/** The `@messageId` of each row marked `@scrollAnchor`, in order. */
|
|
38
|
+
get anchorIds(): string[];
|
|
39
|
+
/** How far the viewport is scrolled down, in pixels. */
|
|
40
|
+
get scrollTop(): number;
|
|
41
|
+
/** How far it can scroll down, in pixels. */
|
|
42
|
+
get maxScrollTop(): number;
|
|
43
|
+
/** Whether it is scrolled to the top, to within a pixel. */
|
|
44
|
+
get isAtStart(): boolean;
|
|
45
|
+
/** Whether it is scrolled to the bottom, to within a pixel. */
|
|
46
|
+
get isAtEnd(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The edges it says it can scroll toward: its `data-scrollable`. `end` stays false while it
|
|
49
|
+
* follows the end, as its button does.
|
|
50
|
+
*/
|
|
51
|
+
get scrollable(): MessageScrollerEdges;
|
|
52
|
+
/** Whether it says there is more above. */
|
|
53
|
+
get canScrollToStart(): boolean;
|
|
54
|
+
/** Whether it says there is more below. */
|
|
55
|
+
get canScrollToEnd(): boolean;
|
|
56
|
+
/** Whether the opening position is still to apply, and the viewport hidden till then. */
|
|
57
|
+
get isPendingScroll(): boolean;
|
|
58
|
+
/** Whether it is scrolling itself to the latest row (`data-autoscrolling`). */
|
|
59
|
+
get isAutoscrolling(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Where a row starts below the viewport's top edge, in CSS pixels: 0 at the top, negative
|
|
62
|
+
* above it.
|
|
63
|
+
*/
|
|
64
|
+
itemTop(messageId: string): number;
|
|
65
|
+
/** Whether any of the row shows in the viewport. */
|
|
66
|
+
isItemVisible(messageId: string): boolean;
|
|
67
|
+
/** The `@messageId` of each row that shows in the viewport, in order. */
|
|
68
|
+
get visibleIds(): string[];
|
|
69
|
+
/** Its scroll button for that edge (`end` by default). Throws when there is none. */
|
|
70
|
+
button(direction?: 'start' | 'end'): HTMLElement;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the button for that edge can be used: there is somewhere to go, so it is shown
|
|
73
|
+
* (`data-active`), and it is neither `inert` (nor inside something that is) nor out of the
|
|
74
|
+
* tab order, which is what a keyboard and assistive technology go by.
|
|
75
|
+
*/
|
|
76
|
+
isButtonActive(direction?: 'start' | 'end'): boolean;
|
|
77
|
+
/** Presses the button for that edge, as a reader would, and waits for the scroll to end. */
|
|
78
|
+
clickButton(direction?: 'start' | 'end'): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Scrolls the viewport to `top`, as a reader's wheel or scrollbar does: that lets go of
|
|
81
|
+
* following and of an anchored turn.
|
|
82
|
+
*/
|
|
83
|
+
scrollTo(top: number): Promise<void>;
|
|
84
|
+
/** Scrolls the viewport by `delta` pixels (negative: up), as a reader's wheel does. */
|
|
85
|
+
scrollBy(delta: number): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Presses a key in the viewport: a scroll key (`ArrowUp`, `ArrowDown`, `PageUp`,
|
|
88
|
+
* `PageDown`, `Home`, `End`, space) scrolls it as the browser would, and is the reader
|
|
89
|
+
* scrolling. A test can't send the browser's own scroll keys, so this moves it the same way.
|
|
90
|
+
*/
|
|
91
|
+
pressKey(key: string): Promise<void>;
|
|
92
|
+
/** Moves focus to the viewport, as tabbing to it would. */
|
|
93
|
+
focus(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Waits for the scroller to settle: its frames, a smooth scroll, the observers' reports, and
|
|
96
|
+
* any entrance its rows play (a finite animation, such as a new message sliding up), which
|
|
97
|
+
* moves a row on screen while it runs.
|
|
98
|
+
*/
|
|
99
|
+
settle(): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=message-scroller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-scroller.d.ts","sourceRoot":"","sources":["../src/message-scroller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,EAAE,OAAO,CAAA;CACb;AA2BD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,SAAQ,OAAO;;IACjD,OAAgB,SAAS,SAAqB;IAE9C,2CAA2C;IAC3C,IAAI,QAAQ,IAAI,WAAW,CAE1B;IAED,oCAAoC;IACpC,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,8EAA8E;IAC9E,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,2BAA2B;IAC3B,IAAI,KAAK,IAAI,WAAW,EAAE,CAEzB;IAED,2DAA2D;IAC3D,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED,iEAAiE;IACjE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW;IAIpC,qEAAqE;IACrE,IAAI,SAAS,IAAI,MAAM,EAAE,CAKxB;IAUD,wDAAwD;IACxD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,6CAA6C;IAC7C,IAAI,YAAY,IAAI,MAAM,CAGzB;IAED,4DAA4D;IAC5D,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,+DAA+D;IAC/D,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,oBAAoB,CAGrC;IAED,2CAA2C;IAC3C,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED,2CAA2C;IAC3C,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,yFAAyF;IACzF,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,+EAA+E;IAC/E,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAMlC,oDAAoD;IACpD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAMzC,yEAAyE;IACzE,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED,qFAAqF;IACrF,MAAM,CAAC,SAAS,GAAE,OAAO,GAAG,KAAa,GAAG,WAAW;IAIvD;;;;OAIG;IACH,cAAc,CAAC,SAAS,GAAE,OAAO,GAAG,KAAa,GAAG,OAAO;IAS3D,4FAA4F;IACtF,WAAW,CAAC,SAAS,GAAE,OAAO,GAAG,KAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpE;;;OAGG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1C,uFAAuF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C;;;;OAIG;IACG,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1C,2DAA2D;IACrD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB9B"}
|