@gtkx/testing 1.0.0-rc.2 → 1.0.0-rc.3

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 (44) hide show
  1. package/dist/bound-queries.d.ts +2 -3
  2. package/dist/bound-queries.d.ts.map +1 -1
  3. package/dist/bound-queries.js.map +1 -1
  4. package/dist/index.d.ts +7 -4
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +4 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/matchers.d.ts +81 -21
  9. package/dist/matchers.d.ts.map +1 -1
  10. package/dist/matchers.js +258 -21
  11. package/dist/matchers.js.map +1 -1
  12. package/dist/normalize.d.ts +10 -0
  13. package/dist/normalize.d.ts.map +1 -0
  14. package/dist/normalize.js +20 -0
  15. package/dist/normalize.js.map +1 -0
  16. package/dist/queries.d.ts +3 -21
  17. package/dist/queries.d.ts.map +1 -1
  18. package/dist/queries.js +46 -59
  19. package/dist/queries.js.map +1 -1
  20. package/dist/render.js +1 -1
  21. package/dist/render.js.map +1 -1
  22. package/dist/types.d.ts +29 -3
  23. package/dist/types.d.ts.map +1 -1
  24. package/dist/types.js.map +1 -1
  25. package/dist/user-event/controller.d.ts +2 -1
  26. package/dist/user-event/controller.d.ts.map +1 -1
  27. package/dist/user-event/controller.js +8 -1
  28. package/dist/user-event/controller.js.map +1 -1
  29. package/dist/widget-accessible-properties.d.ts +12 -2
  30. package/dist/widget-accessible-properties.d.ts.map +1 -1
  31. package/dist/widget-accessible-properties.js +112 -10
  32. package/dist/widget-accessible-properties.js.map +1 -1
  33. package/dist/within.js.map +1 -1
  34. package/package.json +6 -6
  35. package/src/bound-queries.ts +2 -3
  36. package/src/index.ts +11 -2
  37. package/src/matchers.ts +456 -53
  38. package/src/normalize.ts +28 -0
  39. package/src/queries.ts +78 -105
  40. package/src/render.tsx +1 -1
  41. package/src/types.ts +48 -2
  42. package/src/user-event/controller.ts +21 -1
  43. package/src/widget-accessible-properties.ts +172 -10
  44. package/src/within.ts +1 -1
package/dist/matchers.js CHANGED
@@ -1,38 +1,67 @@
1
1
  /// <reference types="@vitest/expect" />
2
+ import * as GObject from "@gtkx/gi/gobject";
2
3
  import * as Gtk from "@gtkx/gi/gtk";
3
- import { getWidgetAccessibleName, getWidgetCheckedState, getWidgetDisplayValue, getWidgetExpandedState, getWidgetNodeText, getWidgetPlaceholderText, getWidgetPressedState, getWidgetSelectedState, getWidgetValue, } from "./widget-accessible-properties.js";
4
- const toHaveDisplayValue = textMatcher("toHaveDisplayValue", getWidgetDisplayValue, "exact");
5
- const toHaveTextContent = textMatcher("toHaveTextContent", (widget) => getWidgetNodeText(widget) ?? getWidgetAccessibleName(widget), "substring");
4
+ import { getDefaultNormalizer } from "./normalize.js";
5
+ import { formatRole } from "./role-helpers.js";
6
+ import { getWidgetAccessibleName, getWidgetCheckedState, getWidgetDescribedByText, getWidgetDisplayValue, getWidgetErrorMessage, getWidgetExpandedState, getWidgetInvalidState, getWidgetLabelText, getWidgetPlaceholderText, getWidgetPressedState, getWidgetRequiredState, getWidgetSelectedState, getWidgetSelection, getWidgetTextContent, getWidgetValue, hasDisplayValue, isWidgetDisabled, isWidgetVisible, } from "./widget-accessible-properties.js";
7
+ const registration = { isRegistered: false };
8
+ const displayValueMatcher = textMatcher("toHaveDisplayValue", getWidgetDisplayValue, "exact");
6
9
  const toHaveAccessibleName = textMatcher("toHaveAccessibleName", getWidgetAccessibleName, "exact");
10
+ const toHaveAccessibleDescription = textMatcher("toHaveAccessibleDescription", getWidgetDescribedByText, "exact");
11
+ const toHaveAccessibleErrorMessage = textMatcher("toHaveAccessibleErrorMessage", readErrorMessageText, "exact");
7
12
  const toHavePlaceholderText = textMatcher("toHavePlaceholderText", getWidgetPlaceholderText, "exact");
8
- const toBeChecked = booleanStateMatcher("toBeChecked", "checked", getWidgetCheckedState);
13
+ const toHaveSelection = textMatcher("toHaveSelection", getWidgetSelection, "exact");
9
14
  const toBePressed = booleanStateMatcher("toBePressed", "pressed", getWidgetPressedState);
10
15
  const toBeExpanded = booleanStateMatcher("toBeExpanded", "expanded", getWidgetExpandedState);
11
16
  const toBeSelected = booleanStateMatcher("toBeSelected", "selected", getWidgetSelectedState);
17
+ const toBeRequired = booleanStateMatcher("toBeRequired", "required", getWidgetRequiredState);
12
18
  /** The widget assertion matchers keyed by name, suitable for passing to `expect.extend`. */
13
19
  const matchers = {
14
20
  toHaveDisplayValue,
15
21
  toHaveTextContent,
16
22
  toHaveAccessibleName,
23
+ toHaveAccessibleDescription,
24
+ toHaveAccessibleErrorMessage,
17
25
  toHavePlaceholderText,
26
+ toHaveSelection,
18
27
  toBeChecked,
28
+ toBePartiallyChecked,
19
29
  toBePressed,
20
30
  toBeExpanded,
21
31
  toBeSelected,
32
+ toBeDisabled,
33
+ toBeEnabled,
34
+ toBeVisible,
35
+ toBeRooted,
36
+ toBeEmpty,
37
+ toBeInvalid,
38
+ toBeValid,
39
+ toBeRequired,
40
+ toHaveFocus,
22
41
  toHaveValue,
42
+ toHaveRole,
43
+ toContainElement,
44
+ toHaveClass,
45
+ toHaveObjectProperty,
23
46
  };
24
- const registration = { isRegistered: false };
25
47
  const asWidget = (received, matcherName) => {
26
48
  if (!(received instanceof Gtk.Widget)) {
27
49
  throw new TypeError(`${matcherName}: received value must be a Gtk.Widget, got ${typeof received}`);
28
50
  }
29
51
  return received;
30
52
  };
53
+ const asObject = (received, matcherName) => {
54
+ if (!(received instanceof GObject.Object)) {
55
+ throw new TypeError(`${matcherName}: received value must be a GObject, got ${typeof received}`);
56
+ }
57
+ return received;
58
+ };
31
59
  const describeWidget = (widget) => {
32
60
  const role = Gtk.AccessibleRole[widget.getAccessibleRole()];
33
61
  const name = getWidgetAccessibleName(widget);
34
62
  return name === null ? `<${role}>` : `<${role} name=${JSON.stringify(name)}>`;
35
63
  };
