@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.
Files changed (285) hide show
  1. package/CHANGELOG.md +550 -0
  2. package/LICENSE.md +9 -0
  3. package/NOTICE +532 -0
  4. package/README.md +356 -2
  5. package/addon-main.cjs +4 -0
  6. package/dist/-private/checkable.d.ts +21 -0
  7. package/dist/-private/checkable.d.ts.map +1 -0
  8. package/dist/-private/checkable.js +80 -0
  9. package/dist/-private/control.d.ts +18 -0
  10. package/dist/-private/control.d.ts.map +1 -0
  11. package/dist/-private/control.js +55 -0
  12. package/dist/-private/menu.d.ts +145 -0
  13. package/dist/-private/menu.d.ts.map +1 -0
  14. package/dist/-private/menu.js +322 -0
  15. package/dist/-private/overlay.d.ts +9 -0
  16. package/dist/-private/overlay.d.ts.map +1 -0
  17. package/dist/-private/overlay.js +39 -0
  18. package/dist/-private/showing.d.ts +7 -0
  19. package/dist/-private/showing.d.ts.map +1 -0
  20. package/dist/-private/showing.js +10 -0
  21. package/dist/-private/size.d.ts +10 -0
  22. package/dist/-private/size.d.ts.map +1 -0
  23. package/dist/-private/size.js +24 -0
  24. package/dist/-private/tree.d.ts +34 -0
  25. package/dist/-private/tree.d.ts.map +1 -0
  26. package/dist/-private/tree.js +80 -0
  27. package/dist/accordion.d.ts +62 -0
  28. package/dist/accordion.d.ts.map +1 -0
  29. package/dist/accordion.js +112 -0
  30. package/dist/alert-dialog.d.ts +24 -0
  31. package/dist/alert-dialog.d.ts.map +1 -0
  32. package/dist/alert-dialog.js +37 -0
  33. package/dist/alert.d.ts +27 -0
  34. package/dist/alert.d.ts.map +1 -0
  35. package/dist/alert.js +43 -0
  36. package/dist/aspect-ratio.d.ts +21 -0
  37. package/dist/aspect-ratio.d.ts.map +1 -0
  38. package/dist/aspect-ratio.js +30 -0
  39. package/dist/attachment.d.ts +86 -0
  40. package/dist/attachment.d.ts.map +1 -0
  41. package/dist/attachment.js +156 -0
  42. package/dist/avatar.d.ts +65 -0
  43. package/dist/avatar.d.ts.map +1 -0
  44. package/dist/avatar.js +106 -0
  45. package/dist/badge.d.ts +29 -0
  46. package/dist/badge.d.ts.map +1 -0
  47. package/dist/badge.js +49 -0
  48. package/dist/breadcrumb.d.ts +36 -0
  49. package/dist/breadcrumb.d.ts.map +1 -0
  50. package/dist/breadcrumb.js +80 -0
  51. package/dist/bubble.d.ts +56 -0
  52. package/dist/bubble.d.ts.map +1 -0
  53. package/dist/bubble.js +94 -0
  54. package/dist/button-group.d.ts +34 -0
  55. package/dist/button-group.d.ts.map +1 -0
  56. package/dist/button-group.js +62 -0
  57. package/dist/button.d.ts +37 -0
  58. package/dist/button.d.ts.map +1 -0
  59. package/dist/button.js +77 -0
  60. package/dist/calendar.d.ts +115 -0
  61. package/dist/calendar.d.ts.map +1 -0
  62. package/dist/calendar.js +276 -0
  63. package/dist/card.d.ts +31 -0
  64. package/dist/card.d.ts.map +1 -0
  65. package/dist/card.js +49 -0
  66. package/dist/checkbox.d.ts +46 -0
  67. package/dist/checkbox.d.ts.map +1 -0
  68. package/dist/checkbox.js +84 -0
  69. package/dist/child.d.ts +29 -0
  70. package/dist/child.d.ts.map +1 -0
  71. package/dist/child.js +27 -0
  72. package/dist/collapsible.d.ts +44 -0
  73. package/dist/collapsible.d.ts.map +1 -0
  74. package/dist/collapsible.js +83 -0
  75. package/dist/color-scheme.d.ts +44 -0
  76. package/dist/color-scheme.d.ts.map +1 -0
  77. package/dist/color-scheme.js +123 -0
  78. package/dist/combobox.d.ts +114 -0
  79. package/dist/combobox.d.ts.map +1 -0
  80. package/dist/combobox.js +293 -0
  81. package/dist/command.d.ts +92 -0
  82. package/dist/command.d.ts.map +1 -0
  83. package/dist/command.js +183 -0
  84. package/dist/context-menu.d.ts +37 -0
  85. package/dist/context-menu.d.ts.map +1 -0
  86. package/dist/context-menu.js +59 -0
  87. package/dist/date-picker.d.ts +48 -0
  88. package/dist/date-picker.d.ts.map +1 -0
  89. package/dist/date-picker.js +136 -0
  90. package/dist/dialog.d.ts +64 -0
  91. package/dist/dialog.d.ts.map +1 -0
  92. package/dist/dialog.js +142 -0
  93. package/dist/drawer.d.ts +63 -0
  94. package/dist/drawer.d.ts.map +1 -0
  95. package/dist/drawer.js +136 -0
  96. package/dist/dropdown-menu.d.ts +35 -0
  97. package/dist/dropdown-menu.d.ts.map +1 -0
  98. package/dist/dropdown-menu.js +49 -0
  99. package/dist/empty.d.ts +29 -0
  100. package/dist/empty.d.ts.map +1 -0
  101. package/dist/empty.js +47 -0
  102. package/dist/field.d.ts +86 -0
  103. package/dist/field.d.ts.map +1 -0
  104. package/dist/field.js +150 -0
  105. package/dist/file-drop.d.ts +74 -0
  106. package/dist/file-drop.d.ts.map +1 -0
  107. package/dist/file-drop.js +137 -0
  108. package/dist/focus.d.ts +54 -0
  109. package/dist/focus.d.ts.map +1 -0
  110. package/dist/focus.js +174 -0
  111. package/dist/harness.d.ts +90 -0
  112. package/dist/harness.d.ts.map +1 -0
  113. package/dist/harness.js +189 -0
  114. package/dist/heading.d.ts +16 -0
  115. package/dist/heading.d.ts.map +1 -0
  116. package/dist/heading.js +19 -0
  117. package/dist/hero.d.ts +21 -0
  118. package/dist/hero.d.ts.map +1 -0
  119. package/dist/hero.js +28 -0
  120. package/dist/hover-card.d.ts +46 -0
  121. package/dist/hover-card.d.ts.map +1 -0
  122. package/dist/hover-card.js +85 -0
  123. package/dist/icon.d.ts +10 -0
  124. package/dist/icon.d.ts.map +1 -0
  125. package/dist/icon.js +13 -0
  126. package/dist/index.d.ts +86 -0
  127. package/dist/index.d.ts.map +1 -0
  128. package/dist/index.js +87 -0
  129. package/dist/input-group.d.ts +55 -0
  130. package/dist/input-group.d.ts.map +1 -0
  131. package/dist/input-group.js +103 -0
  132. package/dist/input-otp.d.ts +103 -0
  133. package/dist/input-otp.d.ts.map +1 -0
  134. package/dist/input-otp.js +293 -0
  135. package/dist/input.d.ts +53 -0
  136. package/dist/input.d.ts.map +1 -0
  137. package/dist/input.js +90 -0
  138. package/dist/item.d.ts +63 -0
  139. package/dist/item.d.ts.map +1 -0
  140. package/dist/item.js +104 -0
  141. package/dist/kbd.d.ts +28 -0
  142. package/dist/kbd.d.ts.map +1 -0
  143. package/dist/kbd.js +36 -0
  144. package/dist/keys.d.ts +20 -0
  145. package/dist/keys.d.ts.map +1 -0
  146. package/dist/keys.js +32 -0
  147. package/dist/label.d.ts +24 -0
  148. package/dist/label.d.ts.map +1 -0
  149. package/dist/label.js +39 -0
  150. package/dist/layers.d.ts +42 -0
  151. package/dist/layers.d.ts.map +1 -0
  152. package/dist/layers.js +70 -0
  153. package/dist/link.d.ts +44 -0
  154. package/dist/link.d.ts.map +1 -0
  155. package/dist/link.js +60 -0
  156. package/dist/marker.d.ts +42 -0
  157. package/dist/marker.d.ts.map +1 -0
  158. package/dist/marker.js +73 -0
  159. package/dist/menubar.d.ts +76 -0
  160. package/dist/menubar.d.ts.map +1 -0
  161. package/dist/menubar.js +139 -0
  162. package/dist/message-scroller.d.ts +101 -0
  163. package/dist/message-scroller.d.ts.map +1 -0
  164. package/dist/message-scroller.js +215 -0
  165. package/dist/message.d.ts +48 -0
  166. package/dist/message.d.ts.map +1 -0
  167. package/dist/message.js +72 -0
  168. package/dist/native-form.d.ts +44 -0
  169. package/dist/native-form.d.ts.map +1 -0
  170. package/dist/native-form.js +111 -0
  171. package/dist/native-select.d.ts +56 -0
  172. package/dist/native-select.d.ts.map +1 -0
  173. package/dist/native-select.js +100 -0
  174. package/dist/navigation-menu.d.ts +97 -0
  175. package/dist/navigation-menu.d.ts.map +1 -0
  176. package/dist/navigation-menu.js +207 -0
  177. package/dist/observers.d.ts +21 -0
  178. package/dist/observers.d.ts.map +1 -0
  179. package/dist/observers.js +34 -0
  180. package/dist/pagination.d.ts +39 -0
  181. package/dist/pagination.d.ts.map +1 -0
  182. package/dist/pagination.js +71 -0
  183. package/dist/pointer.d.ts +38 -0
  184. package/dist/pointer.d.ts.map +1 -0
  185. package/dist/pointer.js +82 -0
  186. package/dist/popover.d.ts +50 -0
  187. package/dist/popover.d.ts.map +1 -0
  188. package/dist/popover.js +90 -0
  189. package/dist/progress.d.ts +38 -0
  190. package/dist/progress.d.ts.map +1 -0
  191. package/dist/progress.js +81 -0
  192. package/dist/questionnaire.d.ts +117 -0
  193. package/dist/questionnaire.d.ts.map +1 -0
  194. package/dist/questionnaire.js +240 -0
  195. package/dist/radio-group.d.ts +53 -0
  196. package/dist/radio-group.d.ts.map +1 -0
  197. package/dist/radio-group.js +95 -0
  198. package/dist/rating.d.ts +67 -0
  199. package/dist/rating.d.ts.map +1 -0
  200. package/dist/rating.js +160 -0
  201. package/dist/resizable.d.ts +76 -0
  202. package/dist/resizable.d.ts.map +1 -0
  203. package/dist/resizable.js +138 -0
  204. package/dist/routing.d.ts +36 -0
  205. package/dist/routing.d.ts.map +1 -0
  206. package/dist/routing.js +50 -0
  207. package/dist/roving-focus.d.ts +38 -0
  208. package/dist/roving-focus.d.ts.map +1 -0
  209. package/dist/roving-focus.js +60 -0
  210. package/dist/scroll-area.d.ts +58 -0
  211. package/dist/scroll-area.d.ts.map +1 -0
  212. package/dist/scroll-area.js +153 -0
  213. package/dist/scroller.d.ts +41 -0
  214. package/dist/scroller.d.ts.map +1 -0
  215. package/dist/scroller.js +65 -0
  216. package/dist/select.d.ts +98 -0
  217. package/dist/select.d.ts.map +1 -0
  218. package/dist/select.js +203 -0
  219. package/dist/selectors.d.ts +44 -0
  220. package/dist/selectors.d.ts.map +1 -0
  221. package/dist/selectors.js +63 -0
  222. package/dist/send-pointer.d.ts +17 -0
  223. package/dist/send-pointer.d.ts.map +1 -0
  224. package/dist/send-pointer.js +35 -0
  225. package/dist/separator.d.ts +26 -0
  226. package/dist/separator.d.ts.map +1 -0
  227. package/dist/separator.js +40 -0
  228. package/dist/shadowed.d.ts +55 -0
  229. package/dist/shadowed.d.ts.map +1 -0
  230. package/dist/shadowed.js +97 -0
  231. package/dist/sheet.d.ts +14 -0
  232. package/dist/sheet.d.ts.map +1 -0
  233. package/dist/sheet.js +15 -0
  234. package/dist/sidebar.d.ts +159 -0
  235. package/dist/sidebar.d.ts.map +1 -0
  236. package/dist/sidebar.js +299 -0
  237. package/dist/skeleton.d.ts +18 -0
  238. package/dist/skeleton.d.ts.map +1 -0
  239. package/dist/skeleton.js +25 -0
  240. package/dist/slider.d.ts +66 -0
  241. package/dist/slider.d.ts.map +1 -0
  242. package/dist/slider.js +155 -0
  243. package/dist/spinner.d.ts +10 -0
  244. package/dist/spinner.d.ts.map +1 -0
  245. package/dist/spinner.js +13 -0
  246. package/dist/sticky-footer.d.ts +33 -0
  247. package/dist/sticky-footer.d.ts.map +1 -0
  248. package/dist/sticky-footer.js +65 -0
  249. package/dist/switch.d.ts +44 -0
  250. package/dist/switch.d.ts.map +1 -0
  251. package/dist/switch.js +77 -0
  252. package/dist/table.d.ts +41 -0
  253. package/dist/table.d.ts.map +1 -0
  254. package/dist/table.js +100 -0
  255. package/dist/tabs.d.ts +66 -0
  256. package/dist/tabs.d.ts.map +1 -0
  257. package/dist/tabs.js +149 -0
  258. package/dist/test-hooks.d.ts +9 -0
  259. package/dist/test-hooks.d.ts.map +1 -0
  260. package/dist/test-hooks.js +1 -0
  261. package/dist/textarea.d.ts +47 -0
  262. package/dist/textarea.d.ts.map +1 -0
  263. package/dist/textarea.js +78 -0
  264. package/dist/toaster.d.ts +172 -0
  265. package/dist/toaster.d.ts.map +1 -0
  266. package/dist/toaster.js +307 -0
  267. package/dist/toggle-group.d.ts +51 -0
  268. package/dist/toggle-group.d.ts.map +1 -0
  269. package/dist/toggle-group.js +97 -0
  270. package/dist/toggle.d.ts +21 -0
  271. package/dist/toggle.d.ts.map +1 -0
  272. package/dist/toggle.js +26 -0
  273. package/dist/tooltip.d.ts +48 -0
  274. package/dist/tooltip.d.ts.map +1 -0
  275. package/dist/tooltip.js +91 -0
  276. package/dist/trace.d.ts +118 -0
  277. package/dist/trace.d.ts.map +1 -0
  278. package/dist/trace.js +196 -0
  279. package/dist/translator.d.ts +34 -0
  280. package/dist/translator.d.ts.map +1 -0
  281. package/dist/translator.js +75 -0
  282. package/dist/zoetrope.d.ts +51 -0
  283. package/dist/zoetrope.d.ts.map +1 -0
  284. package/dist/zoetrope.js +94 -0
  285. package/package.json +68 -3
