@baseline-ui/test-utils 0.62.0 → 0.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Acknowledgements.md +0 -53886
- package/dist/index.d.mts +100 -12
- package/dist/index.d.ts +100 -12
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +4 -4
- package/sbom.json +639 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as playwright_test from 'playwright/test';
|
|
2
2
|
import { Page, Locator, FrameLocator } from '@playwright/test';
|
|
3
3
|
import { SinonSpy } from 'sinon';
|
|
4
4
|
|
|
@@ -29,57 +29,57 @@ interface ToBeAccessibleOptions {
|
|
|
29
29
|
attachmentName?: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
declare const expect:
|
|
33
|
-
toBeWithinDelta(this:
|
|
32
|
+
declare const expect: playwright_test.Expect<{
|
|
33
|
+
toBeWithinDelta(this: playwright_test.ExpectMatcherState, received: number, expected: number, delta: number): {
|
|
34
34
|
message: () => string;
|
|
35
35
|
pass: true;
|
|
36
36
|
} | {
|
|
37
37
|
message: () => string;
|
|
38
38
|
pass: false;
|
|
39
39
|
};
|
|
40
|
-
toBeCalledOnce(this:
|
|
40
|
+
toBeCalledOnce(this: playwright_test.ExpectMatcherState, fn: SinonSpy): Promise<{
|
|
41
41
|
message: () => string;
|
|
42
42
|
pass: true;
|
|
43
43
|
} | {
|
|
44
44
|
message: () => string;
|
|
45
45
|
pass: false;
|
|
46
46
|
}>;
|
|
47
|
-
toBeCalledTwice(this:
|
|
47
|
+
toBeCalledTwice(this: playwright_test.ExpectMatcherState, fn: SinonSpy): Promise<{
|
|
48
48
|
message: () => string;
|
|
49
49
|
pass: true;
|
|
50
50
|
} | {
|
|
51
51
|
message: () => string;
|
|
52
52
|
pass: false;
|
|
53
53
|
}>;
|
|
54
|
-
toBeCalledThrice(this:
|
|
54
|
+
toBeCalledThrice(this: playwright_test.ExpectMatcherState, fn: SinonSpy): Promise<{
|
|
55
55
|
message: () => string;
|
|
56
56
|
pass: true;
|
|
57
57
|
} | {
|
|
58
58
|
message: () => string;
|
|
59
59
|
pass: false;
|
|
60
60
|
}>;
|
|
61
|
-
toBeCalledWith(this:
|
|
61
|
+
toBeCalledWith(this: playwright_test.ExpectMatcherState, fn: SinonSpy, ...args: unknown[]): Promise<{
|
|
62
62
|
message: () => string;
|
|
63
63
|
pass: true;
|
|
64
64
|
} | {
|
|
65
65
|
message: () => string;
|
|
66
66
|
pass: false;
|
|
67
67
|
}>;
|
|
68
|
-
toBeCalledWithExactly(this:
|
|
68
|
+
toBeCalledWithExactly(this: playwright_test.ExpectMatcherState, fn: SinonSpy, ...args: unknown[]): Promise<{
|
|
69
69
|
message: () => string;
|
|
70
70
|
pass: true;
|
|
71
71
|
} | {
|
|
72
72
|
message: () => string;
|
|
73
73
|
pass: false;
|
|
74
74
|
}>;
|
|
75
|
-
toBeCalled(this:
|
|
75
|
+
toBeCalled(this: playwright_test.ExpectMatcherState, fn: SinonSpy): {
|
|
76
76
|
message: () => string;
|
|
77
77
|
pass: true;
|
|
78
78
|
} | {
|
|
79
79
|
message: () => string;
|
|
80
80
|
pass: false;
|
|
81
81
|
};
|
|
82
|
-
toBeCalledTimes(this:
|
|
82
|
+
toBeCalledTimes(this: playwright_test.ExpectMatcherState, fn: SinonSpy, times: number): Promise<{
|
|
83
83
|
message: () => string;
|
|
84
84
|
pass: true;
|
|
85
85
|
} | {
|
|
@@ -95,7 +95,7 @@ declare const expect: _playwright_test.Expect<{
|
|
|
95
95
|
message: () => string;
|
|
96
96
|
pass: false;
|
|
97
97
|
}>;
|
|
98
|
-
toMatchClassTree(this:
|
|
98
|
+
toMatchClassTree(this: playwright_test.ExpectMatcherState, locator: Locator, snapshotName?: string, options?: {
|
|
99
99
|
prefix?: string | string[];
|
|
100
100
|
ignoreHashed?: boolean;
|
|
101
101
|
}): Promise<{
|
|
@@ -139,6 +139,92 @@ interface BaseTesterOptions {
|
|
|
139
139
|
*/
|
|
140
140
|
type DisclosureOpenWith = "click" | "Space" | "Enter" | "ArrowDown" | "ArrowUp";
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Options for {@link editorTester}. The Editor has no single disclosure
|
|
144
|
+
* trigger, so instead of `trigger` it accepts `root` — the `.BaselineUI-Editor`
|
|
145
|
+
* container every other locator is scoped to. Pass it when more than one
|
|
146
|
+
* Editor is mounted in the same frame.
|
|
147
|
+
*/
|
|
148
|
+
interface EditorTesterOptions {
|
|
149
|
+
frame: Frame;
|
|
150
|
+
/**
|
|
151
|
+
* The Editor root element. Defaults to `frame.locator(".BaselineUI-Editor")`.
|
|
152
|
+
*/
|
|
153
|
+
root?: Locator;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Driver for an `<Editor>` in Playwright component tests. Construct with
|
|
157
|
+
* {@link editorTester} (or `testers(frame).editor()`).
|
|
158
|
+
*
|
|
159
|
+
* Works for both modes of the component: in rich text mode `textbox` resolves
|
|
160
|
+
* to the contenteditable area, in plain/minimal mode to the `<textarea>` —
|
|
161
|
+
* both expose `role="textbox"`, so no mode flag is needed. Rich-text-only
|
|
162
|
+
* surface (toolbar buttons, link popover, mention dropdown, help dialog)
|
|
163
|
+
* simply won't match when `enableRichText` is off.
|
|
164
|
+
*/
|
|
165
|
+
interface EditorTester {
|
|
166
|
+
readonly root: Locator;
|
|
167
|
+
/**
|
|
168
|
+
* The editing area: the rich text contenteditable or the plain-mode
|
|
169
|
+
* textarea (both have `role="textbox"`).
|
|
170
|
+
*/
|
|
171
|
+
readonly textbox: Locator;
|
|
172
|
+
/**
|
|
173
|
+
* The rich text placeholder overlay, attached only while the document is
|
|
174
|
+
* empty. (In plain mode the placeholder is a `<textarea>` attribute —
|
|
175
|
+
* assert on `textbox` instead.)
|
|
176
|
+
*/
|
|
177
|
+
readonly placeholder: Locator;
|
|
178
|
+
readonly toolbar: Locator;
|
|
179
|
+
readonly boldButton: Locator;
|
|
180
|
+
readonly italicButton: Locator;
|
|
181
|
+
readonly underlineButton: Locator;
|
|
182
|
+
readonly fontColorButton: Locator;
|
|
183
|
+
readonly backgroundColorButton: Locator;
|
|
184
|
+
/**
|
|
185
|
+
* Opens the font color picker popover if it isn't already open.
|
|
186
|
+
* Idempotent — keys off `aria-expanded` on the trigger.
|
|
187
|
+
*/
|
|
188
|
+
openFontColorPicker: (how?: DisclosureOpenWith) => Promise<void>;
|
|
189
|
+
openBackgroundColorPicker: (how?: DisclosureOpenWith) => Promise<void>;
|
|
190
|
+
readonly addLinkButton: Locator;
|
|
191
|
+
readonly linkDialog: Locator;
|
|
192
|
+
readonly linkInput: Locator;
|
|
193
|
+
readonly linkAddButton: Locator;
|
|
194
|
+
/** The "Edit Link" button in show mode (caret inside an existing link). */
|
|
195
|
+
readonly linkEditButton: Locator;
|
|
196
|
+
readonly linkRemoveButton: Locator;
|
|
197
|
+
readonly linkCancelButton: Locator;
|
|
198
|
+
readonly linkSaveButton: Locator;
|
|
199
|
+
openLinkDialog: (how?: DisclosureOpenWith) => Promise<void>;
|
|
200
|
+
readonly saveButton: Locator;
|
|
201
|
+
/** The cancel button (rendered only when `onCancel` is provided). */
|
|
202
|
+
readonly cancelButton: Locator;
|
|
203
|
+
/**
|
|
204
|
+
* The footer mention button (rendered only with rich text +
|
|
205
|
+
* `mentionableUsers`).
|
|
206
|
+
*/
|
|
207
|
+
readonly mentionButton: Locator;
|
|
208
|
+
readonly helpButton: Locator;
|
|
209
|
+
/** The keyboard shortcuts help dialog (a modal, portalled to the body). */
|
|
210
|
+
readonly helpDialog: Locator;
|
|
211
|
+
readonly helpDialogCloseButton: Locator;
|
|
212
|
+
openHelpDialog: () => Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* The inline mention combobox input, attached only while a mention flow is
|
|
215
|
+
* active (after "@" or {@link startMention}).
|
|
216
|
+
*/
|
|
217
|
+
readonly mentionInput: Locator;
|
|
218
|
+
/** The mention suggestion listbox (portalled outside the editor root). */
|
|
219
|
+
readonly mentionListbox: Locator;
|
|
220
|
+
mentionOption: (name: string | RegExp) => Locator;
|
|
221
|
+
/**
|
|
222
|
+
* Starts a mention flow via the footer mention button if one isn't already
|
|
223
|
+
* active. Idempotent — bails when the mention input is visible.
|
|
224
|
+
*/
|
|
225
|
+
startMention: () => Promise<void>;
|
|
226
|
+
}
|
|
227
|
+
|
|
142
228
|
/**
|
|
143
229
|
* Options for {@link selectTester}. Defaults the trigger to
|
|
144
230
|
* `frame.getByTestId("select-button")` (the convention for both single- and
|
|
@@ -272,6 +358,7 @@ interface SelectTesterFactoryFor<O extends {
|
|
|
272
358
|
}
|
|
273
359
|
|
|
274
360
|
type BoundSelectOptions = Omit<SelectTesterOptions, "frame">;
|
|
361
|
+
type BoundEditorOptions = Omit<EditorTesterOptions, "frame">;
|
|
275
362
|
/**
|
|
276
363
|
* The frame-bound tester factory. Methods are flat — one per component — so
|
|
277
364
|
* IDE autocomplete on `t.` lists the full surface in one place. Variants of a
|
|
@@ -283,6 +370,7 @@ type BoundSelectOptions = Omit<SelectTesterOptions, "frame">;
|
|
|
283
370
|
*/
|
|
284
371
|
interface Testers {
|
|
285
372
|
select: SelectTesterFactoryFor<BoundSelectOptions>;
|
|
373
|
+
editor: (options?: BoundEditorOptions) => EditorTester;
|
|
286
374
|
}
|
|
287
375
|
/**
|
|
288
376
|
* Build a frame-bound tester factory. Construct once per test and pick the
|
|
@@ -300,4 +388,4 @@ interface Testers {
|
|
|
300
388
|
*/
|
|
301
389
|
declare function testers(frame: Frame): Testers;
|
|
302
390
|
|
|
303
|
-
export { type AutocompleteTester, DEFAULT_CRITICAL_INCOMPLETE_RULES, DEFAULT_DISABLED_RULES, DEFAULT_WCAG_TAGS, type Frame, type MultiSelectTester, type SelectTester, type Testers, type ToBeAccessibleOptions, expect, testers };
|
|
391
|
+
export { type AutocompleteTester, DEFAULT_CRITICAL_INCOMPLETE_RULES, DEFAULT_DISABLED_RULES, DEFAULT_WCAG_TAGS, type EditorTester, type Frame, type MultiSelectTester, type SelectTester, type Testers, type ToBeAccessibleOptions, expect, testers };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as playwright_test from 'playwright/test';
|
|
2
2
|
import { Page, Locator, FrameLocator } from '@playwright/test';
|
|
3
3
|
import { SinonSpy } from 'sinon';
|
|
4
4
|
|
|
@@ -29,57 +29,57 @@ interface ToBeAccessibleOptions {
|
|
|
29
29
|
attachmentName?: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
declare const expect:
|
|
33
|
-
toBeWithinDelta(this:
|
|
32
|
+
declare const expect: playwright_test.Expect<{
|
|
33
|
+
toBeWithinDelta(this: playwright_test.ExpectMatcherState, received: number, expected: number, delta: number): {
|
|
34
34
|
message: () => string;
|
|
35
35
|
pass: true;
|
|
36
36
|
} | {
|
|
37
37
|
message: () => string;
|
|
38
38
|
pass: false;
|
|
39
39
|
};
|
|
40
|
-
toBeCalledOnce(this:
|
|
40
|
+
toBeCalledOnce(this: playwright_test.ExpectMatcherState, fn: SinonSpy): Promise<{
|
|
41
41
|
message: () => string;
|
|
42
42
|
pass: true;
|
|
43
43
|
} | {
|
|
44
44
|
message: () => string;
|
|
45
45
|
pass: false;
|
|
46
46
|
}>;
|
|
47
|
-
toBeCalledTwice(this:
|
|
47
|
+
toBeCalledTwice(this: playwright_test.ExpectMatcherState, fn: SinonSpy): Promise<{
|
|
48
48
|
message: () => string;
|
|
49
49
|
pass: true;
|
|
50
50
|
} | {
|
|
51
51
|
message: () => string;
|
|
52
52
|
pass: false;
|
|
53
53
|
}>;
|
|
54
|
-
toBeCalledThrice(this:
|
|
54
|
+
toBeCalledThrice(this: playwright_test.ExpectMatcherState, fn: SinonSpy): Promise<{
|
|
55
55
|
message: () => string;
|
|
56
56
|
pass: true;
|
|
57
57
|
} | {
|
|
58
58
|
message: () => string;
|
|
59
59
|
pass: false;
|
|
60
60
|
}>;
|
|
61
|
-
toBeCalledWith(this:
|
|
61
|
+
toBeCalledWith(this: playwright_test.ExpectMatcherState, fn: SinonSpy, ...args: unknown[]): Promise<{
|
|
62
62
|
message: () => string;
|
|
63
63
|
pass: true;
|
|
64
64
|
} | {
|
|
65
65
|
message: () => string;
|
|
66
66
|
pass: false;
|
|
67
67
|
}>;
|
|
68
|
-
toBeCalledWithExactly(this:
|
|
68
|
+
toBeCalledWithExactly(this: playwright_test.ExpectMatcherState, fn: SinonSpy, ...args: unknown[]): Promise<{
|
|
69
69
|
message: () => string;
|
|
70
70
|
pass: true;
|
|
71
71
|
} | {
|
|
72
72
|
message: () => string;
|
|
73
73
|
pass: false;
|
|
74
74
|
}>;
|
|
75
|
-
toBeCalled(this:
|
|
75
|
+
toBeCalled(this: playwright_test.ExpectMatcherState, fn: SinonSpy): {
|
|
76
76
|
message: () => string;
|
|
77
77
|
pass: true;
|
|
78
78
|
} | {
|
|
79
79
|
message: () => string;
|
|
80
80
|
pass: false;
|
|
81
81
|
};
|
|
82
|
-
toBeCalledTimes(this:
|
|
82
|
+
toBeCalledTimes(this: playwright_test.ExpectMatcherState, fn: SinonSpy, times: number): Promise<{
|
|
83
83
|
message: () => string;
|
|
84
84
|
pass: true;
|
|
85
85
|
} | {
|
|
@@ -95,7 +95,7 @@ declare const expect: _playwright_test.Expect<{
|
|
|
95
95
|
message: () => string;
|
|
96
96
|
pass: false;
|
|
97
97
|
}>;
|
|
98
|
-
toMatchClassTree(this:
|
|
98
|
+
toMatchClassTree(this: playwright_test.ExpectMatcherState, locator: Locator, snapshotName?: string, options?: {
|
|
99
99
|
prefix?: string | string[];
|
|
100
100
|
ignoreHashed?: boolean;
|
|
101
101
|
}): Promise<{
|
|
@@ -139,6 +139,92 @@ interface BaseTesterOptions {
|
|
|
139
139
|
*/
|
|
140
140
|
type DisclosureOpenWith = "click" | "Space" | "Enter" | "ArrowDown" | "ArrowUp";
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Options for {@link editorTester}. The Editor has no single disclosure
|
|
144
|
+
* trigger, so instead of `trigger` it accepts `root` — the `.BaselineUI-Editor`
|
|
145
|
+
* container every other locator is scoped to. Pass it when more than one
|
|
146
|
+
* Editor is mounted in the same frame.
|
|
147
|
+
*/
|
|
148
|
+
interface EditorTesterOptions {
|
|
149
|
+
frame: Frame;
|
|
150
|
+
/**
|
|
151
|
+
* The Editor root element. Defaults to `frame.locator(".BaselineUI-Editor")`.
|
|
152
|
+
*/
|
|
153
|
+
root?: Locator;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Driver for an `<Editor>` in Playwright component tests. Construct with
|
|
157
|
+
* {@link editorTester} (or `testers(frame).editor()`).
|
|
158
|
+
*
|
|
159
|
+
* Works for both modes of the component: in rich text mode `textbox` resolves
|
|
160
|
+
* to the contenteditable area, in plain/minimal mode to the `<textarea>` —
|
|
161
|
+
* both expose `role="textbox"`, so no mode flag is needed. Rich-text-only
|
|
162
|
+
* surface (toolbar buttons, link popover, mention dropdown, help dialog)
|
|
163
|
+
* simply won't match when `enableRichText` is off.
|
|
164
|
+
*/
|
|
165
|
+
interface EditorTester {
|
|
166
|
+
readonly root: Locator;
|
|
167
|
+
/**
|
|
168
|
+
* The editing area: the rich text contenteditable or the plain-mode
|
|
169
|
+
* textarea (both have `role="textbox"`).
|
|
170
|
+
*/
|
|
171
|
+
readonly textbox: Locator;
|
|
172
|
+
/**
|
|
173
|
+
* The rich text placeholder overlay, attached only while the document is
|
|
174
|
+
* empty. (In plain mode the placeholder is a `<textarea>` attribute —
|
|
175
|
+
* assert on `textbox` instead.)
|
|
176
|
+
*/
|
|
177
|
+
readonly placeholder: Locator;
|
|
178
|
+
readonly toolbar: Locator;
|
|
179
|
+
readonly boldButton: Locator;
|
|
180
|
+
readonly italicButton: Locator;
|
|
181
|
+
readonly underlineButton: Locator;
|
|
182
|
+
readonly fontColorButton: Locator;
|
|
183
|
+
readonly backgroundColorButton: Locator;
|
|
184
|
+
/**
|
|
185
|
+
* Opens the font color picker popover if it isn't already open.
|
|
186
|
+
* Idempotent — keys off `aria-expanded` on the trigger.
|
|
187
|
+
*/
|
|
188
|
+
openFontColorPicker: (how?: DisclosureOpenWith) => Promise<void>;
|
|
189
|
+
openBackgroundColorPicker: (how?: DisclosureOpenWith) => Promise<void>;
|
|
190
|
+
readonly addLinkButton: Locator;
|
|
191
|
+
readonly linkDialog: Locator;
|
|
192
|
+
readonly linkInput: Locator;
|
|
193
|
+
readonly linkAddButton: Locator;
|
|
194
|
+
/** The "Edit Link" button in show mode (caret inside an existing link). */
|
|
195
|
+
readonly linkEditButton: Locator;
|
|
196
|
+
readonly linkRemoveButton: Locator;
|
|
197
|
+
readonly linkCancelButton: Locator;
|
|
198
|
+
readonly linkSaveButton: Locator;
|
|
199
|
+
openLinkDialog: (how?: DisclosureOpenWith) => Promise<void>;
|
|
200
|
+
readonly saveButton: Locator;
|
|
201
|
+
/** The cancel button (rendered only when `onCancel` is provided). */
|
|
202
|
+
readonly cancelButton: Locator;
|
|
203
|
+
/**
|
|
204
|
+
* The footer mention button (rendered only with rich text +
|
|
205
|
+
* `mentionableUsers`).
|
|
206
|
+
*/
|
|
207
|
+
readonly mentionButton: Locator;
|
|
208
|
+
readonly helpButton: Locator;
|
|
209
|
+
/** The keyboard shortcuts help dialog (a modal, portalled to the body). */
|
|
210
|
+
readonly helpDialog: Locator;
|
|
211
|
+
readonly helpDialogCloseButton: Locator;
|
|
212
|
+
openHelpDialog: () => Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* The inline mention combobox input, attached only while a mention flow is
|
|
215
|
+
* active (after "@" or {@link startMention}).
|
|
216
|
+
*/
|
|
217
|
+
readonly mentionInput: Locator;
|
|
218
|
+
/** The mention suggestion listbox (portalled outside the editor root). */
|
|
219
|
+
readonly mentionListbox: Locator;
|
|
220
|
+
mentionOption: (name: string | RegExp) => Locator;
|
|
221
|
+
/**
|
|
222
|
+
* Starts a mention flow via the footer mention button if one isn't already
|
|
223
|
+
* active. Idempotent — bails when the mention input is visible.
|
|
224
|
+
*/
|
|
225
|
+
startMention: () => Promise<void>;
|
|
226
|
+
}
|
|
227
|
+
|
|
142
228
|
/**
|
|
143
229
|
* Options for {@link selectTester}. Defaults the trigger to
|
|
144
230
|
* `frame.getByTestId("select-button")` (the convention for both single- and
|
|
@@ -272,6 +358,7 @@ interface SelectTesterFactoryFor<O extends {
|
|
|
272
358
|
}
|
|
273
359
|
|
|
274
360
|
type BoundSelectOptions = Omit<SelectTesterOptions, "frame">;
|
|
361
|
+
type BoundEditorOptions = Omit<EditorTesterOptions, "frame">;
|
|
275
362
|
/**
|
|
276
363
|
* The frame-bound tester factory. Methods are flat — one per component — so
|
|
277
364
|
* IDE autocomplete on `t.` lists the full surface in one place. Variants of a
|
|
@@ -283,6 +370,7 @@ type BoundSelectOptions = Omit<SelectTesterOptions, "frame">;
|
|
|
283
370
|
*/
|
|
284
371
|
interface Testers {
|
|
285
372
|
select: SelectTesterFactoryFor<BoundSelectOptions>;
|
|
373
|
+
editor: (options?: BoundEditorOptions) => EditorTester;
|
|
286
374
|
}
|
|
287
375
|
/**
|
|
288
376
|
* Build a frame-bound tester factory. Construct once per test and pick the
|
|
@@ -300,4 +388,4 @@ interface Testers {
|
|
|
300
388
|
*/
|
|
301
389
|
declare function testers(frame: Frame): Testers;
|
|
302
390
|
|
|
303
|
-
export { type AutocompleteTester, DEFAULT_CRITICAL_INCOMPLETE_RULES, DEFAULT_DISABLED_RULES, DEFAULT_WCAG_TAGS, type Frame, type MultiSelectTester, type SelectTester, type Testers, type ToBeAccessibleOptions, expect, testers };
|
|
391
|
+
export { type AutocompleteTester, DEFAULT_CRITICAL_INCOMPLETE_RULES, DEFAULT_DISABLED_RULES, DEFAULT_WCAG_TAGS, type EditorTester, type Frame, type MultiSelectTester, type SelectTester, type Testers, type ToBeAccessibleOptions, expect, testers };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var test=require('@playwright/test')
|
|
1
|
+
'use strict';var test=require('@playwright/test'),_=require('axe-core'),promises=require('fs/promises'),R=require('path');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ___default=/*#__PURE__*/_interopDefault(_);var R__default=/*#__PURE__*/_interopDefault(R);/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
* This notice may not be removed from this file.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
var
|
|
11
|
-
`):
|
|
12
|
-
`)}var
|
|
13
|
-
${
|
|
14
|
-
`);return ` \u2022 [${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
`),
|
|
18
|
-
${
|
|
19
|
-
`,u=test.test.info();if(u.config.ignoreSnapshots)return {message:()=>"Class tree snapshot check skipped.",pass:!0};let
|
|
10
|
+
var w=["wcag2a","wcag2aa","wcag21a","wcag21aa","best-practice"],L=["landmark-one-main","page-has-heading-one","region","aria-allowed-role","duplicate-id","scrollable-region-focusable"],E=["aria-valid-attr-value","aria-valid-attr","aria-required-attr"];function O(e,o={}){let{prefix:t="BaselineUI-",ignoreHashed:n=false}=o,s=Array.isArray(t)?t:[t];function r(l){return l.split(/[-_]/).some(i=>i.length>=5&&/^[a-z\d]+$/.test(i)&&/[a-z]/.test(i)&&/\d/.test(i))}function c(l){return [...l.classList].filter(i=>s.some(g=>i.startsWith(g))&&(!n||!r(i)))}function u(l,i=false){let g=[],b=l.shadowRoot?l.shadowRoot.children:l.children;for(let f of b){let h=i||f.getAttribute("aria-hidden")==="true",B=c(f),x=u(f,h);B.length>0?g.push({classes:B,children:x,hidden:h}):g.push(...x);}return g}function p(l,i="",g=false){let b=[];for(let f=0;f<l.length;f++){let h=l[f],B=f===l.length-1,x=g?"":B?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",v=g?"":i+(B?" ":"\u2502 "),P=h.classes.join(", ");b.push(i+x+P+(h.hidden?" [aria-hidden]":""),...p(h.children,v));}return b}let d=c(e),a=u(e);return d.length===0&&a.length===0?"":d.length>0?p([{classes:d,children:a,hidden:false}],"",true).join(`
|
|
11
|
+
`):p(a,"",true).join(`
|
|
12
|
+
`)}var y=e=>{if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e==null)return "unknown error";try{return JSON.stringify(e)}catch{return "unstringifiable error"}},N=async e=>{let o=typeof e.goto=="function",t=!o&&typeof e.owner=="function";if(o||t)return e.locator("body");let n=e;return await n.first().evaluate(r=>r.tagName?.toLowerCase()==="iframe").catch(()=>false)?n.contentFrame().locator("body"):n},j=async e=>{await e.first().evaluate((o,t)=>{if(window.axe)return;let s=document.createElement("script");s.textContent=t,document.head.append(s);},___default.default.source);},W=["document-title","html-has-lang","html-lang-valid","html-xml-lang-mismatch"],M=(e,o=[])=>{let t=new Set([...L,...o,...e.disableRules??[]]);return {runOnly:{type:"tag",values:[...e.tags??w]},rules:Object.fromEntries([...t].map(n=>[n,{enabled:false}]))}},I=e=>{if(e!==void 0)return typeof e=="string"?[e]:[...e]},H=async(e,o,t)=>{let n=await e.count();if(n===0)throw new Error("toBeAccessible: locator resolved to zero elements; nothing to scan.");await j(e);let s=I(o.include),r=I(o.exclude);return n===1?await e.evaluate(async(c,u)=>{let p=window,d={include:[c,...u.userInclude??[]],exclude:u.userExclude??[]};return await p.axe.run(d,u.runOptions)},{userInclude:s,userExclude:r,runOptions:t}):await e.evaluateAll(async(c,u)=>{let p=window,d={include:[...c,...u.userInclude??[]],exclude:u.userExclude??[]};return await p.axe.run(d,u.runOptions)},{userInclude:s,userExclude:r,runOptions:t})},A="BaselineUI-";function S(e){return e.replaceAll(/\W+/g,"-").replaceAll(/^-|-$/g,"")}function V(e){return Array.isArray(e)?e.length===1&&e[0]===A:e===A}function G(e){return (Array.isArray(e)?e:[e]).join("+")}function z(e,o,t,n,s){let r=o.slice(1).map(c=>S(c));return t&&r.push(S(t)),n!==void 0&&!V(n)&&r.push(S(G(n))),s&&r.push("ignoreHashed"),R__default.default.join(e,`${r.join("--")}.txt`)}var q=test.expect.extend({toBeWithinDelta(e,o,t){return Math.abs(e-o)<=t?{message:()=>`expected ${e} not to be within ${t} of ${o}`,pass:true}:{message:()=>`expected ${e} to be within ${t} of ${o}`,pass:false}},async toBeCalledOnce(e){try{return await test.expect.poll(()=>e.callCount).toBe(1),{message:()=>"Expected function to be called once.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledTwice(e){try{return await test.expect.poll(()=>e.callCount).toBe(2),{message:()=>"Expected function to be called twice.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledThrice(e){try{return await test.expect.poll(()=>e.callCount).toBe(3),{message:()=>"Expected function to be called thrice.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledWith(e,...o){try{return await test.expect(()=>{for(let[t,n]of o.entries())test.expect(e.lastCall?.args?.[t]).toStrictEqual(n);}).toPass(),{message:()=>`Expected function to be called with ${o.join(", ")}.`,pass:!0}}catch(t){return {message:()=>y(t),pass:false}}},async toBeCalledWithExactly(e,...o){try{return await test.expect.poll(()=>e.lastCall?.args).toStrictEqual(o),{message:()=>`Expected function to be called with exactly ${o.join(", ")}.`,pass:!0}}catch(t){return {message:()=>y(t),pass:false}}},toBeCalled(e){try{return test.expect(e.called).toBeTruthy(),{message:()=>"Expected function to be called.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledTimes(e,o){try{return await test.expect.poll(()=>e.callCount).toBe(o),{message:()=>`Expected function to be called ${o} times.`,pass:!0}}catch(t){return {message:()=>y(t),pass:false}}},async toBeAccessible(e,o={}){let t=await N(e),n=await t.first().evaluate(a=>{let l=a.ownerDocument?.defaultView;return l!==null&&l!==window.top}).catch(()=>false),s=M(o,n?W:[]),r,c=async()=>{let a=await H(t,o,s),l=o.treatIncompleteAsViolationIds??E,i=[...a.violations,...a.incomplete.filter(g=>l.includes(g.id))];return r={result:a,violations:i},i},u;try{if(o.timeout&&o.timeout>0){let a=test.expect.poll(c,{timeout:o.timeout});await(this.isNot?a.not.toHaveLength(0):a.toHaveLength(0));}else await c();}catch(a){u=a;}if(!r)throw new Error(`toBeAccessible: axe scan never completed.
|
|
13
|
+
${y(u)}`);if(r.violations.length===0)return {message:()=>"Expected accessibility violations but found none.",pass:true};this.isNot||await test.test.info().attach(o.attachmentName??"accessibility-scan-results",{body:JSON.stringify(r.result,null,2),contentType:"application/json"});let p=r.violations.map(a=>{let l=a.nodes.map(i=>Array.isArray(i.target)?i.target.join(" "):String(i.target)).join(`
|
|
14
|
+
`);return ` \u2022 [${a.id}] ${a.help}
|
|
15
|
+
${l}
|
|
16
|
+
${a.helpUrl??""}`}).join(`
|
|
17
|
+
`),d=r.violations.length;return {message:()=>`Found ${d} accessibility violation${d===1?"":"s"}:
|
|
18
|
+
${p}`,pass:false}},async toMatchClassTree(e,o,t={}){let{prefix:n=A,ignoreHashed:s=false}=t,r=await e.evaluate(O,{prefix:n,ignoreHashed:s});if(!r){let c=Array.isArray(n)?n.map(u=>`${u}*`).join(" / "):`${n}*`;return {message:()=>`No ${c} classes found in the DOM tree.`,pass:false}}try{let c=`${r}
|
|
19
|
+
`,u=test.test.info();if(u.config.ignoreSnapshots)return {message:()=>"Class tree snapshot check skipped.",pass:!0};let d=z(u.project.snapshotDir,u.titlePath,o,n,s),a=u.config.updateSnapshots;await promises.mkdir(R__default.default.dirname(d),{recursive:!0});let l;try{l=await promises.readFile(d,"utf8");}catch(i){if(i.code==="ENOENT"&&a!=="none")return await promises.writeFile(d,c),{message:()=>"Class tree snapshot created.",pass:!0};throw i}if(l!==c){if(a==="all"||a==="changed")return await promises.writeFile(d,c),{message:()=>"Class tree snapshot updated.",pass:!0};try{test.expect(c).toBe(l);}catch(i){return {message:()=>`Class tree snapshot mismatch at ${d}
|
|
20
20
|
|
|
21
|
-
${
|
|
21
|
+
${i.message}`,pass:!1}}}return {message:()=>"Class tree matched snapshot.",pass:!0}}catch(c){return {message:()=>y(c),pass:false}}}});function T(e){let o=async()=>{if(await e.getAttribute("aria-expanded")!==null)return e;let s=e.locator("[aria-expanded]").first();return await s.count()>0?s:e},t=async()=>await(await o()).getAttribute("aria-expanded")==="true";return {isOpen:t,open:async(s="click")=>{if(await t())return;if(s==="click"){await e.click();return}await(await o()).press(s);}}}function F({frame:e,root:o}){let t=o??e.locator(".BaselineUI-Editor"),n=t.getByTestId("editor-font-color-button"),s=t.getByTestId("editor-background-color-button"),r=t.getByTestId("editor-add-link-button"),c=t.getByTestId("editor-help-button"),u=t.getByTestId("editor-mention-button"),p=t.getByRole("combobox"),d=e.getByTestId("editor-mention-listbox"),a=e.getByTestId("editor-help-dialog-close-button"),l=e.getByRole("dialog").filter({has:a}),i=e.getByRole("dialog").filter({has:e.getByTestId(/^editor-link-/)});return {root:t,textbox:t.getByRole("textbox"),placeholder:t.getByTestId("editor-placeholder"),toolbar:t.getByRole("toolbar"),boldButton:t.getByTestId("editor-bold-button"),italicButton:t.getByTestId("editor-italic-button"),underlineButton:t.getByTestId("editor-underline-button"),fontColorButton:n,backgroundColorButton:s,openFontColorPicker:T(n).open,openBackgroundColorPicker:T(s).open,addLinkButton:r,linkDialog:i,linkInput:e.getByTestId("editor-link-input"),linkAddButton:e.getByTestId("editor-link-add-button"),linkEditButton:e.getByTestId("editor-link-edit-button"),linkRemoveButton:e.getByTestId("editor-link-remove-button"),linkCancelButton:e.getByTestId("editor-link-cancel-button"),linkSaveButton:e.getByTestId("editor-link-save-button"),openLinkDialog:T(r).open,saveButton:t.getByTestId("editor-save-button"),cancelButton:t.getByTestId("editor-cancel-button"),mentionButton:u,helpButton:c,helpDialog:l,helpDialogCloseButton:a,async openHelpDialog(){await l.isVisible()||await c.click();},mentionInput:p,mentionListbox:d,mentionOption:g=>d.getByRole("option",{name:g}),async startMention(){await p.isVisible()||await u.click();}}}var D=(e=>{let t=J(e);return e.multiple&&(t=K(t,e.frame)),e.autocomplete&&(t=X(t,e.frame)),t});function J({frame:e,trigger:o}){let t=o??e.getByTestId("select-button"),n=r=>e.getByRole("option",{name:r}),{open:s}=T(t);return {trigger:t,listbox:e.getByRole("listbox"),option:n,open:s,async selectOption(r){await s(),await n(r).click();}}}function K(e,o){return {...e,selectAllButton:o.getByTestId("select-all-button"),clearButton:o.getByTestId("select-clear-button"),tag:t=>e.trigger.getByRole("row",{name:t}),removeTagButton:t=>e.trigger.getByRole("row",{name:t}).getByRole("button")}}function X(e,o){let t=o.getByRole("searchbox");return {...e,searchbox:t,async filter(n){await t.fill(n);}}}function Q(e){return {select:((o={})=>D({frame:e,...o})),editor:(o={})=>F({frame:e,...o})}}exports.DEFAULT_CRITICAL_INCOMPLETE_RULES=E;exports.DEFAULT_DISABLED_RULES=L;exports.DEFAULT_WCAG_TAGS=w;exports.expect=q;exports.testers=Q;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {expect,test}from'@playwright/test';import
|
|
1
|
+
import {expect,test}from'@playwright/test';import _ from'axe-core';import {mkdir,readFile,writeFile}from'fs/promises';import R from'path';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -7,15 +7,15 @@ import {expect,test}from'@playwright/test';import $ from'axe-core';import {mkdir
|
|
|
7
7
|
* This notice may not be removed from this file.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
var
|
|
11
|
-
`):
|
|
12
|
-
`)}var
|
|
13
|
-
${
|
|
14
|
-
`);return ` \u2022 [${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
`),
|
|
18
|
-
${
|
|
19
|
-
`,u=test.info();if(u.config.ignoreSnapshots)return {message:()=>"Class tree snapshot check skipped.",pass:!0};let
|
|
10
|
+
var w=["wcag2a","wcag2aa","wcag21a","wcag21aa","best-practice"],L=["landmark-one-main","page-has-heading-one","region","aria-allowed-role","duplicate-id","scrollable-region-focusable"],E=["aria-valid-attr-value","aria-valid-attr","aria-required-attr"];function O(e,o={}){let{prefix:t="BaselineUI-",ignoreHashed:n=false}=o,s=Array.isArray(t)?t:[t];function r(l){return l.split(/[-_]/).some(i=>i.length>=5&&/^[a-z\d]+$/.test(i)&&/[a-z]/.test(i)&&/\d/.test(i))}function c(l){return [...l.classList].filter(i=>s.some(g=>i.startsWith(g))&&(!n||!r(i)))}function u(l,i=false){let g=[],b=l.shadowRoot?l.shadowRoot.children:l.children;for(let f of b){let h=i||f.getAttribute("aria-hidden")==="true",B=c(f),x=u(f,h);B.length>0?g.push({classes:B,children:x,hidden:h}):g.push(...x);}return g}function p(l,i="",g=false){let b=[];for(let f=0;f<l.length;f++){let h=l[f],B=f===l.length-1,x=g?"":B?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",v=g?"":i+(B?" ":"\u2502 "),P=h.classes.join(", ");b.push(i+x+P+(h.hidden?" [aria-hidden]":""),...p(h.children,v));}return b}let d=c(e),a=u(e);return d.length===0&&a.length===0?"":d.length>0?p([{classes:d,children:a,hidden:false}],"",true).join(`
|
|
11
|
+
`):p(a,"",true).join(`
|
|
12
|
+
`)}var y=e=>{if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e==null)return "unknown error";try{return JSON.stringify(e)}catch{return "unstringifiable error"}},N=async e=>{let o=typeof e.goto=="function",t=!o&&typeof e.owner=="function";if(o||t)return e.locator("body");let n=e;return await n.first().evaluate(r=>r.tagName?.toLowerCase()==="iframe").catch(()=>false)?n.contentFrame().locator("body"):n},j=async e=>{await e.first().evaluate((o,t)=>{if(window.axe)return;let s=document.createElement("script");s.textContent=t,document.head.append(s);},_.source);},W=["document-title","html-has-lang","html-lang-valid","html-xml-lang-mismatch"],M=(e,o=[])=>{let t=new Set([...L,...o,...e.disableRules??[]]);return {runOnly:{type:"tag",values:[...e.tags??w]},rules:Object.fromEntries([...t].map(n=>[n,{enabled:false}]))}},I=e=>{if(e!==void 0)return typeof e=="string"?[e]:[...e]},H=async(e,o,t)=>{let n=await e.count();if(n===0)throw new Error("toBeAccessible: locator resolved to zero elements; nothing to scan.");await j(e);let s=I(o.include),r=I(o.exclude);return n===1?await e.evaluate(async(c,u)=>{let p=window,d={include:[c,...u.userInclude??[]],exclude:u.userExclude??[]};return await p.axe.run(d,u.runOptions)},{userInclude:s,userExclude:r,runOptions:t}):await e.evaluateAll(async(c,u)=>{let p=window,d={include:[...c,...u.userInclude??[]],exclude:u.userExclude??[]};return await p.axe.run(d,u.runOptions)},{userInclude:s,userExclude:r,runOptions:t})},A="BaselineUI-";function S(e){return e.replaceAll(/\W+/g,"-").replaceAll(/^-|-$/g,"")}function V(e){return Array.isArray(e)?e.length===1&&e[0]===A:e===A}function G(e){return (Array.isArray(e)?e:[e]).join("+")}function z(e,o,t,n,s){let r=o.slice(1).map(c=>S(c));return t&&r.push(S(t)),n!==void 0&&!V(n)&&r.push(S(G(n))),s&&r.push("ignoreHashed"),R.join(e,`${r.join("--")}.txt`)}var q=expect.extend({toBeWithinDelta(e,o,t){return Math.abs(e-o)<=t?{message:()=>`expected ${e} not to be within ${t} of ${o}`,pass:true}:{message:()=>`expected ${e} to be within ${t} of ${o}`,pass:false}},async toBeCalledOnce(e){try{return await expect.poll(()=>e.callCount).toBe(1),{message:()=>"Expected function to be called once.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledTwice(e){try{return await expect.poll(()=>e.callCount).toBe(2),{message:()=>"Expected function to be called twice.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledThrice(e){try{return await expect.poll(()=>e.callCount).toBe(3),{message:()=>"Expected function to be called thrice.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledWith(e,...o){try{return await expect(()=>{for(let[t,n]of o.entries())expect(e.lastCall?.args?.[t]).toStrictEqual(n);}).toPass(),{message:()=>`Expected function to be called with ${o.join(", ")}.`,pass:!0}}catch(t){return {message:()=>y(t),pass:false}}},async toBeCalledWithExactly(e,...o){try{return await expect.poll(()=>e.lastCall?.args).toStrictEqual(o),{message:()=>`Expected function to be called with exactly ${o.join(", ")}.`,pass:!0}}catch(t){return {message:()=>y(t),pass:false}}},toBeCalled(e){try{return expect(e.called).toBeTruthy(),{message:()=>"Expected function to be called.",pass:!0}}catch(o){return {message:()=>y(o),pass:false}}},async toBeCalledTimes(e,o){try{return await expect.poll(()=>e.callCount).toBe(o),{message:()=>`Expected function to be called ${o} times.`,pass:!0}}catch(t){return {message:()=>y(t),pass:false}}},async toBeAccessible(e,o={}){let t=await N(e),n=await t.first().evaluate(a=>{let l=a.ownerDocument?.defaultView;return l!==null&&l!==window.top}).catch(()=>false),s=M(o,n?W:[]),r,c=async()=>{let a=await H(t,o,s),l=o.treatIncompleteAsViolationIds??E,i=[...a.violations,...a.incomplete.filter(g=>l.includes(g.id))];return r={result:a,violations:i},i},u;try{if(o.timeout&&o.timeout>0){let a=expect.poll(c,{timeout:o.timeout});await(this.isNot?a.not.toHaveLength(0):a.toHaveLength(0));}else await c();}catch(a){u=a;}if(!r)throw new Error(`toBeAccessible: axe scan never completed.
|
|
13
|
+
${y(u)}`);if(r.violations.length===0)return {message:()=>"Expected accessibility violations but found none.",pass:true};this.isNot||await test.info().attach(o.attachmentName??"accessibility-scan-results",{body:JSON.stringify(r.result,null,2),contentType:"application/json"});let p=r.violations.map(a=>{let l=a.nodes.map(i=>Array.isArray(i.target)?i.target.join(" "):String(i.target)).join(`
|
|
14
|
+
`);return ` \u2022 [${a.id}] ${a.help}
|
|
15
|
+
${l}
|
|
16
|
+
${a.helpUrl??""}`}).join(`
|
|
17
|
+
`),d=r.violations.length;return {message:()=>`Found ${d} accessibility violation${d===1?"":"s"}:
|
|
18
|
+
${p}`,pass:false}},async toMatchClassTree(e,o,t={}){let{prefix:n=A,ignoreHashed:s=false}=t,r=await e.evaluate(O,{prefix:n,ignoreHashed:s});if(!r){let c=Array.isArray(n)?n.map(u=>`${u}*`).join(" / "):`${n}*`;return {message:()=>`No ${c} classes found in the DOM tree.`,pass:false}}try{let c=`${r}
|
|
19
|
+
`,u=test.info();if(u.config.ignoreSnapshots)return {message:()=>"Class tree snapshot check skipped.",pass:!0};let d=z(u.project.snapshotDir,u.titlePath,o,n,s),a=u.config.updateSnapshots;await mkdir(R.dirname(d),{recursive:!0});let l;try{l=await readFile(d,"utf8");}catch(i){if(i.code==="ENOENT"&&a!=="none")return await writeFile(d,c),{message:()=>"Class tree snapshot created.",pass:!0};throw i}if(l!==c){if(a==="all"||a==="changed")return await writeFile(d,c),{message:()=>"Class tree snapshot updated.",pass:!0};try{expect(c).toBe(l);}catch(i){return {message:()=>`Class tree snapshot mismatch at ${d}
|
|
20
20
|
|
|
21
|
-
${
|
|
21
|
+
${i.message}`,pass:!1}}}return {message:()=>"Class tree matched snapshot.",pass:!0}}catch(c){return {message:()=>y(c),pass:false}}}});function T(e){let o=async()=>{if(await e.getAttribute("aria-expanded")!==null)return e;let s=e.locator("[aria-expanded]").first();return await s.count()>0?s:e},t=async()=>await(await o()).getAttribute("aria-expanded")==="true";return {isOpen:t,open:async(s="click")=>{if(await t())return;if(s==="click"){await e.click();return}await(await o()).press(s);}}}function F({frame:e,root:o}){let t=o??e.locator(".BaselineUI-Editor"),n=t.getByTestId("editor-font-color-button"),s=t.getByTestId("editor-background-color-button"),r=t.getByTestId("editor-add-link-button"),c=t.getByTestId("editor-help-button"),u=t.getByTestId("editor-mention-button"),p=t.getByRole("combobox"),d=e.getByTestId("editor-mention-listbox"),a=e.getByTestId("editor-help-dialog-close-button"),l=e.getByRole("dialog").filter({has:a}),i=e.getByRole("dialog").filter({has:e.getByTestId(/^editor-link-/)});return {root:t,textbox:t.getByRole("textbox"),placeholder:t.getByTestId("editor-placeholder"),toolbar:t.getByRole("toolbar"),boldButton:t.getByTestId("editor-bold-button"),italicButton:t.getByTestId("editor-italic-button"),underlineButton:t.getByTestId("editor-underline-button"),fontColorButton:n,backgroundColorButton:s,openFontColorPicker:T(n).open,openBackgroundColorPicker:T(s).open,addLinkButton:r,linkDialog:i,linkInput:e.getByTestId("editor-link-input"),linkAddButton:e.getByTestId("editor-link-add-button"),linkEditButton:e.getByTestId("editor-link-edit-button"),linkRemoveButton:e.getByTestId("editor-link-remove-button"),linkCancelButton:e.getByTestId("editor-link-cancel-button"),linkSaveButton:e.getByTestId("editor-link-save-button"),openLinkDialog:T(r).open,saveButton:t.getByTestId("editor-save-button"),cancelButton:t.getByTestId("editor-cancel-button"),mentionButton:u,helpButton:c,helpDialog:l,helpDialogCloseButton:a,async openHelpDialog(){await l.isVisible()||await c.click();},mentionInput:p,mentionListbox:d,mentionOption:g=>d.getByRole("option",{name:g}),async startMention(){await p.isVisible()||await u.click();}}}var D=(e=>{let t=J(e);return e.multiple&&(t=K(t,e.frame)),e.autocomplete&&(t=X(t,e.frame)),t});function J({frame:e,trigger:o}){let t=o??e.getByTestId("select-button"),n=r=>e.getByRole("option",{name:r}),{open:s}=T(t);return {trigger:t,listbox:e.getByRole("listbox"),option:n,open:s,async selectOption(r){await s(),await n(r).click();}}}function K(e,o){return {...e,selectAllButton:o.getByTestId("select-all-button"),clearButton:o.getByTestId("select-clear-button"),tag:t=>e.trigger.getByRole("row",{name:t}),removeTagButton:t=>e.trigger.getByRole("row",{name:t}).getByRole("button")}}function X(e,o){let t=o.getByRole("searchbox");return {...e,searchbox:t,async filter(n){await t.fill(n);}}}function Q(e){return {select:((o={})=>D({frame:e,...o})),editor:(o={})=>F({frame:e,...o})}}export{E as DEFAULT_CRITICAL_INCOMPLETE_RULES,L as DEFAULT_DISABLED_RULES,w as DEFAULT_WCAG_TAGS,q as expect,Q as testers};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baseline-ui/test-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"description": "A collection of test utilities for Baseline UI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"axe-core": "^4.11.
|
|
54
|
-
"react-frame-component": "^5.2
|
|
55
|
-
"@baseline-ui/core": "0.
|
|
53
|
+
"axe-core": "^4.11.4",
|
|
54
|
+
"react-frame-component": "^5.3.2",
|
|
55
|
+
"@baseline-ui/core": "0.63.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsup",
|