64
+ const describeObject = (object) => object instanceof Gtk.Widget ? describeWidget(object) : `<${object.constructor.name}>`;
36
65
  const isTextMatch = (actual, expected, mode) => {
37
66
  if (expected instanceof RegExp) {
38
67
  expected.lastIndex = 0;
@@ -55,6 +84,89 @@ const matchedResult = (context, expected, isPass) => ({
55
84
  message: () => `expected widget ${negationPrefix(isPass)}${context.matcherName} ${describeExpected(expected)}, ` +
56
85
  `but received ${JSON.stringify(context.actual)}\n${describeWidget(context.widget)}`,
57
86
  });
87
+ const stateResult = (widget, stateName, isPass) => ({
88
+ pass: isPass,
89
+ message: () => `expected widget ${negationPrefix(isPass)}to be ${stateName}\n${describeWidget(widget)}`,
90
+ });
91
+ const camelCase = (name) => name.replaceAll(/-([a-z])/g, (_match, letter) => letter.toUpperCase());
92
+ const isAsymmetricMatcher = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "asymmetricMatch") === "function";
93
+ const isEqualValue = (context, actual, expected) => {
94
+ if (isAsymmetricMatcher(expected)) {
95
+ return context.equals(actual, expected);
96
+ }
97
+ if (actual instanceof GObject.Object || expected instanceof GObject.Object) {
98
+ return Object.is(actual, expected);
99
+ }
100
+ return context.equals(actual, expected);
101
+ };
102
+ const isClassMatch = (actual, expected) => expected instanceof RegExp ? actual.some((name) => expected.test(name)) : actual.includes(expected);
103
+ const isWidgetRooted = (widget) => {
104
+ const root = widget.getRoot();
105
+ if (root === null) {
106
+ return false;
107
+ }
108
+ if (root instanceof Gtk.Window) {
109
+ return Gtk.Window.listToplevels().includes(root);
110
+ }
111
+ return true;
112
+ };
113
+ const globalExpect = () => {
114
+ const candidate = Reflect.get(globalThis, "expect");
115
+ if (candidate && typeof candidate.extend === "function") {
116
+ return candidate;
117
+ }
118
+ return null;
119
+ };
120
+ function readErrorMessageText(widget) {
121
+ const state = getWidgetInvalidState(widget);
122
+ if (state === null || state === Gtk.AccessibleInvalidState.FALSE) {
123
+ return null;
124
+ }
125
+ const targets = getWidgetErrorMessage(widget);
126
+ if (targets === null) {
127
+ return null;
128
+ }
129
+ const texts = targets.map((target) => getWidgetAccessibleName(target)).filter((text) => text !== null);
130
+ return texts.length > 0 ? texts.join(" ") : null;
131
+ }
132
+ function assertReadableProperty(object, name, property, value) {
133
+ if (typeof value === "function") {
134
+ throw new TypeError(`toHaveObjectProperty: "${name}" is shadowed by a method of the same name; ` +
135
+ `call ${property}() and assert on its result instead`);
136
+ }
137
+ if (value === undefined && !Reflect.has(object, property)) {
138
+ throw new TypeError(`toHaveObjectProperty: no readable property "${name}" on ${describeObject(object)}; ` +
139
+ "construct-only and write-only properties cannot be read back");
140
+ }
141
+ }
142
+ function readObjectProperty(object, name) {
143
+ const property = camelCase(name);
144
+ const value = Reflect.get(object, property);
145
+ assertReadableProperty(object, name, property, value);
146
+ return value;
147
+ }
148
+ function classEntries(entry) {
149
+ return entry instanceof RegExp ? [entry] : String(entry).split(/\s+/).filter(Boolean);
150
+ }
151
+ function parseClassArguments(args) {
152
+ const last = args.at(-1);
153
+ const isOptions = typeof last === "object" && last !== null && !(last instanceof RegExp);
154
+ const isExact = isOptions && Reflect.get(last, "exact") === true;
155
+ const entries = isOptions ? args.slice(0, -1) : args;
156
+ return { expected: entries.flatMap((entry) => classEntries(entry)), isExact };
157
+ }
158
+ function exactClassResult(widget, actual, expected) {
159
+ if (expected.some((entry) => entry instanceof RegExp)) {
160
+ throw new TypeError("toHaveClass: the exact option cannot be combined with a regular expression");
161
+ }
162
+ const names = expected.map(String);
163
+ const isPass = names.length === actual.length && names.every((name) => actual.includes(name));
164
+ return {
165
+ pass: isPass,
166
+ message: () => `expected widget ${negationPrefix(isPass)}to have exactly the classes ${JSON.stringify(names)}, ` +
167
+ `but received ${JSON.stringify(actual)}\n${describeWidget(widget)}`,
168
+ };
169
+ }
58
170
  function textMatcher(matcherName, read, mode) {
59
171
  return (received, expected) => {
60
172
  const widget = asWidget(received, matcherName);
@@ -66,41 +178,166 @@ function textMatcher(matcherName, read, mode) {
66
178
  return matchedResult(context, expected, actual !== null && isTextMatch(actual, expected, mode));
67
179
  };
68
180
  }
181
+ function normalizeTextContent(text, options) {
182
+ if (options?.normalizeWhitespace === false) {
183
+ return text.replaceAll("\u{A0}", " ");
184
+ }
185
+ return getDefaultNormalizer()(text);
186
+ }
187
+ function readTextContent(widget, options) {
188
+ const text = getWidgetTextContent(widget);
189
+ return text === null ? null : normalizeTextContent(text, options);
190
+ }
191
+ function toHaveTextContent(received, expected, options) {
192
+ const read = (widget) => readTextContent(widget, options);
193
+ return textMatcher("toHaveTextContent", read, "substring")(received, expected);
194
+ }
195
+ function notApplicable(matcherName, stateName, widget) {
196
+ return new Error(`${matcherName}: widget does not expose a ${stateName} ` +
197
+ `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\n${describeWidget(widget)}`);
198
+ }
69
199
  function booleanStateMatcher(matcherName, stateName, read) {
70
200
  return (received) => {
71
201
  const widget = asWidget(received, matcherName);
72
202
  const state = read(widget);
73
203
  if (state === null) {
74
- throw new Error(`${matcherName}: widget does not expose a ${stateName} state ` +
75
- `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\n${describeWidget(widget)}`);
204
+ throw notApplicable(matcherName, `${stateName} state`, widget);
76
205
  }
77
- return {
78
- pass: state,
79
- message: () => `expected widget ${negationPrefix(state)}to be ${stateName}\n${describeWidget(widget)}`,
80
- };
206
+ return stateResult(widget, stateName, state);
81
207
  };
82
208
  }
209
+ function readCheckedState(widget, matcherName) {
210
+ const state = getWidgetCheckedState(widget);
211
+ if (state === null) {
212
+ throw notApplicable(matcherName, "checked state", widget);
213
+ }
214
+ return state;
215
+ }
216
+ function toBeChecked(received) {
217
+ const widget = asWidget(received, "toBeChecked");
218
+ return stateResult(widget, "checked", readCheckedState(widget, "toBeChecked") === "checked");
219
+ }
220
+ function toBePartiallyChecked(received) {
221
+ const widget = asWidget(received, "toBePartiallyChecked");
222
+ return stateResult(widget, "partially checked", readCheckedState(widget, "toBePartiallyChecked") === "mixed");
223
+ }
224
+ function toHaveDisplayValue(received, expected) {
225
+ const widget = asWidget(received, "toHaveDisplayValue");
226
+ if (!hasDisplayValue(widget)) {
227
+ throw notApplicable("toHaveDisplayValue", "display value", widget);
228
+ }
229
+ return displayValueMatcher(received, expected);
230
+ }
83
231
  function toHaveValue(received, expected) {
84
232
  const widget = asWidget(received, "toHaveValue");
233
+ if (typeof expected === "string") {
234
+ return displayValueMatcher(received, expected);
235
+ }
85
236
  const actual = getWidgetValue(widget).now;
86
237
  if (actual === null) {
87
- throw new Error("toHaveValue: widget does not expose a numeric value " +
88
- `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\n${describeWidget(widget)}`);
238
+ throw notApplicable("toHaveValue", "numeric value", widget);
89
239
  }
90
- const isPass = actual === expected;
240
+ const isPass = expected === undefined || actual === expected;
91
241
  return {
92
242
  pass: isPass,
93
243
  message: () => `expected widget ${negationPrefix(isPass)}to have value ${String(expected)}, ` +
94
244
  `but received ${String(actual)}\n${describeWidget(widget)}`,
95
245
  };
96
246
  }
97
- const globalExpect = () => {
98
- const candidate = Reflect.get(globalThis, "expect");
99
- if (candidate && typeof candidate.extend === "function") {
100
- return candidate;
247
+ function toBeDisabled(received) {
248
+ const widget = asWidget(received, "toBeDisabled");
249
+ return stateResult(widget, "disabled", isWidgetDisabled(widget));
250
+ }
251
+ function toBeEnabled(received) {
252
+ const widget = asWidget(received, "toBeEnabled");
253
+ return stateResult(widget, "enabled", !isWidgetDisabled(widget));
254
+ }
255
+ function toBeVisible(received) {
256
+ const widget = asWidget(received, "toBeVisible");
257
+ return stateResult(widget, "visible", isWidgetVisible(widget));
258
+ }
259
+ function toBeRooted(received) {
260
+ if (received === null) {
261
+ return { pass: false, message: () => "expected a widget to be rooted in a window, but received null" };
101
262
  }
102
- return null;
103
- };
263
+ const widget = asWidget(received, "toBeRooted");
264
+ return stateResult(widget, "rooted in a window", isWidgetRooted(widget));
265
+ }
266
+ function toBeEmpty(received) {
267
+ const widget = asWidget(received, "toBeEmpty");
268
+ return stateResult(widget, "empty", widget.getFirstChild() === null && getWidgetLabelText(widget) === null);
269
+ }
270
+ function toBeInvalid(received) {
271
+ const widget = asWidget(received, "toBeInvalid");
272
+ const state = getWidgetInvalidState(widget);
273
+ return stateResult(widget, "invalid", state !== null && state !== Gtk.AccessibleInvalidState.FALSE);
274
+ }
275
+ function toBeValid(received) {
276
+ const widget = asWidget(received, "toBeValid");
277
+ const state = getWidgetInvalidState(widget);
278
+ return stateResult(widget, "valid", state === null || state === Gtk.AccessibleInvalidState.FALSE);
279
+ }
280
+ function toHaveFocus(received) {
281
+ const widget = asWidget(received, "toHaveFocus");
282
+ return stateResult(widget, "focused", widget.getPlatformState(Gtk.AccessiblePlatformState.FOCUSED));
283
+ }
284
+ function toHaveRole(received, expected) {
285
+ const widget = asWidget(received, "toHaveRole");
286
+ const actual = widget.getAccessibleRole();
287
+ const isPass = actual === expected;
288
+ return {
289
+ pass: isPass,
290
+ message: () => `expected widget ${negationPrefix(isPass)}to have role '${formatRole(expected)}', ` +
291
+ `but received '${formatRole(actual)}'\n${describeWidget(widget)}`,
292
+ };
293
+ }
294
+ function toContainElement(received, descendant) {
295
+ const widget = asWidget(received, "toContainElement");
296
+ const isPass = descendant !== null && (descendant === widget || descendant.isAncestor(widget));
297
+ return {
298
+ pass: isPass,
299
+ message: () => `expected widget ${negationPrefix(isPass)}to contain ` +
300
+ `${descendant === null ? "null" : describeWidget(descendant)}\n${describeWidget(widget)}`,
301
+ };
302
+ }
303
+ function toHaveClass(received, ...args) {
304
+ const widget = asWidget(received, "toHaveClass");
305
+ const actual = widget.getCssClasses();
306
+ const { expected, isExact } = parseClassArguments(args);
307
+ if (isExact) {
308
+ return exactClassResult(widget, actual, expected);
309
+ }
310
+ if (expected.length === 0) {
311
+ return stateResult(widget, "given any style class", actual.length > 0);
312
+ }
313
+ const isPass = expected.every((entry) => isClassMatch(actual, entry));
314
+ return {
315
+ pass: isPass,
316
+ message: () => `expected widget ${negationPrefix(isPass)}to have class ${expected.map(String).join(", ")}, ` +
317
+ `but received ${JSON.stringify(actual)}\n${describeWidget(widget)}`,
318
+ };
319
+ }
320
+ function toHaveObjectProperty(received, ...args) {
321
+ const object = asObject(received, "toHaveObjectProperty");
322
+ const [name, expected] = args;
323
+ const actual = readObjectProperty(object, String(name));
324
+ if (args.length < 2) {
325
+ const isSet = actual !== null && actual !== undefined;
326
+ return {
327
+ pass: isSet,
328
+ message: () => `expected ${describeObject(object)} ${negationPrefix(isSet)}to have a value for property ` +
329
+ `"${String(name)}", but received ${JSON.stringify(actual)}`,
330
+ };
331
+ }
332
+ /* eslint-disable-next-line unicorn/no-this-outside-of-class --
333
+ expect.extend invokes matchers with the matcher state as `this` */
334
+ const isPass = isEqualValue(this, actual, expected);
335
+ return {
336
+ pass: isPass,
337
+ message: () => `expected ${describeObject(object)} ${negationPrefix(isPass)}to have property "${String(name)}" ` +
338
+ `equal to ${JSON.stringify(expected)}, but received ${JSON.stringify(actual)}`,
339
+ };
340
+ }
104
341
  /** Registers the widget matchers on the global `expect`, when one is available. Safe to call more than once. */
105
342
  const registerMatchers = () => {
106
343
  if (registration.isRegistered) {
@@ -113,5 +350,5 @@ const registerMatchers = () => {
113
350
  expect.extend(matchers);
114
351
  registration.isRegistered = true;
115
352
  };
116
- export { toHaveDisplayValue, toHaveTextContent, toHaveAccessibleName, toHavePlaceholderText, toBeChecked, toBePressed, toBeExpanded, toBeSelected, matchers, toHaveValue, registerMatchers, };
353
+ export { toHaveDisplayValue, toHaveTextContent, toHaveAccessibleName, toHaveAccessibleDescription, toHaveAccessibleErrorMessage, toHavePlaceholderText, toHaveSelection, toBeChecked, toBePartiallyChecked, toBePressed, toBeExpanded, toBeSelected, toBeDisabled, toBeEnabled, toBeVisible, toBeRooted, toBeEmpty, toBeInvalid, toBeValid, toBeRequired, toHaveFocus, toHaveValue, toHaveRole, toContainElement, toHaveClass, toHaveObjectProperty, matchers, registerMatchers, };
117
354
  //# sourceMappingURL=matchers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,KAAK,GAAG,MAAM,cA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nC,OAAO;QACH,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG,EAAE,CACV,mBAAmB,cAAc,CAAC,MAAM,CAAC,iBAAiB,MAAM,CAAC,QAAQ,CAAC,IAAI;YAC9E,gBAAgB,MAAM,CAAC,MAAM,CAAC,KAAK,cAAc,CAAC,MAAM,CAAC,EAAE;KAClE,CAAC;AACN,CAAC;AAED,MAAM,YAAY,GAAG,GAAwB,EAAE;IAC3C,MAAM,SAAS,GAAY,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAE7D,IAAI,SAAS,IAAI,OAAQ,SAA0B,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACxE,OAAO,SAAyB,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,gHAAgH;AAChH,MAAM,gBAAgB,GAAG,GAAS,EAAE;IAChC,IAAI,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,OAAO;IACX,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO;IACX,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxB,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC;AACrC,CAAC,CAAC;AA8BF,OAAO,EACH,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,gBAAgB,GAEnB,CAAC","sourcesContent":["/// <reference types=\"@vitest/expect\" />\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport {\n getWidgetAccessibleName,\n getWidgetCheckedState,\n getWidgetDisplayValue,\n getWidgetExpandedState,\n getWidgetNodeText,\n getWidgetPlaceholderText,\n getWidgetPressedState,\n getWidgetSelectedState,\n getWidgetValue,\n} from \"./widget-accessible-properties.js\";\n\n/** The expected value for a text matcher: an exact string or a regular expression. */\ntype TextExpectation = string | RegExp;\ntype MatcherResult = { pass: boolean; message: () => string };\ntype TextMatcher = (received: unknown, expected?: TextExpectation) => MatcherResult;\ntype StateMatcher = (received: unknown) => MatcherResult;\ntype ValueMatcher = (received: unknown, expected: number) => MatcherResult;\ntype TextMatcherContext = { matcherName: string; widget: Gtk.Widget; actual: string | null };\n\ntype MatcherImplementations = {\n toHaveDisplayValue: TextMatcher;\n toHaveTextContent: TextMatcher;\n toHaveAccessibleName: TextMatcher;\n toHavePlaceholderText: TextMatcher;\n toBeChecked: StateMatcher;\n toBePressed: StateMatcher;\n toBeExpanded: StateMatcher;\n toBeSelected: StateMatcher;\n toHaveValue: ValueMatcher;\n};\n\ntype ExpectExtend = { extend: (m: MatcherImplementations) => void };\n\nconst toHaveDisplayValue: TextMatcher = textMatcher(\"toHaveDisplayValue\", getWidgetDisplayValue, \"exact\");\n\nconst toHaveTextContent: TextMatcher = textMatcher(\n \"toHaveTextContent\",\n (widget) => getWidgetNodeText(widget) ?? getWidgetAccessibleName(widget),\n \"substring\",\n);\n\nconst toHaveAccessibleName: TextMatcher = textMatcher(\"toHaveAccessibleName\", getWidgetAccessibleName, \"exact\");\n\nconst toHavePlaceholderText: TextMatcher = textMatcher(\n \"toHavePlaceholderText\",\n getWidgetPlaceholderText,\n \"exact\",\n);\n\nconst toBeChecked: StateMatcher = booleanStateMatcher(\"toBeChecked\", \"checked\", getWidgetCheckedState);\nconst toBePressed: StateMatcher = booleanStateMatcher(\"toBePressed\", \"pressed\", getWidgetPressedState);\nconst toBeExpanded: StateMatcher = booleanStateMatcher(\"toBeExpanded\", \"expanded\", getWidgetExpandedState);\nconst toBeSelected: StateMatcher = booleanStateMatcher(\"toBeSelected\", \"selected\", getWidgetSelectedState);\n\n/** The widget assertion matchers keyed by name, suitable for passing to `expect.extend`. */\nconst matchers: MatcherImplementations = {\n toHaveDisplayValue,\n toHaveTextContent,\n toHaveAccessibleName,\n toHavePlaceholderText,\n toBeChecked,\n toBePressed,\n toBeExpanded,\n toBeSelected,\n toHaveValue,\n};\n\nconst registration = { isRegistered: false };\n\nconst asWidget = (received: unknown, matcherName: string): Gtk.Widget => {\n if (!(received instanceof Gtk.Widget)) {\n throw new TypeError(`${matcherName}: received value must be a Gtk.Widget, got ${typeof received}`);\n }\n\n return received;\n};\n\nconst describeWidget = (widget: Gtk.Widget): string => {\n const role = Gtk.AccessibleRole[widget.getAccessibleRole()];\n const name = getWidgetAccessibleName(widget);\n\n return name === null ? `<${role}>` : `<${role} name=${JSON.stringify(name)}>`;\n};\n\nconst isTextMatch = (actual: string, expected: TextExpectation, mode: \"exact\" | \"substring\"): boolean => {\n if (expected instanceof RegExp) {\n expected.lastIndex = 0;\n\n return expected.test(actual);\n }\n\n return mode === \"exact\" ? actual === expected : actual.includes(expected);\n};\n\nconst describeExpected = (expected: TextExpectation): string =>\n expected instanceof RegExp ? String(expected) : JSON.stringify(expected);\n\nconst negationPrefix = (isPass: boolean): string => (isPass ? \"not \" : \"\");\n\nconst nonEmptyResult = ({ matcherName, widget, actual }: TextMatcherContext): MatcherResult => {\n const isPass = actual !== null && actual !== \"\";\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have a non-empty value for ${matcherName}, ` +\n `but got ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n};\n\nconst matchedResult = (context: TextMatcherContext, expected: TextExpectation, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}${context.matcherName} ${describeExpected(expected)}, ` +\n `but received ${JSON.stringify(context.actual)}\\n${describeWidget(context.widget)}`,\n});\n\nfunction textMatcher(\n matcherName: string,\n read: (widget: Gtk.Widget) => string | null,\n mode: \"exact\" | \"substring\",\n): TextMatcher {\n return (received: unknown, expected?: TextExpectation): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const actual = read(widget);\n const context: TextMatcherContext = { matcherName, widget, actual };\n\n if (expected === undefined) {\n return nonEmptyResult(context);\n }\n\n return matchedResult(context, expected, actual !== null && isTextMatch(actual, expected, mode));\n };\n}\n\nfunction booleanStateMatcher(\n matcherName: string,\n stateName: string,\n read: (widget: Gtk.Widget) => boolean | null,\n): StateMatcher {\n return (received: unknown): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const state = read(widget);\n\n if (state === null) {\n throw new Error(\n `${matcherName}: widget does not expose a ${stateName} state ` +\n `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\\n${describeWidget(widget)}`,\n );\n }\n\n return {\n pass: state,\n message: () =>\n `expected widget ${negationPrefix(state)}to be ${stateName}\\n${describeWidget(widget)}`,\n };\n };\n}\n\nfunction toHaveValue(received: unknown, expected: number): MatcherResult {\n const widget = asWidget(received, \"toHaveValue\");\n const actual = getWidgetValue(widget).now;\n\n if (actual === null) {\n throw new Error(\n \"toHaveValue: widget does not expose a numeric value \" +\n `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\\n${describeWidget(widget)}`,\n );\n }\n\n const isPass = actual === expected;\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have value ${String(expected)}, ` +\n `but received ${String(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nconst globalExpect = (): ExpectExtend | null => {\n const candidate: unknown = Reflect.get(globalThis, \"expect\");\n\n if (candidate && typeof (candidate as ExpectExtend).extend === \"function\") {\n return candidate as ExpectExtend;\n }\n\n return null;\n};\n\n/** Registers the widget matchers on the global `expect`, when one is available. Safe to call more than once. */\nconst registerMatchers = (): void => {\n if (registration.isRegistered) {\n return;\n }\n\n const expect = globalExpect();\n\n if (!expect) {\n return;\n }\n\n expect.extend(matchers);\n registration.isRegistered = true;\n};\n\ndeclare module \"@vitest/expect\" {\n /* eslint-disable @typescript-eslint/consistent-type-definitions -- declaration merging requires interfaces */\n interface Assertion {\n toHaveDisplayValue(expected?: TextExpectation): void;\n toHaveTextContent(expected?: TextExpectation): void;\n toHaveAccessibleName(expected?: TextExpectation): void;\n toHavePlaceholderText(expected?: TextExpectation): void;\n toBeChecked(): void;\n toBePressed(): void;\n toBeExpanded(): void;\n toBeSelected(): void;\n toHaveValue(expected: number): void;\n }\n\n interface AsymmetricMatchersContaining {\n toHaveDisplayValue(expected?: TextExpectation): void;\n toHaveTextContent(expected?: TextExpectation): void;\n toHaveAccessibleName(expected?: TextExpectation): void;\n toHavePlaceholderText(expected?: TextExpectation): void;\n toBeChecked(): void;\n toBePressed(): void;\n toBeExpanded(): void;\n toBeSelected(): void;\n toHaveValue(expected: number): void;\n }\n /* eslint-enable @typescript-eslint/consistent-type-definitions */\n}\n\nexport {\n toHaveDisplayValue,\n toHaveTextContent,\n toHaveAccessibleName,\n toHavePlaceholderText,\n toBeChecked,\n toBePressed,\n toBeExpanded,\n toBeSelected,\n matchers,\n toHaveValue,\n registerMatchers,\n type TextExpectation,\n};\n"]}
1
+ {"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAEH,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,GAClB,MAAM,mCAAmC,CAAC;AA4D3C,MAAM,YAAY,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;AAC7C,MAAM,mBAAmB,GAAgB,WAAW,CAA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AAE,MAAM;QACZ,OAAO,EAAE,GAAG,EAAE,CACV,YAAY,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,qBAAqB,MAAM,CAAC,IAAI,CAAC,IAAI;YACjG,YAAY,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;KACrF,CAAC;AACN,CAAC;AAED,gHAAgH;AAChH,MAAM,gBAAgB,GAAG,GAAS,EAAE;IAChC,IAAI,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,OAAO;IACX,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO;IACX,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxB,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC;AACrC,CAAC,CAAC;AAsCF,OAAO,EACH,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,gBAAgB,GAInB,CAAC","sourcesContent":["/// <reference types=\"@vitest/expect\" />\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { getDefaultNormalizer } from \"./normalize.js\";\nimport { formatRole } from \"./role-helpers.js\";\nimport {\n type CheckedState,\n getWidgetAccessibleName,\n getWidgetCheckedState,\n getWidgetDescribedByText,\n getWidgetDisplayValue,\n getWidgetErrorMessage,\n getWidgetExpandedState,\n getWidgetInvalidState,\n getWidgetLabelText,\n getWidgetPlaceholderText,\n getWidgetPressedState,\n getWidgetRequiredState,\n getWidgetSelectedState,\n getWidgetSelection,\n getWidgetTextContent,\n getWidgetValue,\n hasDisplayValue,\n isWidgetDisabled,\n isWidgetVisible,\n} from \"./widget-accessible-properties.js\";\n\n/** The expected value for a text matcher: an exact string or a regular expression. */\ntype TextExpectation = string | RegExp;\n\n/** Options controlling how `toHaveTextContent` normalizes the text it reads. */\ntype TextContentOptions = {\n /**\n * When true (the default), trim the text and collapse runs of whitespace into single spaces\n * before comparing. When false, only replace non-breaking spaces with regular ones.\n */\n normalizeWhitespace?: boolean | undefined;\n};\n\n/** The expected value for a style class: an exact class name or a regular expression. */\ntype ClassExpectation = string | RegExp;\ntype MatcherResult = { pass: boolean; message: () => string };\ntype MatcherContext = { equals: (actual: unknown, expected: unknown) => boolean };\ntype TextMatcher = (received: unknown, expected?: TextExpectation) => MatcherResult;\ntype StateMatcher = (received: unknown) => MatcherResult;\ntype TextMatcherContext = { matcherName: string; widget: Gtk.Widget; actual: string | null };\ntype ClassArguments = { expected: ClassExpectation[]; isExact: boolean };\n\ntype TextContentMatcher = (\n received: unknown,\n expected?: TextExpectation,\n options?: TextContentOptions,\n) => MatcherResult;\n\ntype MatcherImplementations = {\n toHaveDisplayValue: TextMatcher;\n toHaveTextContent: TextContentMatcher;\n toHaveAccessibleName: TextMatcher;\n toHaveAccessibleDescription: TextMatcher;\n toHaveAccessibleErrorMessage: TextMatcher;\n toHavePlaceholderText: TextMatcher;\n toHaveSelection: TextMatcher;\n toBeChecked: StateMatcher;\n toBePartiallyChecked: StateMatcher;\n toBePressed: StateMatcher;\n toBeExpanded: StateMatcher;\n toBeSelected: StateMatcher;\n toBeDisabled: StateMatcher;\n toBeEnabled: StateMatcher;\n toBeVisible: StateMatcher;\n toBeRooted: StateMatcher;\n toBeEmpty: StateMatcher;\n toBeInvalid: StateMatcher;\n toBeValid: StateMatcher;\n toBeRequired: StateMatcher;\n toHaveFocus: StateMatcher;\n toHaveValue: (received: unknown, expected?: number | string) => MatcherResult;\n toHaveRole: (received: unknown, expected: Gtk.AccessibleRole) => MatcherResult;\n toContainElement: (received: unknown, descendant: Gtk.Widget | null) => MatcherResult;\n toHaveClass: (received: unknown, ...args: unknown[]) => MatcherResult;\n toHaveObjectProperty: (this: MatcherContext, received: unknown, ...args: unknown[]) => MatcherResult;\n};\n\ntype ExpectExtend = { extend: (m: MatcherImplementations) => void };\n\nconst registration = { isRegistered: false };\nconst displayValueMatcher: TextMatcher = textMatcher(\"toHaveDisplayValue\", getWidgetDisplayValue, \"exact\");\nconst toHaveAccessibleName: TextMatcher = textMatcher(\"toHaveAccessibleName\", getWidgetAccessibleName, \"exact\");\n\nconst toHaveAccessibleDescription: TextMatcher = textMatcher(\n \"toHaveAccessibleDescription\",\n getWidgetDescribedByText,\n \"exact\",\n);\n\nconst toHaveAccessibleErrorMessage: TextMatcher = textMatcher(\n \"toHaveAccessibleErrorMessage\",\n readErrorMessageText,\n \"exact\",\n);\n\nconst toHavePlaceholderText: TextMatcher = textMatcher(\"toHavePlaceholderText\", getWidgetPlaceholderText, \"exact\");\nconst toHaveSelection: TextMatcher = textMatcher(\"toHaveSelection\", getWidgetSelection, \"exact\");\nconst toBePressed: StateMatcher = booleanStateMatcher(\"toBePressed\", \"pressed\", getWidgetPressedState);\nconst toBeExpanded: StateMatcher = booleanStateMatcher(\"toBeExpanded\", \"expanded\", getWidgetExpandedState);\nconst toBeSelected: StateMatcher = booleanStateMatcher(\"toBeSelected\", \"selected\", getWidgetSelectedState);\nconst toBeRequired: StateMatcher = booleanStateMatcher(\"toBeRequired\", \"required\", getWidgetRequiredState);\n\n/** The widget assertion matchers keyed by name, suitable for passing to `expect.extend`. */\nconst matchers: MatcherImplementations = {\n toHaveDisplayValue,\n toHaveTextContent,\n toHaveAccessibleName,\n toHaveAccessibleDescription,\n toHaveAccessibleErrorMessage,\n toHavePlaceholderText,\n toHaveSelection,\n toBeChecked,\n toBePartiallyChecked,\n toBePressed,\n toBeExpanded,\n toBeSelected,\n toBeDisabled,\n toBeEnabled,\n toBeVisible,\n toBeRooted,\n toBeEmpty,\n toBeInvalid,\n toBeValid,\n toBeRequired,\n toHaveFocus,\n toHaveValue,\n toHaveRole,\n toContainElement,\n toHaveClass,\n toHaveObjectProperty,\n};\n\nconst asWidget = (received: unknown, matcherName: string): Gtk.Widget => {\n if (!(received instanceof Gtk.Widget)) {\n throw new TypeError(`${matcherName}: received value must be a Gtk.Widget, got ${typeof received}`);\n }\n\n return received;\n};\n\nconst asObject = (received: unknown, matcherName: string): GObject.Object => {\n if (!(received instanceof GObject.Object)) {\n throw new TypeError(`${matcherName}: received value must be a GObject, got ${typeof received}`);\n }\n\n return received;\n};\n\nconst describeWidget = (widget: Gtk.Widget): string => {\n const role = Gtk.AccessibleRole[widget.getAccessibleRole()];\n const name = getWidgetAccessibleName(widget);\n\n return name === null ? `<${role}>` : `<${role} name=${JSON.stringify(name)}>`;\n};\n\nconst describeObject = (object: GObject.Object): string =>\n object instanceof Gtk.Widget ? describeWidget(object) : `<${object.constructor.name}>`;\n\nconst isTextMatch = (actual: string, expected: TextExpectation, mode: \"exact\" | \"substring\"): boolean => {\n if (expected instanceof RegExp) {\n expected.lastIndex = 0;\n\n return expected.test(actual);\n }\n\n return mode === \"exact\" ? actual === expected : actual.includes(expected);\n};\n\nconst describeExpected = (expected: TextExpectation): string =>\n expected instanceof RegExp ? String(expected) : JSON.stringify(expected);\n\nconst negationPrefix = (isPass: boolean): string => (isPass ? \"not \" : \"\");\n\nconst nonEmptyResult = ({ matcherName, widget, actual }: TextMatcherContext): MatcherResult => {\n const isPass = actual !== null && actual !== \"\";\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have a non-empty value for ${matcherName}, ` +\n `but got ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n};\n\nconst matchedResult = (context: TextMatcherContext, expected: TextExpectation, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}${context.matcherName} ${describeExpected(expected)}, ` +\n `but received ${JSON.stringify(context.actual)}\\n${describeWidget(context.widget)}`,\n});\n\nconst stateResult = (widget: Gtk.Widget, stateName: string, isPass: boolean): MatcherResult => ({\n pass: isPass,\n message: () => `expected widget ${negationPrefix(isPass)}to be ${stateName}\\n${describeWidget(widget)}`,\n});\n\nconst camelCase = (name: string): string =>\n name.replaceAll(/-([a-z])/g, (_match, letter: string) => letter.toUpperCase());\n\nconst isAsymmetricMatcher = (value: unknown): boolean =>\n typeof value === \"object\" && value !== null && typeof Reflect.get(value, \"asymmetricMatch\") === \"function\";\n\nconst isEqualValue = (context: MatcherContext, actual: unknown, expected: unknown): boolean => {\n if (isAsymmetricMatcher(expected)) {\n return context.equals(actual, expected);\n }\n\n if (actual instanceof GObject.Object || expected instanceof GObject.Object) {\n return Object.is(actual, expected);\n }\n\n return context.equals(actual, expected);\n};\n\nconst isClassMatch = (actual: string[], expected: ClassExpectation): boolean =>\n expected instanceof RegExp ? actual.some((name) => expected.test(name)) : actual.includes(expected);\n\nconst isWidgetRooted = (widget: Gtk.Widget): boolean => {\n const root = widget.getRoot();\n\n if (root === null) {\n return false;\n }\n\n if (root instanceof Gtk.Window) {\n return Gtk.Window.listToplevels().includes(root);\n }\n\n return true;\n};\n\nconst globalExpect = (): ExpectExtend | null => {\n const candidate: unknown = Reflect.get(globalThis, \"expect\");\n\n if (candidate && typeof (candidate as ExpectExtend).extend === \"function\") {\n return candidate as ExpectExtend;\n }\n\n return null;\n};\n\nfunction readErrorMessageText(widget: Gtk.Widget): string | null {\n const state = getWidgetInvalidState(widget);\n\n if (state === null || state === Gtk.AccessibleInvalidState.FALSE) {\n return null;\n }\n\n const targets = getWidgetErrorMessage(widget);\n\n if (targets === null) {\n return null;\n }\n\n const texts = targets.map((target) => getWidgetAccessibleName(target)).filter((text) => text !== null);\n\n return texts.length > 0 ? texts.join(\" \") : null;\n}\n\nfunction assertReadableProperty(object: GObject.Object, name: string, property: string, value: unknown): void {\n if (typeof value === \"function\") {\n throw new TypeError(\n `toHaveObjectProperty: \"${name}\" is shadowed by a method of the same name; ` +\n `call ${property}() and assert on its result instead`,\n );\n }\n\n if (value === undefined && !Reflect.has(object, property)) {\n throw new TypeError(\n `toHaveObjectProperty: no readable property \"${name}\" on ${describeObject(object)}; ` +\n \"construct-only and write-only properties cannot be read back\",\n );\n }\n}\n\nfunction readObjectProperty(object: GObject.Object, name: string): unknown {\n const property = camelCase(name);\n const value: unknown = Reflect.get(object, property);\n assertReadableProperty(object, name, property, value);\n\n return value;\n}\n\nfunction classEntries(entry: unknown): ClassExpectation[] {\n return entry instanceof RegExp ? [entry] : String(entry).split(/\\s+/).filter(Boolean);\n}\n\nfunction parseClassArguments(args: unknown[]): ClassArguments {\n const last = args.at(-1);\n const isOptions = typeof last === \"object\" && last !== null && !(last instanceof RegExp);\n const isExact = isOptions && Reflect.get(last, \"exact\") === true;\n const entries = isOptions ? args.slice(0, -1) : args;\n\n return { expected: entries.flatMap((entry) => classEntries(entry)), isExact };\n}\n\nfunction exactClassResult(widget: Gtk.Widget, actual: string[], expected: ClassExpectation[]): MatcherResult {\n if (expected.some((entry) => entry instanceof RegExp)) {\n throw new TypeError(\"toHaveClass: the exact option cannot be combined with a regular expression\");\n }\n\n const names = expected.map(String);\n const isPass = names.length === actual.length && names.every((name) => actual.includes(name));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have exactly the classes ${JSON.stringify(names)}, ` +\n `but received ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction textMatcher(\n matcherName: string,\n read: (widget: Gtk.Widget) => string | null,\n mode: \"exact\" | \"substring\",\n): TextMatcher {\n return (received: unknown, expected?: TextExpectation): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const actual = read(widget);\n const context: TextMatcherContext = { matcherName, widget, actual };\n\n if (expected === undefined) {\n return nonEmptyResult(context);\n }\n\n return matchedResult(context, expected, actual !== null && isTextMatch(actual, expected, mode));\n };\n}\n\nfunction normalizeTextContent(text: string, options?: TextContentOptions): string {\n if (options?.normalizeWhitespace === false) {\n return text.replaceAll(\"\\u{A0}\", \" \");\n }\n\n return getDefaultNormalizer()(text);\n}\n\nfunction readTextContent(widget: Gtk.Widget, options?: TextContentOptions): string | null {\n const text = getWidgetTextContent(widget);\n\n return text === null ? null : normalizeTextContent(text, options);\n}\n\nfunction toHaveTextContent(\n received: unknown,\n expected?: TextExpectation,\n options?: TextContentOptions,\n): MatcherResult {\n const read = (widget: Gtk.Widget): string | null => readTextContent(widget, options);\n\n return textMatcher(\"toHaveTextContent\", read, \"substring\")(received, expected);\n}\n\nfunction notApplicable(matcherName: string, stateName: string, widget: Gtk.Widget): Error {\n return new Error(\n `${matcherName}: widget does not expose a ${stateName} ` +\n `(role ${Gtk.AccessibleRole[widget.getAccessibleRole()]})\\n${describeWidget(widget)}`,\n );\n}\n\nfunction booleanStateMatcher(\n matcherName: string,\n stateName: string,\n read: (widget: Gtk.Widget) => boolean | null,\n): StateMatcher {\n return (received: unknown): MatcherResult => {\n const widget = asWidget(received, matcherName);\n const state = read(widget);\n\n if (state === null) {\n throw notApplicable(matcherName, `${stateName} state`, widget);\n }\n\n return stateResult(widget, stateName, state);\n };\n}\n\nfunction readCheckedState(widget: Gtk.Widget, matcherName: string): CheckedState {\n const state = getWidgetCheckedState(widget);\n\n if (state === null) {\n throw notApplicable(matcherName, \"checked state\", widget);\n }\n\n return state;\n}\n\nfunction toBeChecked(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeChecked\");\n\n return stateResult(widget, \"checked\", readCheckedState(widget, \"toBeChecked\") === \"checked\");\n}\n\nfunction toBePartiallyChecked(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBePartiallyChecked\");\n\n return stateResult(widget, \"partially checked\", readCheckedState(widget, \"toBePartiallyChecked\") === \"mixed\");\n}\n\nfunction toHaveDisplayValue(received: unknown, expected?: TextExpectation): MatcherResult {\n const widget = asWidget(received, \"toHaveDisplayValue\");\n\n if (!hasDisplayValue(widget)) {\n throw notApplicable(\"toHaveDisplayValue\", \"display value\", widget);\n }\n\n return displayValueMatcher(received, expected);\n}\n\nfunction toHaveValue(received: unknown, expected?: number | string): MatcherResult {\n const widget = asWidget(received, \"toHaveValue\");\n\n if (typeof expected === \"string\") {\n return displayValueMatcher(received, expected);\n }\n\n const actual = getWidgetValue(widget).now;\n\n if (actual === null) {\n throw notApplicable(\"toHaveValue\", \"numeric value\", widget);\n }\n\n const isPass = expected === undefined || actual === expected;\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have value ${String(expected)}, ` +\n `but received ${String(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toBeDisabled(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeDisabled\");\n\n return stateResult(widget, \"disabled\", isWidgetDisabled(widget));\n}\n\nfunction toBeEnabled(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeEnabled\");\n\n return stateResult(widget, \"enabled\", !isWidgetDisabled(widget));\n}\n\nfunction toBeVisible(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeVisible\");\n\n return stateResult(widget, \"visible\", isWidgetVisible(widget));\n}\n\nfunction toBeRooted(received: unknown): MatcherResult {\n if (received === null) {\n return { pass: false, message: () => \"expected a widget to be rooted in a window, but received null\" };\n }\n\n const widget = asWidget(received, \"toBeRooted\");\n\n return stateResult(widget, \"rooted in a window\", isWidgetRooted(widget));\n}\n\nfunction toBeEmpty(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeEmpty\");\n\n return stateResult(widget, \"empty\", widget.getFirstChild() === null && getWidgetLabelText(widget) === null);\n}\n\nfunction toBeInvalid(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeInvalid\");\n const state = getWidgetInvalidState(widget);\n\n return stateResult(widget, \"invalid\", state !== null && state !== Gtk.AccessibleInvalidState.FALSE);\n}\n\nfunction toBeValid(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toBeValid\");\n const state = getWidgetInvalidState(widget);\n\n return stateResult(widget, \"valid\", state === null || state === Gtk.AccessibleInvalidState.FALSE);\n}\n\nfunction toHaveFocus(received: unknown): MatcherResult {\n const widget = asWidget(received, \"toHaveFocus\");\n\n return stateResult(widget, \"focused\", widget.getPlatformState(Gtk.AccessiblePlatformState.FOCUSED));\n}\n\nfunction toHaveRole(received: unknown, expected: Gtk.AccessibleRole): MatcherResult {\n const widget = asWidget(received, \"toHaveRole\");\n const actual = widget.getAccessibleRole();\n const isPass = actual === expected;\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have role '${formatRole(expected)}', ` +\n `but received '${formatRole(actual)}'\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toContainElement(received: unknown, descendant: Gtk.Widget | null): MatcherResult {\n const widget = asWidget(received, \"toContainElement\");\n const isPass = descendant !== null && (descendant === widget || descendant.isAncestor(widget));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to contain ` +\n `${descendant === null ? \"null\" : describeWidget(descendant)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toHaveClass(received: unknown, ...args: unknown[]): MatcherResult {\n const widget = asWidget(received, \"toHaveClass\");\n const actual = widget.getCssClasses();\n const { expected, isExact } = parseClassArguments(args);\n\n if (isExact) {\n return exactClassResult(widget, actual, expected);\n }\n\n if (expected.length === 0) {\n return stateResult(widget, \"given any style class\", actual.length > 0);\n }\n\n const isPass = expected.every((entry) => isClassMatch(actual, entry));\n\n return {\n pass: isPass,\n message: () =>\n `expected widget ${negationPrefix(isPass)}to have class ${expected.map(String).join(\", \")}, ` +\n `but received ${JSON.stringify(actual)}\\n${describeWidget(widget)}`,\n };\n}\n\nfunction toHaveObjectProperty(this: MatcherContext, received: unknown, ...args: unknown[]): MatcherResult {\n const object = asObject(received, \"toHaveObjectProperty\");\n const [name, expected] = args;\n const actual = readObjectProperty(object, String(name));\n\n if (args.length < 2) {\n const isSet = actual !== null && actual !== undefined;\n\n return {\n pass: isSet,\n message: () =>\n `expected ${describeObject(object)} ${negationPrefix(isSet)}to have a value for property ` +\n `\"${String(name)}\", but received ${JSON.stringify(actual)}`,\n };\n }\n\n /* eslint-disable-next-line unicorn/no-this-outside-of-class --\n expect.extend invokes matchers with the matcher state as `this` */\n const isPass = isEqualValue(this, actual, expected);\n\n return {\n pass: isPass,\n message: () =>\n `expected ${describeObject(object)} ${negationPrefix(isPass)}to have property \"${String(name)}\" ` +\n `equal to ${JSON.stringify(expected)}, but received ${JSON.stringify(actual)}`,\n };\n}\n\n/** Registers the widget matchers on the global `expect`, when one is available. Safe to call more than once. */\nconst registerMatchers = (): void => {\n if (registration.isRegistered) {\n return;\n }\n\n const expect = globalExpect();\n\n if (!expect) {\n return;\n }\n\n expect.extend(matchers);\n registration.isRegistered = true;\n};\n\ndeclare module \"@vitest/expect\" {\n /* eslint-disable @typescript-eslint/consistent-type-definitions -- declaration merging requires interfaces */\n interface WidgetMatchers {\n toHaveDisplayValue(expected?: TextExpectation): void;\n toHaveTextContent(expected?: TextExpectation, options?: TextContentOptions): void;\n toHaveAccessibleName(expected?: TextExpectation): void;\n toHaveAccessibleDescription(expected?: TextExpectation): void;\n toHaveAccessibleErrorMessage(expected?: TextExpectation): void;\n toHavePlaceholderText(expected?: TextExpectation): void;\n toHaveSelection(expected?: TextExpectation): void;\n toBeChecked(): void;\n toBePartiallyChecked(): void;\n toBePressed(): void;\n toBeExpanded(): void;\n toBeSelected(): void;\n toBeDisabled(): void;\n toBeEnabled(): void;\n toBeVisible(): void;\n toBeRooted(): void;\n toBeEmpty(): void;\n toBeInvalid(): void;\n toBeValid(): void;\n toBeRequired(): void;\n toHaveFocus(): void;\n toHaveValue(expected?: number | string): void;\n toHaveRole(expected: Gtk.AccessibleRole): void;\n toContainElement(descendant: Gtk.Widget | null): void;\n toHaveClass(...args: (ClassExpectation | { exact: boolean })[]): void;\n toHaveObjectProperty(name: string, expected?: unknown): void;\n }\n\n interface Assertion extends WidgetMatchers {}\n interface AsymmetricMatchersContaining extends WidgetMatchers {}\n /* eslint-enable @typescript-eslint/consistent-type-definitions */\n}\n\nexport {\n toHaveDisplayValue,\n toHaveTextContent,\n toHaveAccessibleName,\n toHaveAccessibleDescription,\n toHaveAccessibleErrorMessage,\n toHavePlaceholderText,\n toHaveSelection,\n toBeChecked,\n toBePartiallyChecked,\n toBePressed,\n toBeExpanded,\n toBeSelected,\n toBeDisabled,\n toBeEnabled,\n toBeVisible,\n toBeRooted,\n toBeEmpty,\n toBeInvalid,\n toBeValid,\n toBeRequired,\n toHaveFocus,\n toHaveValue,\n toHaveRole,\n toContainElement,\n toHaveClass,\n toHaveObjectProperty,\n matchers,\n registerMatchers,\n type ClassExpectation,\n type TextContentOptions,\n type TextExpectation,\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import type { NormalizerFn, NormalizerOptions } from "./types.js";
2
+ /**
3
+ * Builds the default text normalizer, which optionally trims surrounding whitespace and collapses
4
+ * runs of whitespace into single spaces.
5
+ * @param options Toggles for trimming and whitespace collapsing.
6
+ * @returns A function that normalizes a string for comparison against a matcher.
7
+ */
8
+ declare const getDefaultNormalizer: ({ trim, collapseWhitespace, }?: NormalizerOptions) => NormalizerFn;
9
+ export { getDefaultNormalizer };
10
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;GAKG;AACH,QAAA,MAAM,oBAAoB,GAAI,gCAG3B,iBAAsB,KAAG,YAc3B,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Builds the default text normalizer, which optionally trims surrounding whitespace and collapses
3
+ * runs of whitespace into single spaces.
4
+ * @param options Toggles for trimming and whitespace collapsing.
5
+ * @returns A function that normalizes a string for comparison against a matcher.
6
+ */
7
+ const getDefaultNormalizer = ({ trim = true, collapseWhitespace = true, } = {}) => {
8
+ return (text) => {
9
+ let result = text;
10
+ if (trim) {
11
+ result = result.trim();
12
+ }
13
+ if (collapseWhitespace) {
14
+ result = result.replaceAll(/\s+/g, " ");
15
+ }
16
+ return result;
17
+ };
18
+ };
19
+ export { getDefaultNormalizer };
20
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,CAAC,EAC1B,IAAI,GAAG,IAAI,EACX,kBAAkB,GAAG,IAAI,MACN,EAAE,EAAgB,EAAE;IACvC,OAAO,CAAC,IAAY,EAAU,EAAE;QAC5B,IAAI,MAAM,GAAG,IAAI,CAAC;QAElB,IAAI,IAAI,EAAE,CAAC;YACP,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAC3B,CAAC;QAED,IAAI,kBAAkB,EAAE,CAAC;YACrB,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import type { NormalizerFn, NormalizerOptions } from \"./types.js\";\n\n/**\n * Builds the default text normalizer, which optionally trims surrounding whitespace and collapses\n * runs of whitespace into single spaces.\n * @param options Toggles for trimming and whitespace collapsing.\n * @returns A function that normalizes a string for comparison against a matcher.\n */\nconst getDefaultNormalizer = ({\n trim = true,\n collapseWhitespace = true,\n}: NormalizerOptions = {}): NormalizerFn => {\n return (text: string): string => {\n let result = text;\n\n if (trim) {\n result = result.trim();\n }\n\n if (collapseWhitespace) {\n result = result.replaceAll(/\\s+/g, \" \");\n }\n\n return result;\n };\n};\n\nexport { getDefaultNormalizer };\n"]}
package/dist/queries.d.ts CHANGED
@@ -1,18 +1,7 @@
1
1
  import * as Gtk from "@gtkx/gi/gtk";
2
- import type { ByRoleOptions, Matcher, MatcherOptions, NormalizerFn, NormalizerOptions } from "./types.js";
2
+ import type { ByRoleOptions, Matcher, MatcherOptions, QueryFamilies } from "./types.js";
3
3
  import { type Container } from "./traversal.js";
4
- type QueryFamilyReturns = {
5
- queryBy: Gtk.Widget | null;
6
- queryAllBy: Gtk.Widget[];
7
- getBy: Gtk.Widget;
8
- getAllBy: Gtk.Widget[];
9
- findBy: Promise<Gtk.Widget>;
10
- findAllBy: Promise<Gtk.Widget[]>;
11
- };
12
- type NamedFamily<Suffix extends string, Args extends unknown[]> = {
13
- [K in keyof QueryFamilyReturns as `${K & string}${Suffix}`]: (container: Container, ...args: Args) => QueryFamilyReturns[K];
14
- };
15
- type BuiltinQueries = NamedFamily<"Role", [role: Gtk.AccessibleRole, options?: ByRoleOptions]> & NamedFamily<"LabelText", [text: Matcher, options?: MatcherOptions]> & NamedFamily<"Text", [text: Matcher, options?: MatcherOptions]> & NamedFamily<"Name", [name: Matcher, options?: MatcherOptions]> & NamedFamily<"PlaceholderText", [text: Matcher, options?: MatcherOptions]> & NamedFamily<"DisplayValue", [value: Matcher, options?: MatcherOptions]>;
4
+ type BuiltinQueries = QueryFamilies<[container: Container]>;
16
5
  declare const builtinQueries: BuiltinQueries;
17
6
  /**
18
7
  * Returns the single widget with a matching accessible role and options, or null when none match.
@@ -131,13 +120,6 @@ declare const findAllByDisplayValue: BuiltinQueries["findAllByDisplayValue"];
131
120
  * or the timeout elapses. Rejects when none or more than one matches.
132
121
  */
133
122
  declare const findByDisplayValue: BuiltinQueries["findByDisplayValue"];
134
- /**
135
- * Builds the default text normalizer, which optionally trims surrounding whitespace and collapses
136
- * runs of whitespace into single spaces.
137
- * @param options Toggles for trimming and whitespace collapsing.
138
- * @returns A function that normalizes a string for comparison against a matcher.
139
- */
140
- declare const getDefaultNormalizer: ({ trim, collapseWhitespace, }?: NormalizerOptions) => NormalizerFn;
141
123
  /**
142
124
  * Finds every widget under the container whose accessible role matches `role` and that satisfies the given options.
143
125
  * Widgets excluded from the accessibility tree are skipped unless `options.hidden` is set.
@@ -188,5 +170,5 @@ declare function queryAllByPlaceholderText(container: Container, text: Matcher,
188
170
  * @returns Every matching widget, or an empty array when none match.
189
171
  */
190
172
  declare function queryAllByDisplayValue(container: Container, value: Matcher, options?: MatcherOptions): Gtk.Widget[];
191
- export { builtinQueries, queryByRole, getAllByRole, getByRole, findAllByRole, findByRole, queryByLabelText, getAllByLabelText, getByLabelText, findAllByLabelText, findByLabelText, queryByText, getAllByText, getByText, findAllByText, findByText, queryByName, getAllByName, getByName, findAllByName, findByName, queryByPlaceholderText, getAllByPlaceholderText, getByPlaceholderText, findAllByPlaceholderText, findByPlaceholderText, queryByDisplayValue, getAllByDisplayValue, getByDisplayValue, findAllByDisplayValue, findByDisplayValue, getDefaultNormalizer, queryAllByRole, queryAllByLabelText, queryAllByText, queryAllByName, queryAllByPlaceholderText, queryAllByDisplayValue, type BuiltinQueries, };
173
+ export { builtinQueries, queryByRole, getAllByRole, getByRole, findAllByRole, findByRole, queryByLabelText, getAllByLabelText, getByLabelText, findAllByLabelText, findByLabelText, queryByText, getAllByText, getByText, findAllByText, findByText, queryByName, getAllByName, getByName, findAllByName, findByName, queryByPlaceholderText, getAllByPlaceholderText, getByPlaceholderText, findAllByPlaceholderText, findByPlaceholderText, queryByDisplayValue, getAllByDisplayValue, getByDisplayValue, findAllByDisplayValue, findByDisplayValue, queryAllByRole, queryAllByLabelText, queryAllByText, queryAllByName, queryAllByPlaceholderText, queryAllByDisplayValue, type BuiltinQueries, };
192
174
  //# sourceMappingURL=queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAA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