package/dist/select.js ADDED
@@ -0,0 +1,203 @@
1
+ import { focus } from '@ember/test-helpers';
2
+ import { Harness } from "./harness.js";
3
+ import { pressKey, typeKeys } from "./focus.js";
4
+ import { pressEscape, pressOutside, press } from "./layers.js";
5
+ import { accessibleName, shownInTopLayer, text } from "./-private/overlay.js";
6
+ import { controlDescription, controlLabel, isMarkedInvalid } from "./-private/control.js";
7
+ import { isDisabled } from "./-private/checkable.js";
8
+ /**
9
+ * Drives a `<Select>` from `@ember-joinery/ember` or `@ember-joinery/primitives/select`: a
10
+ * button (`role="combobox"`) that opens a listbox of options. It reads the state from the
11
+ * trigger's ARIA and the options' (`aria-expanded`, `aria-disabled`, `data-state`), and acts as
12
+ * a user does: a press on the trigger, a press on an option, keys and typeahead.
13
+ *
14
+ * const fruit = new SelectHarness('fruit') // <Select @name="fruit">
15
+ * await fruit.select('banana')
16
+ * assert.strictEqual(fruit.value, 'banana')
17
+ * assert.strictEqual(fruit.valueText, 'Banana')
18
+ *
19
+ * While it is closed its options aren't in the page (as Radix's aren't): read them after
20
+ * `open()`.
21
+ */
22
+ export class SelectHarness extends Harness {
23
+ static component = 'select';
24
+ /** The trigger: the `Trigger` part, or your own element with the `trigger` modifier. */
25
+ get trigger() {
26
+ return this.part('trigger');
27
+ }
28
+ /** The listbox, or `null` while it is closed. */
29
+ get content() {
30
+ return this.queryPart('content');
31
+ }
32
+ /** Whether it is open, from the trigger's `aria-expanded`. */
33
+ get isOpen() {
34
+ return this.trigger.getAttribute('aria-expanded') === 'true';
35
+ }
36
+ /** Whether the listbox is showing in the browser's top layer (itself, or its item-aligned wrapper). */
37
+ get isShown() {
38
+ const content = this.content;
39
+ return shownInTopLayer(content) || shownInTopLayer(content?.parentElement);
40
+ }
41
+ /** Where the listbox went: `item-aligned` over the trigger, or `popper` below it. */
42
+ get position() {
43
+ const content = this.content;
44
+ if (!content)
45
+ return null;
46
+ return content.parentElement?.getAttribute('data-test-jn-part') === 'content-wrapper'
47
+ ? 'item-aligned'
48
+ : 'popper';
49
+ }
50
+ /** The side the `popper` listbox was placed on, after any flip (`data-side`). */
51
+ get side() {
52
+ return this.content?.getAttribute('data-side') ?? null;
53
+ }
54
+ /** The chosen value, or `''` while none is chosen. */
55
+ get value() {
56
+ return this.element.getAttribute('data-test-jn-value') ?? '';
57
+ }
58
+ /** What the trigger's value shows: the chosen option's text, or the placeholder. */
59
+ get valueText() {
60
+ return text(this.queryPart('value') ?? this.trigger);
61
+ }
62
+ /** Whether the value shows its placeholder (the trigger's `data-placeholder`). */
63
+ get isPlaceholder() {
64
+ return this.trigger.hasAttribute('data-placeholder');
65
+ }
66
+ /**
67
+ * The trigger's accessible name: `aria-labelledby`'s text, else `aria-label`, else its
68
+ * `<label>`'s text (a combobox isn't named by its own text).
69
+ */
70
+ get label() {
71
+ return controlLabel(this.#control);
72
+ }
73
+ /** The text of what the trigger's `aria-describedby` names (a field's description and errors). */
74
+ get description() {
75
+ return controlDescription(this.#control);
76
+ }
77
+ /** The trigger, read as a labelled control: a `<button>` has `labels` too. */
78
+ get #control() {
79
+ return this.trigger;
80
+ }
81
+ /** The listbox's accessible name (its trigger, unless you named it). */
82
+ get contentLabel() {
83
+ const content = this.content;
84
+ return content ? accessibleName(content) : '';
85
+ }
86
+ /** Whether it is disabled: the trigger's `disabled`, or `aria-disabled="true"` on your own element. */
87
+ get isDisabled() {
88
+ return isDisabled(this.trigger);
89
+ }
90
+ /** Whether the trigger is marked invalid with `aria-invalid`. */
91
+ get isInvalid() {
92
+ return isMarkedInvalid(this.trigger);
93
+ }
94
+ /** Whether it is marked required (`aria-required`). */
95
+ get isRequired() {
96
+ return this.trigger.getAttribute('aria-required') === 'true';
97
+ }
98
+ /** Whether the trigger has focus. */
99
+ get isFocused() {
100
+ return document.activeElement === this.trigger;
101
+ }
102
+ /** The options' elements, in order (while open). */
103
+ get optionElements() {
104
+ return this.parts('option');
105
+ }
106
+ /** Every option's value, in order (while open). */
107
+ get options() {
108
+ return this.values('option');
109
+ }
110
+ /** Every option's text, in order (while open). */
111
+ get optionTexts() {
112
+ return this.optionElements.map(option => text(option));
113
+ }
114
+ /** The option with this value. Throws when there is none. */
115
+ option(value) {
116
+ return this.part('option', value);
117
+ }
118
+ /** The value of the option that has focus (`data-highlighted`), or `null`. */
119
+ get highlighted() {
120
+ const option = this.optionElements.find(element => element.hasAttribute('data-highlighted'));
121
+ return option?.getAttribute('data-test-jn-value') ?? null;
122
+ }
123
+ /** Whether the option with this value is the chosen one (`data-state="checked"`). */
124
+ isOptionSelected(value) {
125
+ return this.option(value).getAttribute('data-state') === 'checked';
126
+ }
127
+ /** Whether the option with this value can't be chosen (`aria-disabled`). */
128
+ isOptionDisabled(value) {
129
+ return this.option(value).getAttribute('aria-disabled') === 'true';
130
+ }
131
+ /** Each group's label, in order (while open). */
132
+ get groups() {
133
+ return this.parts('group').map(group => {
134
+ const id = group.getAttribute('aria-labelledby');
135
+ return id ? text(document.getElementById(id)) : '';
136
+ });
137
+ }
138
+ /** The values of the options in the group with this label. */
139
+ optionsIn(group) {
140
+ const found = this.parts('group').find(element => {
141
+ const id = element.getAttribute('aria-labelledby');
142
+ return id ? text(document.getElementById(id)) === group : false;
143
+ });
144
+ if (!found)
145
+ throw new Error(`Joinery harness: no group "${group}" in ${this}`);
146
+ return [...found.querySelectorAll('[data-test-jn-part="option"]')].map(option => option.getAttribute('data-test-jn-value') ?? '');
147
+ }
148
+ /** Whether the "scroll up" and "scroll down" buttons are showing. */
149
+ get canScrollUp() {
150
+ return this.queryPart('scroll-up-button') !== null;
151
+ }
152
+ get canScrollDown() {
153
+ return this.queryPart('scroll-down-button') !== null;
154
+ }
155
+ /** The hidden native `<select>` that carries the value in a form, or `null` outside one. */
156
+ get nativeSelect() {
157
+ return this.queryPart('native-select');
158
+ }
159
+ /** Opens it with a press on the trigger, as a mouse does, unless it is open. */
160
+ async open() {
161
+ if (!this.isOpen)
162
+ await press(this.trigger);
163
+ }
164
+ /** Opens it from the keyboard: focuses the trigger and presses `key` (Enter, Space, or an arrow). */
165
+ async openWithKeyboard(key = 'Enter') {
166
+ await focus(this.trigger);
167
+ await pressKey(key);
168
+ }
169
+ /** Closes it with Escape, unless it is closed. */
170
+ async close() {
171
+ if (this.isOpen)
172
+ await pressEscape();
173
+ }
174
+ /** Presses Escape where focus is. */
175
+ async pressEscape() {
176
+ await pressEscape();
177
+ }
178
+ /** A press outside the listbox, as a user dismissing it makes. */
179
+ async pressOutside() {
180
+ await pressOutside();
181
+ }
182
+ /** Chooses the option with this value: opens it, then presses the option, as a mouse does. */
183
+ async select(value) {
184
+ await this.open();
185
+ await press(this.option(value));
186
+ }
187
+ /** Presses the option with this value (it must be open). */
188
+ async pressOption(value) {
189
+ await press(this.option(value));
190
+ }
191
+ /** Presses a key where focus is: an arrow, Home, End, Enter, Space or Escape. */
192
+ async pressKey(key) {
193
+ await pressKey(key);
194
+ }
195
+ /** Types `text` where focus is: on the closed trigger it chooses, in the open list it moves focus. */
196
+ async typeahead(text) {
197
+ await typeKeys(text);
198
+ }
199
+ /** Moves focus to the trigger. */
200
+ async focus() {
201
+ await focus(this.trigger);
202
+ }
203
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The `data-test-jn-*` attributes every Joinery component renders. They are public API: the
3
+ * harnesses find and scope components with them, and your own tests can too.
4
+ *
5
+ * data-test-jn="<component>" the root of a component instance (`dialog`, `button`…)
6
+ * data-test-jn-name="<@name>" on the root, when the component was given `@name`
7
+ * data-test-jn-part="<part>" a part of the component (`trigger`, `content`, `item`…)
8
+ * data-test-jn-owner="<id>" on a portalled or top-layer part, or one a caller may wrap in
9
+ * another component (a radio item in a Field): its root's `id`
10
+ * data-test-jn-value="<key>" an option, item, tab or toggle, by its key
11
+ * data-test-jn-wrapper on a root that wraps the caller's content (a scroller, a
12
+ * layout): the parts inside it belong to the component around it
13
+ */
14
+ export declare const attributes: {
15
+ readonly component: "data-test-jn";
16
+ readonly name: "data-test-jn-name";
17
+ readonly part: "data-test-jn-part";
18
+ readonly owner: "data-test-jn-owner";
19
+ readonly value: "data-test-jn-value";
20
+ readonly wrapper: "data-test-jn-wrapper";
21
+ };
22
+ /**
23
+ * CSS selectors for the `data-test-jn-*` attributes. Each takes an optional value; without one
24
+ * it matches any element that has the attribute.
25
+ *
26
+ * selectors.component('dialog', 'edit-profile')
27
+ * // '[data-test-jn="dialog"][data-test-jn-name="edit-profile"]'
28
+ * selectors.part('trigger') // '[data-test-jn-part="trigger"]'
29
+ */
30
+ export declare const selectors: {
31
+ /** A component's root, by its kind (`data-test-jn`) and, optionally, its `@name`. */
32
+ component(component?: string, name?: string): string;
33
+ /** A component's root, by its `@name` (`data-test-jn-name`), whatever its kind. */
34
+ name(name?: string): string;
35
+ /** A part (`data-test-jn-part`). */
36
+ part(part?: string): string;
37
+ /** The portalled and top-layer parts of the root whose `id` this is (`data-test-jn-owner`). */
38
+ owner(id?: string): string;
39
+ /** An option, item, tab or toggle, by its key (`data-test-jn-value`). */
40
+ value(key?: string): string;
41
+ /** The root of a component that wraps the caller's content (`data-test-jn-wrapper`). */
42
+ wrapper(): string;
43
+ };
44
+ //# sourceMappingURL=selectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAA;AAWV;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;IACpB,qFAAqF;0BAC/D,MAAM,SAAS,MAAM,GAAG,MAAM;IAMpD,mFAAmF;gBACvE,MAAM,GAAG,MAAM;IAG3B,oCAAoC;gBACxB,MAAM,GAAG,MAAM;IAG3B,+FAA+F;eACpF,MAAM,GAAG,MAAM;IAG1B,yEAAyE;gBAC7D,MAAM,GAAG,MAAM;IAG3B,wFAAwF;eAC7E,MAAM;CAGlB,CAAA"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The `data-test-jn-*` attributes every Joinery component renders. They are public API: the
3
+ * harnesses find and scope components with them, and your own tests can too.
4
+ *
5
+ * data-test-jn="<component>" the root of a component instance (`dialog`, `button`…)
6
+ * data-test-jn-name="<@name>" on the root, when the component was given `@name`
7
+ * data-test-jn-part="<part>" a part of the component (`trigger`, `content`, `item`…)
8
+ * data-test-jn-owner="<id>" on a portalled or top-layer part, or one a caller may wrap in
9
+ * another component (a radio item in a Field): its root's `id`
10
+ * data-test-jn-value="<key>" an option, item, tab or toggle, by its key
11
+ * data-test-jn-wrapper on a root that wraps the caller's content (a scroller, a
12
+ * layout): the parts inside it belong to the component around it
13
+ */
14
+ export const attributes = {
15
+ component: 'data-test-jn',
16
+ name: 'data-test-jn-name',
17
+ part: 'data-test-jn-part',
18
+ owner: 'data-test-jn-owner',
19
+ value: 'data-test-jn-value',
20
+ wrapper: 'data-test-jn-wrapper',
21
+ };
22
+ /** A value made safe to put inside a double-quoted CSS attribute selector. */
23
+ function quote(value) {
24
+ return `"${value.replace(/["\\]/g, '\\$&').replace(/\n/g, '\\a ')}"`;
25
+ }
26
+ function attribute(name, value) {
27
+ return value === undefined ? `[${name}]` : `[${name}=${quote(value)}]`;
28
+ }
29
+ /**
30
+ * CSS selectors for the `data-test-jn-*` attributes. Each takes an optional value; without one
31
+ * it matches any element that has the attribute.
32
+ *
33
+ * selectors.component('dialog', 'edit-profile')
34
+ * // '[data-test-jn="dialog"][data-test-jn-name="edit-profile"]'
35
+ * selectors.part('trigger') // '[data-test-jn-part="trigger"]'
36
+ */
37
+ export const selectors = {
38
+ /** A component's root, by its kind (`data-test-jn`) and, optionally, its `@name`. */
39
+ component(component, name) {
40
+ return (attribute(attributes.component, component) +
41
+ (name === undefined ? '' : attribute(attributes.name, name)));
42
+ },
43
+ /** A component's root, by its `@name` (`data-test-jn-name`), whatever its kind. */
44
+ name(name) {
45
+ return attribute(attributes.name, name);
46
+ },
47
+ /** A part (`data-test-jn-part`). */
48
+ part(part) {
49
+ return attribute(attributes.part, part);
50
+ },
51
+ /** The portalled and top-layer parts of the root whose `id` this is (`data-test-jn-owner`). */
52
+ owner(id) {
53
+ return attribute(attributes.owner, id);
54
+ },
55
+ /** An option, item, tab or toggle, by its key (`data-test-jn-value`). */
56
+ value(key) {
57
+ return attribute(attributes.value, key);
58
+ },
59
+ /** The root of a component that wraps the caller's content (`data-test-jn-wrapper`). */
60
+ wrapper() {
61
+ return attribute(attributes.wrapper);
62
+ },
63
+ };
@@ -0,0 +1,17 @@
1
+ /** The pointer events a mouse sends, which `sendPointer()` dispatches. */
2
+ export type PointerEventType = 'pointerdown' | 'pointermove' | 'pointerup' | 'pointercancel' | 'pointerenter' | 'pointerleave' | 'pointerover' | 'pointerout';
3
+ /**
4
+ * Dispatches one pointer event on `target` as a mouse sends it (a real `PointerEvent`, the
5
+ * primary pointer, the main button), then waits for the app to settle. `pointerenter` and
6
+ * `pointerleave` don't bubble, as in a browser; the rest do. Pass where it is (`clientX`,
7
+ * `clientY`) and anything else to change.
8
+ *
9
+ * await sendPointer(handle, 'pointerdown', { clientX: 100, clientY: 20 })
10
+ * await sendPointer(handle, 'pointermove', { clientX: 140, clientY: 20 })
11
+ * await sendPointer(handle, 'pointerup', { clientX: 140, clientY: 20, buttons: 0 })
12
+ *
13
+ * `@ember/test-helpers`' `triggerEvent` makes a plain `Event` for these, without the
14
+ * `PointerEvent` interface; components that check for one need this.
15
+ */
16
+ export declare function sendPointer(target: Element | Document, type: PointerEventType, init?: PointerEventInit): Promise<PointerEvent>;
17
+ //# sourceMappingURL=send-pointer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-pointer.d.ts","sourceRoot":"","sources":["../src/send-pointer.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,aAAa,GACb,WAAW,GACX,eAAe,GACf,cAAc,GACd,cAAc,GACd,aAAa,GACb,YAAY,CAAA;AAKhB;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,OAAO,GAAG,QAAQ,EAC1B,IAAI,EAAE,gBAAgB,EACtB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAkBvB"}
@@ -0,0 +1,35 @@
1
+ import { settled } from '@ember/test-helpers';
2
+ /** The pointer `sendPointer()` uses: the mouse's. */
3
+ const MOUSE_POINTER_ID = 1;
4
+ /**
5
+ * Dispatches one pointer event on `target` as a mouse sends it (a real `PointerEvent`, the
6
+ * primary pointer, the main button), then waits for the app to settle. `pointerenter` and
7
+ * `pointerleave` don't bubble, as in a browser; the rest do. Pass where it is (`clientX`,
8
+ * `clientY`) and anything else to change.
9
+ *
10
+ * await sendPointer(handle, 'pointerdown', { clientX: 100, clientY: 20 })
11
+ * await sendPointer(handle, 'pointermove', { clientX: 140, clientY: 20 })
12
+ * await sendPointer(handle, 'pointerup', { clientX: 140, clientY: 20, buttons: 0 })
13
+ *
14
+ * `@ember/test-helpers`' `triggerEvent` makes a plain `Event` for these, without the
15
+ * `PointerEvent` interface; components that check for one need this.
16
+ */
17
+ export async function sendPointer(target, type, init = {}) {
18
+ const bubbles = type !== 'pointerenter' && type !== 'pointerleave';
19
+ const pressed = type === 'pointerdown' || type === 'pointermove';
20
+ const event = new PointerEvent(type, {
21
+ bubbles,
22
+ cancelable: true,
23
+ composed: true,
24
+ view: window,
25
+ pointerId: MOUSE_POINTER_ID,
26
+ pointerType: 'mouse',
27
+ isPrimary: true,
28
+ button: type === 'pointermove' ? -1 : 0,
29
+ buttons: pressed ? 1 : 0,
30
+ ...init,
31
+ });
32
+ target.dispatchEvent(event);
33
+ await settled();
34
+ return event;
35
+ }
@@ -0,0 +1,26 @@
1
+ import { Harness } from './harness.ts';
2
+ /**
3
+ * Drives a `<Separator>`, from `@ember-joinery/ember` or `@ember-joinery/primitives/separator`.
4
+ * Everything comes from its ARIA, and `data-orientation` for a decorative one, which has none.
5
+ *
6
+ * const separator = new SeparatorHarness()
7
+ * assert.strictEqual(separator.orientation, 'vertical')
8
+ * assert.true(separator.isDecorative)
9
+ */
10
+ export declare class SeparatorHarness extends Harness {
11
+ static component: string;
12
+ /**
13
+ * Its role as assistive technology sees it: `separator` (an `<hr>`'s own, or `role`), or
14
+ * `none` for a decorative one.
15
+ */
16
+ get role(): string | null;
17
+ /** Whether assistive technology skips it: `role="none"`, or `aria-hidden="true"`. */
18
+ get isDecorative(): boolean;
19
+ /**
20
+ * Which way it runs: `horizontal` or `vertical`. A semantic separator's `aria-orientation`
21
+ * (horizontal when it has none, as the role's default), or a decorative one's
22
+ * `data-orientation`.
23
+ */
24
+ get orientation(): 'horizontal' | 'vertical';
25
+ }
26
+ //# sourceMappingURL=separator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../src/separator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;;;;;;GAOG;AACH,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,OAAgB,SAAS,SAAc;IAEvC;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAKxB;IAED,qFAAqF;IACrF,IAAI,YAAY,IAAI,OAAO,CAM1B;IAED;;;;OAIG;IACH,IAAI,WAAW,IAAI,YAAY,GAAG,UAAU,CAM3C;CACF"}
@@ -0,0 +1,40 @@
1
+ import { Harness } from "./harness.js";
2
+ /**
3
+ * Drives a `<Separator>`, from `@ember-joinery/ember` or `@ember-joinery/primitives/separator`.
4
+ * Everything comes from its ARIA, and `data-orientation` for a decorative one, which has none.
5
+ *
6
+ * const separator = new SeparatorHarness()
7
+ * assert.strictEqual(separator.orientation, 'vertical')
8
+ * assert.true(separator.isDecorative)
9
+ */
10
+ export class SeparatorHarness extends Harness {
11
+ static component = 'separator';
12
+ /**
13
+ * Its role as assistive technology sees it: `separator` (an `<hr>`'s own, or `role`), or
14
+ * `none` for a decorative one.
15
+ */
16
+ get role() {
17
+ const element = this.element;
18
+ const role = element.getAttribute('role');
19
+ if (role)
20
+ return role;
21
+ return element.localName === 'hr' ? 'separator' : null;
22
+ }
23
+ /** Whether assistive technology skips it: `role="none"`, or `aria-hidden="true"`. */
24
+ get isDecorative() {
25
+ const element = this.element;
26
+ const role = element.getAttribute('role');
27
+ return (role === 'none' || role === 'presentation' || element.getAttribute('aria-hidden') === 'true');
28
+ }
29
+ /**
30
+ * Which way it runs: `horizontal` or `vertical`. A semantic separator's `aria-orientation`
31
+ * (horizontal when it has none, as the role's default), or a decorative one's
32
+ * `data-orientation`.
33
+ */
34
+ get orientation() {
35
+ const element = this.element;
36
+ const value = (this.isDecorative ? null : element.getAttribute('aria-orientation')) ??
37
+ element.getAttribute('data-orientation');
38
+ return value === 'vertical' ? 'vertical' : 'horizontal';
39
+ }
40
+ }
@@ -0,0 +1,55 @@
1
+ import { Harness } from './harness.ts';
2
+ /** An element, or a selector for one in the test's root. */
3
+ type Findable = Element | string;
4
+ /**
5
+ * The first element matching `query` in the shadow root of `root` (an element, or a selector),
6
+ * or `null` when there is no such root or element. It is ember-primitives' `findInShadow`.
7
+ *
8
+ * assert.dom(findInShadow('[data-preview]', 'h1')).hasText('Welcome')
9
+ */
10
+ export declare function findInShadow(root: Findable, query: string): Element | null;
11
+ /** Whether an element has a shadow root (an open one). It is ember-primitives' `hasShadowRoot`. */
12
+ export declare function hasShadowRoot(element: Element): boolean;
13
+ /**
14
+ * The first element with a shadow root inside `root` (an element or a selector), or inside the
15
+ * test's root without one. It is ember-primitives' `findShadow`.
16
+ */
17
+ export declare function findShadow(root?: Findable): Element | null;
18
+ /**
19
+ * The first element matching `query` in the first shadow root in the test. Use `findInShadow`
20
+ * when there are several. It is ember-primitives' `findInFirstShadow`.
21
+ */
22
+ export declare function findInFirstShadow(query: string): Element | null;
23
+ /**
24
+ * Drives a `<Shadowed>` from `@ember-joinery/primitives/shadowed`: its shadow root, and what is
25
+ * rendered there. Harnesses don't look into shadow roots, so find what's inside through this.
26
+ *
27
+ * const preview = new ShadowedHarness('preview') // <Shadowed @name="preview">
28
+ * assert.dom(preview.query('h1')).hasText('Welcome')
29
+ */
30
+ export declare class ShadowedHarness extends Harness {
31
+ static component: string;
32
+ /** The element the shadow root is attached to: the `<div>` inside the component's own. */
33
+ get host(): HTMLElement;
34
+ /** The shadow root. */
35
+ get shadowRoot(): ShadowRoot;
36
+ /**
37
+ * The element the content renders in, inside the shadow root. With `@includeStyles`, it
38
+ * starts with the copies of the page's `<style>` and `<link>` elements.
39
+ */
40
+ get content(): HTMLElement;
41
+ /** The first element in the shadow root matching `selector`, or `null`. */
42
+ query<E extends Element = HTMLElement>(selector: string): E | null;
43
+ /** Every element in the shadow root matching `selector`. */
44
+ queryAll<E extends Element = HTMLElement>(selector: string): E[];
45
+ /**
46
+ * The text of what renders in the shadow root, whitespace collapsed. The CSS in a `<style>`
47
+ * (such as the copies `@includeStyles` brings in) and the code in a `<script>` aren't text a
48
+ * reader sees, so they're left out.
49
+ */
50
+ get text(): string;
51
+ /** The style sheets that apply in the shadow root: its own and the ones it adopted. */
52
+ get styleSheetCount(): number;
53
+ }
54
+ export {};
55
+ //# sourceMappingURL=shadowed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadowed.d.ts","sourceRoot":"","sources":["../src/shadowed.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,4DAA4D;AAC5D,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAMhC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAE1E;AAED,mGAAmG;AACnG,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAO1D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAI/D;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,OAAgB,SAAS,SAAa;IAEtC,0FAA0F;IAC1F,IAAI,IAAI,IAAI,WAAW,CAItB;IAED,uBAAuB;IACvB,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,WAAW,CAEzB;IAED,2EAA2E;IAC3E,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAIlE,4DAA4D;IAC5D,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,EAAE;IAIhE;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAUjB;IAED,uFAAuF;IACvF,IAAI,eAAe,IAAI,MAAM,CAE5B;CACF"}
@@ -0,0 +1,97 @@
1
+ import { isString } from '@sindresorhus/is';
2
+ import { find, getRootElement } from '@ember/test-helpers';
3
+ import { Harness } from "./harness.js";
4
+ function resolve(target) {
5
+ return isString(target) ? find(target) : target;
6
+ }
7
+ /**
8
+ * The first element matching `query` in the shadow root of `root` (an element, or a selector),
9
+ * or `null` when there is no such root or element. It is ember-primitives' `findInShadow`.
10
+ *
11
+ * assert.dom(findInShadow('[data-preview]', 'h1')).hasText('Welcome')
12
+ */
13
+ export function findInShadow(root, query) {
14
+ return resolve(root)?.shadowRoot?.querySelector(query) ?? null;
15
+ }
16
+ /** Whether an element has a shadow root (an open one). It is ember-primitives' `hasShadowRoot`. */
17
+ export function hasShadowRoot(element) {
18
+ return Boolean(element.shadowRoot);
19
+ }
20
+ /**
21
+ * The first element with a shadow root inside `root` (an element or a selector), or inside the
22
+ * test's root without one. It is ember-primitives' `findShadow`.
23
+ */
24
+ export function findShadow(root) {
25
+ const scope = root === undefined ? getRootElement() : resolve(root);
26
+ if (!scope)
27
+ return null;
28
+ for (const element of scope.querySelectorAll('*')) {
29
+ if (element.shadowRoot)
30
+ return element;
31
+ }
32
+ return null;
33
+ }
34
+ /**
35
+ * The first element matching `query` in the first shadow root in the test. Use `findInShadow`
36
+ * when there are several. It is ember-primitives' `findInFirstShadow`.
37
+ */
38
+ export function findInFirstShadow(query) {
39
+ const host = findShadow();
40
+ if (!host)
41
+ throw new Error('Joinery: findInFirstShadow found no element with a shadow root');
42
+ return findInShadow(host, query);
43
+ }
44
+ /**
45
+ * Drives a `<Shadowed>` from `@ember-joinery/primitives/shadowed`: its shadow root, and what is
46
+ * rendered there. Harnesses don't look into shadow roots, so find what's inside through this.
47
+ *
48
+ * const preview = new ShadowedHarness('preview') // <Shadowed @name="preview">
49
+ * assert.dom(preview.query('h1')).hasText('Welcome')
50
+ */
51
+ export class ShadowedHarness extends Harness {
52
+ static component = 'shadowed';
53
+ /** The element the shadow root is attached to: the `<div>` inside the component's own. */
54
+ get host() {
55
+ const host = [...this.element.children].find(child => child.shadowRoot);
56
+ if (!host)
57
+ throw new Error(`Joinery harness: ${this} has no shadow root`);
58
+ return host;
59
+ }
60
+ /** The shadow root. */
61
+ get shadowRoot() {
62
+ return this.host.shadowRoot;
63
+ }
64
+ /**
65
+ * The element the content renders in, inside the shadow root. With `@includeStyles`, it
66
+ * starts with the copies of the page's `<style>` and `<link>` elements.
67
+ */
68
+ get content() {
69
+ return this.shadowRoot.lastElementChild;
70
+ }
71
+ /** The first element in the shadow root matching `selector`, or `null`. */
72
+ query(selector) {
73
+ return this.shadowRoot.querySelector(selector);
74
+ }
75
+ /** Every element in the shadow root matching `selector`. */
76
+ queryAll(selector) {
77
+ return [...this.shadowRoot.querySelectorAll(selector)];
78
+ }
79
+ /**
80
+ * The text of what renders in the shadow root, whitespace collapsed. The CSS in a `<style>`
81
+ * (such as the copies `@includeStyles` brings in) and the code in a `<script>` aren't text a
82
+ * reader sees, so they're left out.
83
+ */
84
+ get text() {
85
+ const walker = this.shadowRoot.ownerDocument.createTreeWalker(this.content, NodeFilter.SHOW_TEXT);
86
+ let text = '';
87
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) {
88
+ if (!node.parentElement?.closest('style, script'))
89
+ text += node.nodeValue;
90
+ }
91
+ return text.replace(/\s+/g, ' ').trim();
92
+ }
93
+ /** The style sheets that apply in the shadow root: its own and the ones it adopted. */
94
+ get styleSheetCount() {
95
+ return this.shadowRoot.styleSheets.length + this.shadowRoot.adoptedStyleSheets.length;
96
+ }
97
+ }
@@ -0,0 +1,14 @@
1
+ import { DialogHarness } from './dialog.ts';
2
+ /**
3
+ * Drives a `<Sheet>`: a dialog that slides in from an edge of the screen.
4
+ *
5
+ * const sheet = new SheetHarness()
6
+ * await sheet.open()
7
+ * assert.strictEqual(sheet.side, 'right')
8
+ */
9
+ export declare class SheetHarness extends DialogHarness {
10
+ static component: string;
11
+ /** The edge it comes in from: `top`, `right`, `bottom` or `left` (`data-side`). */
12
+ get side(): string | null;
13
+ }
14
+ //# sourceMappingURL=sheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../src/sheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C;;;;;;GAMG;AACH,qBAAa,YAAa,SAAQ,aAAa;IAC7C,OAAgB,SAAS,SAAU;IAEnC,mFAAmF;IACnF,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;CACF"}
package/dist/sheet.js ADDED
@@ -0,0 +1,15 @@
1
+ import { DialogHarness } from "./dialog.js";
2
+ /**
3
+ * Drives a `<Sheet>`: a dialog that slides in from an edge of the screen.
4
+ *
5
+ * const sheet = new SheetHarness()
6
+ * await sheet.open()
7
+ * assert.strictEqual(sheet.side, 'right')
8
+ */
9
+ export class SheetHarness extends DialogHarness {
10
+ static component = 'sheet';
11
+ /** The edge it comes in from: `top`, `right`, `bottom` or `left` (`data-side`). */
12
+ get side() {
13
+ return this.content?.getAttribute('data-side') ?? null;
14
+ }
15
+ }