@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { attributes } from "../selectors.js";
|
|
2
|
+
/** Thrown when a lookup finds nothing, so `exists` can tell absence from a mistake. */
|
|
3
|
+
export class NotFoundError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(`Joinery harness: ${message}`);
|
|
6
|
+
this.name = 'NotFoundError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Thrown when a lookup finds the wrong thing, such as a harness pointed at another component. */
|
|
10
|
+
export class HarnessError extends Error {
|
|
11
|
+
constructor(message) {
|
|
12
|
+
super(`Joinery harness: ${message}`);
|
|
13
|
+
this.name = 'HarnessError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function isDocument(scope) {
|
|
17
|
+
return scope.nodeType === Node.DOCUMENT_NODE;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The element's parent in the component tree. A portalled or top-layer part names its root in
|
|
21
|
+
* `data-test-jn-owner`, so it hangs under that root wherever it sits in the document; every
|
|
22
|
+
* other element hangs under its DOM parent. An owner id that matches nothing falls back to the
|
|
23
|
+
* DOM parent.
|
|
24
|
+
*/
|
|
25
|
+
export function logicalParent(element) {
|
|
26
|
+
const owner = element.getAttribute(attributes.owner);
|
|
27
|
+
if (owner) {
|
|
28
|
+
const root = element.ownerDocument.getElementById(owner);
|
|
29
|
+
if (root && root !== element)
|
|
30
|
+
return root;
|
|
31
|
+
}
|
|
32
|
+
return element.parentElement;
|
|
33
|
+
}
|
|
34
|
+
/** The element's ancestors in the component tree, nearest first. A cycle ends the walk. */
|
|
35
|
+
function* ancestors(element) {
|
|
36
|
+
const seen = new Set([element]);
|
|
37
|
+
let current = logicalParent(element);
|
|
38
|
+
while (current && !seen.has(current)) {
|
|
39
|
+
seen.add(current);
|
|
40
|
+
yield current;
|
|
41
|
+
current = logicalParent(current);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Whether `element` is inside `scope` in the component tree. An element isn't inside itself. */
|
|
45
|
+
export function isWithin(element, scope) {
|
|
46
|
+
if (isDocument(scope))
|
|
47
|
+
return element.ownerDocument === scope && element.isConnected;
|
|
48
|
+
for (const ancestor of ancestors(element)) {
|
|
49
|
+
if (ancestor === scope)
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The root of the component instance an element belongs to: its nearest `data-test-jn`
|
|
56
|
+
* ancestor. A wrapper's root (`data-test-jn-wrapper`: a scroller, a layout, a heading) is
|
|
57
|
+
* passed over, so what the caller puts inside a wrapper stays the part of the component around
|
|
58
|
+
* it.
|
|
59
|
+
*/
|
|
60
|
+
export function componentOf(element) {
|
|
61
|
+
for (const ancestor of ancestors(element)) {
|
|
62
|
+
if (ancestor.hasAttribute(attributes.component) && !ancestor.hasAttribute(attributes.wrapper))
|
|
63
|
+
return ancestor;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The elements matching `selector` inside `scope` in the component tree, in document order.
|
|
69
|
+
* The search covers the whole document, because a portalled part can be anywhere in it.
|
|
70
|
+
*/
|
|
71
|
+
export function findWithin(scope, selector) {
|
|
72
|
+
const document = isDocument(scope) ? scope : scope.ownerDocument;
|
|
73
|
+
return [...document.querySelectorAll(selector)].filter(element => isWithin(element, scope));
|
|
74
|
+
}
|
|
75
|
+
/** `<div id="x" class="a b">` as `div#x.a.b`, for error messages. */
|
|
76
|
+
export function describeElement(element) {
|
|
77
|
+
const id = element.id ? `#${element.id}` : '';
|
|
78
|
+
const classes = [...element.classList].map(name => `.${name}`).join('');
|
|
79
|
+
return `${element.localName}${id}${classes}`;
|
|
80
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type KeyModifiers } from './focus.ts';
|
|
2
|
+
import { Harness } from './harness.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Drives an `<Accordion>`, from `@ember-joinery/ember` or, headless, from
|
|
5
|
+
* `@ember-joinery/primitives/accordion`. Items are found by their `@value`, and their state is
|
|
6
|
+
* read from each trigger's `aria-expanded`, so every test also checks what assistive technology
|
|
7
|
+
* hears.
|
|
8
|
+
*
|
|
9
|
+
* const faq = new AccordionHarness('faq') // <Accordion @name="faq">
|
|
10
|
+
* await faq.toggle('returns')
|
|
11
|
+
* assert.deepEqual(faq.openValues, ['returns'])
|
|
12
|
+
* await faq.focus('returns')
|
|
13
|
+
* await faq.press('ArrowDown')
|
|
14
|
+
* assert.strictEqual(faq.focused, 'support')
|
|
15
|
+
*/
|
|
16
|
+
export declare class AccordionHarness extends Harness {
|
|
17
|
+
static component: string;
|
|
18
|
+
/** Each item's value, in order. */
|
|
19
|
+
get itemValues(): string[];
|
|
20
|
+
/** The values of the open items, in order. */
|
|
21
|
+
get openValues(): string[];
|
|
22
|
+
/** The item with this value. Throws when there is none. */
|
|
23
|
+
item(value: string): HTMLElement;
|
|
24
|
+
/** The item's header: an `<h3>`, unless given another tag. */
|
|
25
|
+
header(value: string): HTMLElement;
|
|
26
|
+
/** The item's trigger. */
|
|
27
|
+
trigger(value: string): HTMLElement;
|
|
28
|
+
/** The item's content, which is there (`hidden`) while the item is closed. */
|
|
29
|
+
content(value: string): HTMLElement;
|
|
30
|
+
/** Each trigger's text, in order: the accordion's headings. */
|
|
31
|
+
get titles(): string[];
|
|
32
|
+
/** The item's trigger text. */
|
|
33
|
+
title(value: string): string;
|
|
34
|
+
/** The item's content text: `''` while it is closed. */
|
|
35
|
+
text(value: string): string;
|
|
36
|
+
/** Whether the item is open, from its trigger's `aria-expanded`. */
|
|
37
|
+
isOpen(value: string): boolean;
|
|
38
|
+
/** Whether the item's content shows: open, or still animating out. */
|
|
39
|
+
isShown(value: string): boolean;
|
|
40
|
+
/** Whether the item can't be opened or closed: its trigger is `disabled`. */
|
|
41
|
+
isDisabled(value: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the item's trigger can't close it, because it is the open item of a `single`
|
|
44
|
+
* accordion that isn't `@collapsible` (`aria-disabled="true"`).
|
|
45
|
+
*/
|
|
46
|
+
isLocked(value: string): boolean;
|
|
47
|
+
/** `vertical` or `horizontal`, the way the arrow keys move. */
|
|
48
|
+
get orientation(): string | null;
|
|
49
|
+
/** The value of the item whose trigger has focus, or `null` when focus is elsewhere. */
|
|
50
|
+
get focused(): string | null;
|
|
51
|
+
/** Clicks the item's trigger, as a user does. */
|
|
52
|
+
toggle(value: string): Promise<void>;
|
|
53
|
+
/** Opens the item with its trigger, unless it is open. */
|
|
54
|
+
open(value: string): Promise<void>;
|
|
55
|
+
/** Closes the item with its trigger, unless it is closed. */
|
|
56
|
+
close(value: string): Promise<void>;
|
|
57
|
+
/** Moves focus to the item's trigger. */
|
|
58
|
+
focus(value: string): Promise<void>;
|
|
59
|
+
/** Presses a key on the focused trigger: `'ArrowDown'`, `'Home'`, `'End'`. */
|
|
60
|
+
press(key: string, modifiers?: KeyModifiers): Promise<boolean>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../src/accordion.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAQtC;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,OAAgB,SAAS,SAAc;IAEvC,mCAAmC;IACnC,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED,8CAA8C;IAC9C,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED,2DAA2D;IAC3D,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAIhC,8DAA8D;IAC9D,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAIlC,0BAA0B;IAC1B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAInC,8EAA8E;IAC9E,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAInC,+DAA+D;IAC/D,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAED,+BAA+B;IAC/B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI5B,wDAAwD;IACxD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAK3B,oEAAoE;IACpE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI9B,sEAAsE;IACtE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI/B,6EAA6E;IAC7E,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIlC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIhC,+DAA+D;IAC/D,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAE/B;IAED,wFAAwF;IACxF,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAI3B;IAED,iDAAiD;IAC3C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,0DAA0D;IACpD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,6DAA6D;IACvD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,yCAAyC;IACnC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,8EAA8E;IACxE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;CAGrE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { click, focus } from '@ember/test-helpers';
|
|
2
|
+
import { pressKey } from "./focus.js";
|
|
3
|
+
import { Harness } from "./harness.js";
|
|
4
|
+
import { attributes } from "./selectors.js";
|
|
5
|
+
import { isShowing } from "./-private/showing.js";
|
|
6
|
+
function text(element) {
|
|
7
|
+
return (element.textContent ?? '').replace(/\s+/g, ' ').trim();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Drives an `<Accordion>`, from `@ember-joinery/ember` or, headless, from
|
|
11
|
+
* `@ember-joinery/primitives/accordion`. Items are found by their `@value`, and their state is
|
|
12
|
+
* read from each trigger's `aria-expanded`, so every test also checks what assistive technology
|
|
13
|
+
* hears.
|
|
14
|
+
*
|
|
15
|
+
* const faq = new AccordionHarness('faq') // <Accordion @name="faq">
|
|
16
|
+
* await faq.toggle('returns')
|
|
17
|
+
* assert.deepEqual(faq.openValues, ['returns'])
|
|
18
|
+
* await faq.focus('returns')
|
|
19
|
+
* await faq.press('ArrowDown')
|
|
20
|
+
* assert.strictEqual(faq.focused, 'support')
|
|
21
|
+
*/
|
|
22
|
+
export class AccordionHarness extends Harness {
|
|
23
|
+
static component = 'accordion';
|
|
24
|
+
/** Each item's value, in order. */
|
|
25
|
+
get itemValues() {
|
|
26
|
+
return this.values('item');
|
|
27
|
+
}
|
|
28
|
+
/** The values of the open items, in order. */
|
|
29
|
+
get openValues() {
|
|
30
|
+
return this.itemValues.filter(value => this.isOpen(value));
|
|
31
|
+
}
|
|
32
|
+
/** The item with this value. Throws when there is none. */
|
|
33
|
+
item(value) {
|
|
34
|
+
return this.part('item', value);
|
|
35
|
+
}
|
|
36
|
+
/** The item's header: an `<h3>`, unless given another tag. */
|
|
37
|
+
header(value) {
|
|
38
|
+
return this.part('header', value);
|
|
39
|
+
}
|
|
40
|
+
/** The item's trigger. */
|
|
41
|
+
trigger(value) {
|
|
42
|
+
return this.part('trigger', value);
|
|
43
|
+
}
|
|
44
|
+
/** The item's content, which is there (`hidden`) while the item is closed. */
|
|
45
|
+
content(value) {
|
|
46
|
+
return this.part('content', value);
|
|
47
|
+
}
|
|
48
|
+
/** Each trigger's text, in order: the accordion's headings. */
|
|
49
|
+
get titles() {
|
|
50
|
+
return this.parts('trigger').map(text);
|
|
51
|
+
}
|
|
52
|
+
/** The item's trigger text. */
|
|
53
|
+
title(value) {
|
|
54
|
+
return text(this.trigger(value));
|
|
55
|
+
}
|
|
56
|
+
/** The item's content text: `''` while it is closed. */
|
|
57
|
+
text(value) {
|
|
58
|
+
const content = this.content(value);
|
|
59
|
+
return content.hidden ? '' : text(content);
|
|
60
|
+
}
|
|
61
|
+
/** Whether the item is open, from its trigger's `aria-expanded`. */
|
|
62
|
+
isOpen(value) {
|
|
63
|
+
return this.trigger(value).getAttribute('aria-expanded') === 'true';
|
|
64
|
+
}
|
|
65
|
+
/** Whether the item's content shows: open, or still animating out. */
|
|
66
|
+
isShown(value) {
|
|
67
|
+
return isShowing(this.content(value));
|
|
68
|
+
}
|
|
69
|
+
/** Whether the item can't be opened or closed: its trigger is `disabled`. */
|
|
70
|
+
isDisabled(value) {
|
|
71
|
+
return this.trigger(value).hasAttribute('disabled');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Whether the item's trigger can't close it, because it is the open item of a `single`
|
|
75
|
+
* accordion that isn't `@collapsible` (`aria-disabled="true"`).
|
|
76
|
+
*/
|
|
77
|
+
isLocked(value) {
|
|
78
|
+
return this.trigger(value).getAttribute('aria-disabled') === 'true';
|
|
79
|
+
}
|
|
80
|
+
/** `vertical` or `horizontal`, the way the arrow keys move. */
|
|
81
|
+
get orientation() {
|
|
82
|
+
return this.element.getAttribute('data-orientation');
|
|
83
|
+
}
|
|
84
|
+
/** The value of the item whose trigger has focus, or `null` when focus is elsewhere. */
|
|
85
|
+
get focused() {
|
|
86
|
+
const active = document.activeElement;
|
|
87
|
+
const trigger = this.parts('trigger').find(element => element === active);
|
|
88
|
+
return trigger?.getAttribute(attributes.value) ?? null;
|
|
89
|
+
}
|
|
90
|
+
/** Clicks the item's trigger, as a user does. */
|
|
91
|
+
async toggle(value) {
|
|
92
|
+
await click(this.trigger(value));
|
|
93
|
+
}
|
|
94
|
+
/** Opens the item with its trigger, unless it is open. */
|
|
95
|
+
async open(value) {
|
|
96
|
+
if (!this.isOpen(value))
|
|
97
|
+
await this.toggle(value);
|
|
98
|
+
}
|
|
99
|
+
/** Closes the item with its trigger, unless it is closed. */
|
|
100
|
+
async close(value) {
|
|
101
|
+
if (this.isOpen(value))
|
|
102
|
+
await this.toggle(value);
|
|
103
|
+
}
|
|
104
|
+
/** Moves focus to the item's trigger. */
|
|
105
|
+
async focus(value) {
|
|
106
|
+
await focus(this.trigger(value));
|
|
107
|
+
}
|
|
108
|
+
/** Presses a key on the focused trigger: `'ArrowDown'`, `'Home'`, `'End'`. */
|
|
109
|
+
async press(key, modifiers) {
|
|
110
|
+
return pressKey(key, modifiers);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DialogHarness } from './dialog.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Drives an `<AlertDialog>`: a dialog with an action and a cancel button, which a press outside
|
|
4
|
+
* doesn't close.
|
|
5
|
+
*
|
|
6
|
+
* const alert = new AlertDialogHarness('delete')
|
|
7
|
+
* await alert.open()
|
|
8
|
+
* assert.dom(alert.cancelButton).isFocused()
|
|
9
|
+
* await alert.confirm()
|
|
10
|
+
*/
|
|
11
|
+
export declare class AlertDialogHarness extends DialogHarness {
|
|
12
|
+
static component: string;
|
|
13
|
+
/** The action, which confirms. */
|
|
14
|
+
get actionButton(): HTMLElement;
|
|
15
|
+
/** The cancel button, which has focus when it opens. */
|
|
16
|
+
get cancelButton(): HTMLElement;
|
|
17
|
+
/** Clicks the action. */
|
|
18
|
+
confirm(): Promise<void>;
|
|
19
|
+
/** Clicks the cancel button. */
|
|
20
|
+
cancel(): Promise<void>;
|
|
21
|
+
/** Closes it as a user would: with its cancel button, or else Escape. */
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=alert-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../src/alert-dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,OAAgB,SAAS,SAAiB;IAE1C,kCAAkC;IAClC,IAAI,YAAY,IAAI,WAAW,CAE9B;IAED,wDAAwD;IACxD,IAAI,YAAY,IAAI,WAAW,CAE9B;IAED,yBAAyB;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,gCAAgC;IAC1B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,yEAAyE;IAC1D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAItC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { click } from '@ember/test-helpers';
|
|
2
|
+
import { DialogHarness } from "./dialog.js";
|
|
3
|
+
/**
|
|
4
|
+
* Drives an `<AlertDialog>`: a dialog with an action and a cancel button, which a press outside
|
|
5
|
+
* doesn't close.
|
|
6
|
+
*
|
|
7
|
+
* const alert = new AlertDialogHarness('delete')
|
|
8
|
+
* await alert.open()
|
|
9
|
+
* assert.dom(alert.cancelButton).isFocused()
|
|
10
|
+
* await alert.confirm()
|
|
11
|
+
*/
|
|
12
|
+
export class AlertDialogHarness extends DialogHarness {
|
|
13
|
+
static component = 'alert-dialog';
|
|
14
|
+
/** The action, which confirms. */
|
|
15
|
+
get actionButton() {
|
|
16
|
+
return this.part('action');
|
|
17
|
+
}
|
|
18
|
+
/** The cancel button, which has focus when it opens. */
|
|
19
|
+
get cancelButton() {
|
|
20
|
+
return this.part('cancel');
|
|
21
|
+
}
|
|
22
|
+
/** Clicks the action. */
|
|
23
|
+
async confirm() {
|
|
24
|
+
await click(this.actionButton);
|
|
25
|
+
}
|
|
26
|
+
/** Clicks the cancel button. */
|
|
27
|
+
async cancel() {
|
|
28
|
+
await click(this.cancelButton);
|
|
29
|
+
}
|
|
30
|
+
/** Closes it as a user would: with its cancel button, or else Escape. */
|
|
31
|
+
async close() {
|
|
32
|
+
if (this.queryPart('cancel'))
|
|
33
|
+
await this.cancel();
|
|
34
|
+
else
|
|
35
|
+
await this.pressEscape();
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Harness } from './harness.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Drives an `<Alert>` from `@ember-joinery/ember`. It reads the title and description, and
|
|
4
|
+
* finds what is inside, such as the action's button, with `find()`:
|
|
5
|
+
*
|
|
6
|
+
* const alert = new AlertHarness('payment') // <Alert @name="payment">
|
|
7
|
+
* assert.strictEqual(alert.title, 'Payment failed')
|
|
8
|
+
* await alert.find(ButtonHarness).click()
|
|
9
|
+
*/
|
|
10
|
+
export declare class AlertHarness extends Harness {
|
|
11
|
+
static component: string;
|
|
12
|
+
/** All the text it shows, whitespace collapsed. */
|
|
13
|
+
get text(): string;
|
|
14
|
+
/** Its title's text, or `''` without one. */
|
|
15
|
+
get title(): string;
|
|
16
|
+
/** Its description's text, or `''` without one. */
|
|
17
|
+
get description(): string;
|
|
18
|
+
/** Its `@variant`: `default` or `destructive`. */
|
|
19
|
+
get variant(): string | null;
|
|
20
|
+
/** Its role: `alert`, as upstream's, unless given another (`role="status"`). */
|
|
21
|
+
get role(): string | null;
|
|
22
|
+
/** Whether it shows an icon: an `<svg>` of its own, before its text. */
|
|
23
|
+
get hasIcon(): boolean;
|
|
24
|
+
/** The action's container, where its button goes. Throws when it has none. */
|
|
25
|
+
get action(): HTMLElement;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../src/alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAMtC;;;;;;;GAOG;AACH,qBAAa,YAAa,SAAQ,OAAO;IACvC,OAAgB,SAAS,SAAU;IAEnC,mDAAmD;IACnD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,6CAA6C;IAC7C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,mDAAmD;IACnD,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,kDAAkD;IAClD,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED,gFAAgF;IAChF,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;IAED,wEAAwE;IACxE,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,8EAA8E;IAC9E,IAAI,MAAM,IAAI,WAAW,CAExB;CACF"}
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Harness } from "./harness.js";
|
|
2
|
+
function text(element) {
|
|
3
|
+
return (element?.textContent ?? '').replace(/\s+/g, ' ').trim();
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Drives an `<Alert>` from `@ember-joinery/ember`. It reads the title and description, and
|
|
7
|
+
* finds what is inside, such as the action's button, with `find()`:
|
|
8
|
+
*
|
|
9
|
+
* const alert = new AlertHarness('payment') // <Alert @name="payment">
|
|
10
|
+
* assert.strictEqual(alert.title, 'Payment failed')
|
|
11
|
+
* await alert.find(ButtonHarness).click()
|
|
12
|
+
*/
|
|
13
|
+
export class AlertHarness extends Harness {
|
|
14
|
+
static component = 'alert';
|
|
15
|
+
/** All the text it shows, whitespace collapsed. */
|
|
16
|
+
get text() {
|
|
17
|
+
return text(this.element);
|
|
18
|
+
}
|
|
19
|
+
/** Its title's text, or `''` without one. */
|
|
20
|
+
get title() {
|
|
21
|
+
return text(this.queryPart('title'));
|
|
22
|
+
}
|
|
23
|
+
/** Its description's text, or `''` without one. */
|
|
24
|
+
get description() {
|
|
25
|
+
return text(this.queryPart('description'));
|
|
26
|
+
}
|
|
27
|
+
/** Its `@variant`: `default` or `destructive`. */
|
|
28
|
+
get variant() {
|
|
29
|
+
return this.element.getAttribute('data-variant');
|
|
30
|
+
}
|
|
31
|
+
/** Its role: `alert`, as upstream's, unless given another (`role="status"`). */
|
|
32
|
+
get role() {
|
|
33
|
+
return this.element.getAttribute('role');
|
|
34
|
+
}
|
|
35
|
+
/** Whether it shows an icon: an `<svg>` of its own, before its text. */
|
|
36
|
+
get hasIcon() {
|
|
37
|
+
return this.element.querySelector(':scope > svg') !== null;
|
|
38
|
+
}
|
|
39
|
+
/** The action's container, where its button goes. Throws when it has none. */
|
|
40
|
+
get action() {
|
|
41
|
+
return this.part('action');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Harness } from './harness.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Drives an `<AspectRatio>`, from `@ember-joinery/ember` or
|
|
4
|
+
* `@ember-joinery/primitives/aspect-ratio`. Its element is the inner box, which holds the
|
|
5
|
+
* content and takes the ratio.
|
|
6
|
+
*
|
|
7
|
+
* const photo = new AspectRatioHarness()
|
|
8
|
+
* assert.strictEqual(Math.round(photo.ratio * 100) / 100, 1.78) // 16 / 9
|
|
9
|
+
*/
|
|
10
|
+
export declare class AspectRatioHarness extends Harness {
|
|
11
|
+
static component: string;
|
|
12
|
+
/** Its width over its height, as laid out. `NaN` while it takes no space. */
|
|
13
|
+
get ratio(): number;
|
|
14
|
+
/** Its laid-out width, border included, in CSS pixels (a transform on the page doesn't change it). */
|
|
15
|
+
get width(): number;
|
|
16
|
+
/** Its laid-out height, border included, in CSS pixels. */
|
|
17
|
+
get height(): number;
|
|
18
|
+
/** The outer box, which holds the ratio, around the element. */
|
|
19
|
+
get wrapper(): HTMLElement;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=aspect-ratio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aspect-ratio.d.ts","sourceRoot":"","sources":["../src/aspect-ratio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,OAAO;IAC7C,OAAgB,SAAS,SAAiB;IAE1C,6EAA6E;IAC7E,IAAI,KAAK,IAAI,MAAM,CAGlB;IAED,sGAAsG;IACtG,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,2DAA2D;IAC3D,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,gEAAgE;IAChE,IAAI,OAAO,IAAI,WAAW,CAEzB;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Harness } from "./harness.js";
|
|
2
|
+
import { borderBox as size } from "./-private/size.js";
|
|
3
|
+
/**
|
|
4
|
+
* Drives an `<AspectRatio>`, from `@ember-joinery/ember` or
|
|
5
|
+
* `@ember-joinery/primitives/aspect-ratio`. Its element is the inner box, which holds the
|
|
6
|
+
* content and takes the ratio.
|
|
7
|
+
*
|
|
8
|
+
* const photo = new AspectRatioHarness()
|
|
9
|
+
* assert.strictEqual(Math.round(photo.ratio * 100) / 100, 1.78) // 16 / 9
|
|
10
|
+
*/
|
|
11
|
+
export class AspectRatioHarness extends Harness {
|
|
12
|
+
static component = 'aspect-ratio';
|
|
13
|
+
/** Its width over its height, as laid out. `NaN` while it takes no space. */
|
|
14
|
+
get ratio() {
|
|
15
|
+
const { width, height } = size(this.element);
|
|
16
|
+
return height ? width / height : Number.NaN;
|
|
17
|
+
}
|
|
18
|
+
/** Its laid-out width, border included, in CSS pixels (a transform on the page doesn't change it). */
|
|
19
|
+
get width() {
|
|
20
|
+
return size(this.element).width;
|
|
21
|
+
}
|
|
22
|
+
/** Its laid-out height, border included, in CSS pixels. */
|
|
23
|
+
get height() {
|
|
24
|
+
return size(this.element).height;
|
|
25
|
+
}
|
|
26
|
+
/** The outer box, which holds the ratio, around the element. */
|
|
27
|
+
get wrapper() {
|
|
28
|
+
return this.element.parentElement;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ButtonHarness } from './button.ts';
|
|
2
|
+
import { Harness } from './harness.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Drives an `<Attachment>` from `@ember-joinery/ember`. It reads the attachment's name, its
|
|
5
|
+
* metadata and its upload state, finds its actions by their labels, and presses its trigger:
|
|
6
|
+
*
|
|
7
|
+
* const upload = new AttachmentHarness('report') // <Attachment @name="report">
|
|
8
|
+
* assert.strictEqual(upload.title, 'sales-dashboard.pdf')
|
|
9
|
+
* assert.strictEqual(upload.state, 'uploading')
|
|
10
|
+
* await upload.action('Cancel upload').click()
|
|
11
|
+
* await upload.open() // its trigger
|
|
12
|
+
*/
|
|
13
|
+
export declare class AttachmentHarness extends Harness {
|
|
14
|
+
static component: string;
|
|
15
|
+
/** Its `@state`: `idle`, `uploading`, `processing`, `error` or `done`. */
|
|
16
|
+
get state(): string | null;
|
|
17
|
+
/** Its `@size`: `default`, `sm` or `xs`. */
|
|
18
|
+
get size(): string | null;
|
|
19
|
+
/** Its `@orientation`: `horizontal` or `vertical`. */
|
|
20
|
+
get orientation(): string | null;
|
|
21
|
+
/** Whether it is uploading or processing, the states that shimmer its title. */
|
|
22
|
+
get isBusy(): boolean;
|
|
23
|
+
/** Whether its upload failed. */
|
|
24
|
+
get isError(): boolean;
|
|
25
|
+
/** Its title's text, whitespace collapsed, or `''` without one. */
|
|
26
|
+
get title(): string;
|
|
27
|
+
/** Its description's text, whitespace collapsed, or `''` without one. */
|
|
28
|
+
get description(): string;
|
|
29
|
+
/** Its media. Throws when it has none. */
|
|
30
|
+
get media(): HTMLElement;
|
|
31
|
+
/** Its media's `@variant` (`icon` or `image`), or `null` without media. */
|
|
32
|
+
get mediaVariant(): string | null;
|
|
33
|
+
/** The image in its media, or `null` without one. */
|
|
34
|
+
get image(): HTMLImageElement | null;
|
|
35
|
+
/** Its image's `alt`, or `null` without an image. */
|
|
36
|
+
get imageAlt(): string | null;
|
|
37
|
+
/** Its content. Throws when it has none. */
|
|
38
|
+
get content(): HTMLElement;
|
|
39
|
+
/** Its title. Throws when it has none. */
|
|
40
|
+
get titleElement(): HTMLElement;
|
|
41
|
+
/** Its description. Throws when it has none. */
|
|
42
|
+
get descriptionElement(): HTMLElement;
|
|
43
|
+
/** The element holding its actions. Throws when it has none. */
|
|
44
|
+
get actionsElement(): HTMLElement;
|
|
45
|
+
/** A `ButtonHarness` for each of its actions, in order. */
|
|
46
|
+
get actions(): ButtonHarness[];
|
|
47
|
+
/** The accessible name of each of its actions, in order. */
|
|
48
|
+
get actionLabels(): string[];
|
|
49
|
+
/** The action whose accessible name (its `aria-label`, else its text) is `name`. Throws when there is none. */
|
|
50
|
+
action(name: string): ButtonHarness;
|
|
51
|
+
/** Its trigger, the button or link over the whole card. Throws when it has none. */
|
|
52
|
+
get trigger(): HTMLElement;
|
|
53
|
+
/** Whether it has a trigger. */
|
|
54
|
+
get hasTrigger(): boolean;
|
|
55
|
+
/** Its trigger's accessible name, or `''` without one. */
|
|
56
|
+
get triggerLabel(): string;
|
|
57
|
+
/** Where its trigger links to, or `null` when it is a button (or there is none). */
|
|
58
|
+
get href(): string | null;
|
|
59
|
+
/** Presses its trigger, as a user clicking the card would. */
|
|
60
|
+
open(): Promise<void>;
|
|
61
|
+
/** Moves focus to its trigger, as tabbing to it would. */
|
|
62
|
+
focusTrigger(): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Drives an `<AttachmentGroup>` from `@ember-joinery/ember`: a row of attachments that scrolls
|
|
66
|
+
* across.
|
|
67
|
+
*
|
|
68
|
+
* const group = new AttachmentGroupHarness()
|
|
69
|
+
* assert.deepEqual(group.titles, ['workspace.png', 'desk-reference.jpg'])
|
|
70
|
+
* assert.true(group.isScrollable)
|
|
71
|
+
*/
|
|
72
|
+
export declare class AttachmentGroupHarness extends Harness {
|
|
73
|
+
static component: string;
|
|
74
|
+
/** An `AttachmentHarness` for each attachment in the row, in order. */
|
|
75
|
+
get attachments(): AttachmentHarness[];
|
|
76
|
+
/** The title of each attachment, in order. */
|
|
77
|
+
get titles(): string[];
|
|
78
|
+
/** Whether the row is wider than it shows, so it scrolls across. */
|
|
79
|
+
get isScrollable(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* How far it is scrolled across, from its start, in pixels: right to left, a positive
|
|
82
|
+
* distance too.
|
|
83
|
+
*/
|
|
84
|
+
get scrollOffset(): number;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAYtC;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAgB,SAAS,SAAe;IAExC,0EAA0E;IAC1E,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAEzB;IAED,4CAA4C;IAC5C,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;IAED,sDAAsD;IACtD,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAE/B;IAED,gFAAgF;IAChF,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,iCAAiC;IACjC,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,mEAAmE;IACnE,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,yEAAyE;IACzE,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,0CAA0C;IAC1C,IAAI,KAAK,IAAI,WAAW,CAEvB;IAED,2EAA2E;IAC3E,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IAED,qDAAqD;IACrD,IAAI,KAAK,IAAI,gBAAgB,GAAG,IAAI,CAEnC;IAED,qDAAqD;IACrD,IAAI,QAAQ,IAAI,MAAM,GAAG,IAAI,CAE5B;IAED,4CAA4C;IAC5C,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,0CAA0C;IAC1C,IAAI,YAAY,IAAI,WAAW,CAE9B;IAED,gDAAgD;IAChD,IAAI,kBAAkB,IAAI,WAAW,CAEpC;IAED,gEAAgE;IAChE,IAAI,cAAc,IAAI,WAAW,CAEhC;IAED,2DAA2D;IAC3D,IAAI,OAAO,IAAI,aAAa,EAAE,CAI7B;IAED,4DAA4D;IAC5D,IAAI,YAAY,IAAI,MAAM,EAAE,CAE3B;IAED,+GAA+G;IAC/G,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;IAUnC,oFAAoF;IACpF,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,gCAAgC;IAChC,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,0DAA0D;IAC1D,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,oFAAoF;IACpF,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;IAED,8DAA8D;IACxD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,0DAA0D;IACpD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAuB,SAAQ,OAAO;IACjD,OAAgB,SAAS,SAAqB;IAE9C,uEAAuE;IACvE,IAAI,WAAW,IAAI,iBAAiB,EAAE,CAErC;IAED,8CAA8C;IAC9C,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAED,oEAAoE;IACpE,IAAI,YAAY,IAAI,OAAO,CAG1B;IAED;;;OAGG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;CACF"}
|