rescript-vitest-extras 0.1.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.
@@ -0,0 +1,302 @@
1
+ /**
2
+ * Vitest Assert API bindings.
3
+ *
4
+ * These bindings wrap Vitest's chai-based assert API with ergonomic ReScript types.
5
+ * Organized into submodules for type-specific assertions.
6
+ */
7
+ /** Asserts that `expression` is truthy. */
8
+ let // ============================================================================
9
+ // Core Assertions
10
+ // ============================================================================
11
+
12
+ assert_: (~message: string=?, 'a) => unit
13
+
14
+ /** Force an assertion failure with an optional message. */
15
+ let fail: (~message: string=?) => unit
16
+
17
+ // ============================================================================
18
+ // Equality
19
+ // ============================================================================
20
+
21
+ /** Non-strict equality comparison (==). */
22
+ let equal: (~message: string=?, 'a, 'a) => unit
23
+
24
+ /** Non-strict inequality comparison (!=). */
25
+ let notEqual: (~message: string=?, 'a, 'a) => unit
26
+
27
+ /** Strict equality comparison (===). */
28
+ let strictEqual: (~message: string=?, 'a, 'a) => unit
29
+
30
+ /** Strict inequality comparison (!==). */
31
+ let notStrictEqual: (~message: string=?, 'a, 'a) => unit
32
+
33
+ /** Deep equality comparison. */
34
+ let deepEqual: (~message: string=?, 'a, 'a) => unit
35
+
36
+ /** Deep inequality comparison. */
37
+ let notDeepEqual: (~message: string=?, 'a, 'a) => unit
38
+
39
+ // ============================================================================
40
+ // Numeric Comparisons
41
+ // ============================================================================
42
+
43
+ /** Asserts that `value > target`. */
44
+ let isAbove: (~message: string=?, float, float) => unit
45
+
46
+ /** Asserts that `value >= target`. */
47
+ let isAtLeast: (~message: string=?, float, float) => unit
48
+
49
+ /** Asserts that `value < target`. */
50
+ let isBelow: (~message: string=?, float, float) => unit
51
+
52
+ /** Asserts that `value <= target`. */
53
+ let isAtMost: (~message: string=?, float, float) => unit
54
+
55
+ /** Asserts that `actual` is within +/- `delta` of `expected`. */
56
+ let closeTo: (~message: string=?, float, float, ~delta: float) => unit
57
+
58
+ /** Alias for `closeTo`. */
59
+ let approximately: (~message: string=?, float, float, ~delta: float) => unit
60
+
61
+ // ============================================================================
62
+ // Boolean Assertions
63
+ // ============================================================================
64
+
65
+ /** Asserts that `value` is exactly `true`. */
66
+ let isTrue: (~message: string=?, bool) => unit
67
+
68
+ /** Asserts that `value` is not exactly `true`. */
69
+ let isNotTrue: (~message: string=?, bool) => unit
70
+
71
+ /** Asserts that `value` is exactly `false`. */
72
+ let isFalse: (~message: string=?, bool) => unit
73
+
74
+ /** Asserts that `value` is not exactly `false`. */
75
+ let isNotFalse: (~message: string=?, bool) => unit
76
+
77
+ // ============================================================================
78
+ // NaN and Finite Assertions
79
+ // ============================================================================
80
+
81
+ /** Asserts that `value` is `NaN`. */
82
+ let isNaN: (~message: string=?, float) => unit
83
+
84
+ /** Asserts that `value` is not `NaN`. */
85
+ let isNotNaN: (~message: string=?, float) => unit
86
+
87
+ /** Asserts that `value` is finite (not NaN or Infinity). */
88
+ let isFinite: (~message: string=?, float) => unit
89
+
90
+ // ============================================================================
91
+ // Regex Matching
92
+ // ============================================================================
93
+
94
+ /** Asserts that `value` matches the regular expression. */
95
+ let match_: (~message: string=?, string, RegExp.t) => unit
96
+
97
+ /** Asserts that `value` does not match the regular expression. */
98
+ let notMatch: (~message: string=?, string, RegExp.t) => unit
99
+
100
+ // ============================================================================
101
+ // oneOf
102
+ // ============================================================================
103
+
104
+ /** Asserts that `value` is one of the values in `list`. */
105
+ let oneOf: (~message: string=?, 'a, array<'a>) => unit
106
+
107
+ // ============================================================================
108
+ // Exception Assertions
109
+ // ============================================================================
110
+
111
+ /** Asserts that `fn` throws an exception. */
112
+ let throws: (~message: string=?, unit => 'a) => unit
113
+
114
+ /** Asserts that `fn` throws an exception matching the regexp. */
115
+ let throwsWithMatch: (~message: string=?, unit => 'a, RegExp.t) => unit
116
+
117
+ /** Asserts that `fn` does not throw an exception. */
118
+ let doesNotThrow: (~message: string=?, unit => 'a) => unit
119
+
120
+ // ============================================================================
121
+ // Object State Assertions
122
+ // ============================================================================
123
+
124
+ /** Asserts that `object` is extensible (can have new properties added). */
125
+ let isExtensible: (~message: string=?, 'a) => unit
126
+
127
+ /** Asserts that `object` is not extensible. */
128
+ let isNotExtensible: (~message: string=?, 'a) => unit
129
+
130
+ /** Asserts that `object` is sealed (properties cannot be added or deleted). */
131
+ let isSealed: (~message: string=?, 'a) => unit
132
+
133
+ /** Asserts that `object` is not sealed. */
134
+ let isNotSealed: (~message: string=?, 'a) => unit
135
+
136
+ /** Asserts that `object` is frozen (cannot be modified at all). */
137
+ let isFrozen: (~message: string=?, 'a) => unit
138
+
139
+ /** Asserts that `object` is not frozen. */
140
+ let isNotFrozen: (~message: string=?, 'a) => unit
141
+
142
+ // ============================================================================
143
+ // Null Assertions
144
+ // ============================================================================
145
+
146
+ module Null: {
147
+ /** Asserts that `value` is `null`. */
148
+ let isNull: (~message: string=?, Null.t<'a>) => unit
149
+
150
+ /** Asserts that `value` is not `null`. */
151
+ let isNotNull: (~message: string=?, Null.t<'a>) => unit
152
+ }
153
+
154
+ // ============================================================================
155
+ // Undefined Assertions
156
+ // ============================================================================
157
+
158
+ module Undefined: {
159
+ /** Asserts that `value` is `undefined`. */
160
+ let isUndefined: (~message: string=?, undefined<'a>) => unit
161
+
162
+ /** Asserts that `value` is not `undefined`. */
163
+ let isDefined: (~message: string=?, undefined<'a>) => unit
164
+ }
165
+
166
+ // ============================================================================
167
+ // Nullable Assertions (null | undefined | value)
168
+ // ============================================================================
169
+
170
+ module Nullable: {
171
+ /** Asserts that `value` is `null`. */
172
+ let isNull: (~message: string=?, Nullable.t<'a>) => unit
173
+
174
+ /** Asserts that `value` is not `null` (may still be undefined). */
175
+ let isNotNull: (~message: string=?, Nullable.t<'a>) => unit
176
+
177
+ /** Asserts that `value` is `undefined`. */
178
+ let isUndefined: (~message: string=?, Nullable.t<'a>) => unit
179
+
180
+ /** Asserts that `value` is not `undefined` (may still be null). */
181
+ let isDefined: (~message: string=?, Nullable.t<'a>) => unit
182
+
183
+ /** Asserts that `value` is neither `null` nor `undefined`. */
184
+ let exists: (~message: string=?, Nullable.t<'a>) => unit
185
+
186
+ /** Asserts that `value` is `null` or `undefined`. */
187
+ let notExists: (~message: string=?, Nullable.t<'a>) => unit
188
+ }
189
+
190
+ // ============================================================================
191
+ // Array Assertions
192
+ // ============================================================================
193
+
194
+ module Array: {
195
+ /** Asserts that `arr` is empty (has length 0). */
196
+ let isEmpty: (~message: string=?, array<'a>) => unit
197
+
198
+ /** Asserts that `arr` is not empty. */
199
+ let isNotEmpty: (~message: string=?, array<'a>) => unit
200
+
201
+ /** Asserts that `arr` has a `length` equal to `expected`. */
202
+ let lengthOf: (~message: string=?, array<'a>, int) => unit
203
+
204
+ /** Asserts that `haystack` array contains `needle`. */
205
+ let includes: (~message: string=?, array<'a>, 'a) => unit
206
+
207
+ /** Asserts that `haystack` array does not contain `needle`. */
208
+ let notIncludes: (~message: string=?, array<'a>, 'a) => unit
209
+
210
+ /** Asserts that `actual` and `expected` have the same members (in any order). */
211
+ let sameMembers: (~message: string=?, array<'a>, array<'a>) => unit
212
+
213
+ /** Asserts that `actual` and `expected` do not have the same members. */
214
+ let notSameMembers: (~message: string=?, array<'a>, array<'a>) => unit
215
+
216
+ /** Asserts that `actual` and `expected` have the same members (deep comparison, any order). */
217
+ let sameDeepMembers: (~message: string=?, array<'a>, array<'a>) => unit
218
+
219
+ /** Asserts that `actual` and `expected` do not have the same members (deep comparison). */
220
+ let notSameDeepMembers: (~message: string=?, array<'a>, array<'a>) => unit
221
+
222
+ /** Asserts that `actual` and `expected` have the same members in the same order. */
223
+ let sameOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
224
+
225
+ /** Asserts that `actual` and `expected` do not have the same members in order. */
226
+ let notSameOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
227
+
228
+ /** Asserts that `actual` and `expected` have the same members in order (deep comparison). */
229
+ let sameDeepOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
230
+
231
+ /** Asserts that `actual` and `expected` do not have the same members in order (deep comparison). */
232
+ let notSameDeepOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
233
+
234
+ /** Asserts that `superset` contains all members of `subset` (in any order). */
235
+ let includeMembers: (~message: string=?, array<'a>, array<'a>) => unit
236
+
237
+ /** Asserts that `superset` does not contain all members of `subset`. */
238
+ let notIncludeMembers: (~message: string=?, array<'a>, array<'a>) => unit
239
+
240
+ /** Asserts that `superset` contains all members of `subset` (deep comparison). */
241
+ let includeDeepMembers: (~message: string=?, array<'a>, array<'a>) => unit
242
+
243
+ /** Asserts that `superset` does not contain all members of `subset` (deep comparison). */
244
+ let notIncludeDeepMembers: (~message: string=?, array<'a>, array<'a>) => unit
245
+
246
+ /** Asserts that `superset` contains `subset` in the same order (as a contiguous subsequence). */
247
+ let includeOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
248
+
249
+ /** Asserts that `superset` does not contain `subset` as a contiguous subsequence. */
250
+ let notIncludeOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
251
+
252
+ /** Asserts that `superset` contains `subset` in order (deep comparison). */
253
+ let includeDeepOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
254
+
255
+ /** Asserts that `superset` does not contain `subset` in order (deep comparison). */
256
+ let notIncludeDeepOrderedMembers: (~message: string=?, array<'a>, array<'a>) => unit
257
+ }
258
+
259
+ // ============================================================================
260
+ // String Assertions
261
+ // ============================================================================
262
+
263
+ module String: {
264
+ /** Asserts that `str` is empty (has length 0). */
265
+ let isEmpty: (~message: string=?, string) => unit
266
+
267
+ /** Asserts that `str` is not empty. */
268
+ let isNotEmpty: (~message: string=?, string) => unit
269
+
270
+ /** Asserts that `str` has a `length` equal to `expected`. */
271
+ let lengthOf: (~message: string=?, string, int) => unit
272
+
273
+ /** Asserts that `haystack` string contains `needle` substring. */
274
+ let includes: (~message: string=?, string, string) => unit
275
+
276
+ /** Asserts that `haystack` string does not contain `needle` substring. */
277
+ let notIncludes: (~message: string=?, string, string) => unit
278
+ }
279
+
280
+ // ============================================================================
281
+ // Result Ergonomic Assertions
282
+ // ============================================================================
283
+
284
+ module Result: {
285
+ /** Asserts that `result` is `Ok`. */
286
+ let isOk: (~message: string=?, result<'a, 'e>) => unit
287
+
288
+ /** Asserts that `result` is `Error`. */
289
+ let isError: (~message: string=?, result<'a, 'e>) => unit
290
+ }
291
+
292
+ // ============================================================================
293
+ // Option Ergonomic Assertions
294
+ // ============================================================================
295
+
296
+ module Option: {
297
+ /** Asserts that `option` is `Some`. */
298
+ let isSome: (~message: string=?, option<'a>) => unit
299
+
300
+ /** Asserts that `option` is `None`. */
301
+ let isNone: (~message: string=?, option<'a>) => unit
302
+ }
@@ -0,0 +1,159 @@
1
+ // =============================================================================
2
+ // Core Type and Entry Point
3
+ // =============================================================================
4
+
5
+ /**
6
+ * Vitest Browser DOM Assertion API bindings.
7
+ *
8
+ * Provides type-safe bindings for `expect.element()` and the DOM matchers from
9
+ * `@vitest/browser`. All matchers return `promise<unit>` because `expect.element()`
10
+ * wraps `expect.poll()`, which retries assertions until they pass or timeout.
11
+ */
12
+ /** The assertion type returned by `expect.element()`. All matchers return `promise<unit>`. */
13
+ type t
14
+
15
+ /** Options for controlling the retry behavior of `expect.element()`. */
16
+ type expectPollOptions = {
17
+ interval?: int,
18
+ timeout?: int,
19
+ message?: string,
20
+ }
21
+
22
+ /** Creates a DOM element assertion from a Locator. Automatically retries until passing or timeout. */
23
+ @module("vitest") @scope("expect")
24
+ external element: (VitestExtras__BrowserLocator.t, ~options: expectPollOptions=?) => t = "element"
25
+
26
+ /** Negates the following assertion. */
27
+ @get external not: t => t = "not"
28
+
29
+ // =============================================================================
30
+ // State Matchers
31
+ // =============================================================================
32
+
33
+ /** Asserts that the element is disabled. */
34
+ @send
35
+ external toBeDisabled: t => promise<unit> = "toBeDisabled"
36
+
37
+ /** Asserts that the element is enabled (not disabled). */
38
+ @send
39
+ external toBeEnabled: t => promise<unit> = "toBeEnabled"
40
+
41
+ /** Asserts that the checkbox or radio input is checked. */
42
+ @send
43
+ external toBeChecked: t => promise<unit> = "toBeChecked"
44
+
45
+ /** Asserts that the checkbox is in an indeterminate (partially checked) state. */
46
+ @send
47
+ external toBePartiallyChecked: t => promise<unit> = "toBePartiallyChecked"
48
+
49
+ /** Asserts that the form element has the `required` attribute. */
50
+ @send
51
+ external toBeRequired: t => promise<unit> = "toBeRequired"
52
+
53
+ /** Asserts that the form element passes validation. */
54
+ @send
55
+ external toBeValid: t => promise<unit> = "toBeValid"
56
+
57
+ /** Asserts that the form element fails validation. */
58
+ @send
59
+ external toBeInvalid: t => promise<unit> = "toBeInvalid"
60
+
61
+ // =============================================================================
62
+ // Visibility Matchers
63
+ // =============================================================================
64
+
65
+ /** Asserts that the element is visible to the user. */
66
+ @send
67
+ external toBeVisible: t => promise<unit> = "toBeVisible"
68
+
69
+ /** Asserts that the element is present in the document. */
70
+ @send
71
+ external toBeInTheDocument: t => promise<unit> = "toBeInTheDocument"
72
+
73
+ /** Asserts that the element has no visible content (no text, no child elements). */
74
+ @send
75
+ external toBeEmptyDOMElement: t => promise<unit> = "toBeEmptyDOMElement"
76
+
77
+ // =============================================================================
78
+ // Content Matchers
79
+ // =============================================================================
80
+
81
+ /** Asserts that the element has the expected text content. Accepts a string or RegExp. */
82
+ @send
83
+ external toHaveTextContent: (t, VitestExtras__BrowserLocator.stringOrRegExp) => promise<unit> =
84
+ "toHaveTextContent"
85
+
86
+ /** Asserts that the element contains the given element as a descendant. Accepts a Locator. */
87
+ @send
88
+ external toContainElement: (t, VitestExtras__BrowserLocator.t) => promise<unit> = "toContainElement"
89
+
90
+ /** Asserts that the element contains the given HTML string in its `innerHTML`. */
91
+ @send
92
+ external toContainHTML: (t, string) => promise<unit> = "toContainHTML"
93
+
94
+ /** Asserts that the element has the expected accessible name. */
95
+ @send
96
+ external toHaveAccessibleName: (
97
+ t,
98
+ ~name: VitestExtras__BrowserLocator.stringOrRegExp=?,
99
+ ) => promise<unit> = "toHaveAccessibleName"
100
+
101
+ /** Asserts that the element has the expected accessible description. */
102
+ @send
103
+ external toHaveAccessibleDescription: (
104
+ t,
105
+ ~description: VitestExtras__BrowserLocator.stringOrRegExp=?,
106
+ ) => promise<unit> = "toHaveAccessibleDescription"
107
+
108
+ /** Asserts that the element has the expected accessible error message. */
109
+ @send
110
+ external toHaveAccessibleErrorMessage: (
111
+ t,
112
+ ~message: VitestExtras__BrowserLocator.stringOrRegExp=?,
113
+ ) => promise<unit> = "toHaveAccessibleErrorMessage"
114
+
115
+ // =============================================================================
116
+ // Attribute Matchers
117
+ // =============================================================================
118
+
119
+ /** Asserts that the element has the given attribute, optionally with the expected value. */
120
+ @send
121
+ external toHaveAttribute: (t, string, ~value: string=?) => promise<unit> = "toHaveAttribute"
122
+
123
+ /** Asserts that the element has the given CSS class name. */
124
+ @send
125
+ external toHaveClass: (t, string) => promise<unit> = "toHaveClass"
126
+
127
+ /** Asserts that the element has the given CSS styles applied. Accepts a CSS string. */
128
+ @send
129
+ external toHaveStyle: (t, string) => promise<unit> = "toHaveStyle"
130
+
131
+ /** Asserts that the element has the given ARIA role. */
132
+ @send
133
+ external toHaveRole: (t, VitestExtras__BrowserLocator.ariaRole) => promise<unit> = "toHaveRole"
134
+
135
+ // =============================================================================
136
+ // Form Matchers
137
+ // =============================================================================
138
+
139
+ /** Asserts that the form element has the expected value. The value type is intentionally
140
+ polymorphic to support `string`, `int`, `null`, or `array<string>`. */
141
+ @send
142
+ external toHaveValue: (t, 'a) => promise<unit> = "toHaveValue"
143
+
144
+ /** Asserts that the form element displays the expected value. The value type is intentionally
145
+ polymorphic to support `string`, `int`, `RegExp`, or `array<string | RegExp | int>`. */
146
+ @send
147
+ external toHaveDisplayValue: (t, 'a) => promise<unit> = "toHaveDisplayValue"
148
+
149
+ /** Asserts that the form has the expected field values. Accepts an open object. */
150
+ @send
151
+ external toHaveFormValues: (t, {..}) => promise<unit> = "toHaveFormValues"
152
+
153
+ /** Asserts that the element currently has focus. */
154
+ @send
155
+ external toHaveFocus: t => promise<unit> = "toHaveFocus"
156
+
157
+ /** Asserts that the element has the expected text selection. */
158
+ @send
159
+ external toHaveSelection: (t, ~selection: string=?) => promise<unit> = "toHaveSelection"
@@ -0,0 +1,159 @@
1
+ // =============================================================================
2
+ // Core Type and Entry Point
3
+ // =============================================================================
4
+
5
+ /**
6
+ * Vitest Browser DOM Assertion API bindings.
7
+ *
8
+ * Provides type-safe bindings for `expect.element()` and the DOM matchers from
9
+ * `@vitest/browser`. All matchers return `promise<unit>` because `expect.element()`
10
+ * wraps `expect.poll()`, which retries assertions until they pass or timeout.
11
+ */
12
+ /** The assertion type returned by `expect.element()`. All matchers return `promise<unit>`. */
13
+ type t
14
+
15
+ /** Options for controlling the retry behavior of `expect.element()`. */
16
+ type expectPollOptions = {
17
+ interval?: int,
18
+ timeout?: int,
19
+ message?: string,
20
+ }
21
+
22
+ /** Creates a DOM element assertion from a Locator. Automatically retries until passing or timeout. */
23
+ @module("vitest") @scope("expect")
24
+ external element: (VitestExtras__BrowserLocator.t, ~options: expectPollOptions=?) => t = "element"
25
+
26
+ /** Negates the following assertion. */
27
+ @get external not: t => t = "not"
28
+
29
+ // =============================================================================
30
+ // State Matchers
31
+ // =============================================================================
32
+
33
+ /** Asserts that the element is disabled. */
34
+ @send
35
+ external toBeDisabled: t => promise<unit> = "toBeDisabled"
36
+
37
+ /** Asserts that the element is enabled (not disabled). */
38
+ @send
39
+ external toBeEnabled: t => promise<unit> = "toBeEnabled"
40
+
41
+ /** Asserts that the checkbox or radio input is checked. */
42
+ @send
43
+ external toBeChecked: t => promise<unit> = "toBeChecked"
44
+
45
+ /** Asserts that the checkbox is in an indeterminate (partially checked) state. */
46
+ @send
47
+ external toBePartiallyChecked: t => promise<unit> = "toBePartiallyChecked"
48
+
49
+ /** Asserts that the form element has the `required` attribute. */
50
+ @send
51
+ external toBeRequired: t => promise<unit> = "toBeRequired"
52
+
53
+ /** Asserts that the form element passes validation. */
54
+ @send
55
+ external toBeValid: t => promise<unit> = "toBeValid"
56
+
57
+ /** Asserts that the form element fails validation. */
58
+ @send
59
+ external toBeInvalid: t => promise<unit> = "toBeInvalid"
60
+
61
+ // =============================================================================
62
+ // Visibility Matchers
63
+ // =============================================================================
64
+
65
+ /** Asserts that the element is visible to the user. */
66
+ @send
67
+ external toBeVisible: t => promise<unit> = "toBeVisible"
68
+
69
+ /** Asserts that the element is present in the document. */
70
+ @send
71
+ external toBeInTheDocument: t => promise<unit> = "toBeInTheDocument"
72
+
73
+ /** Asserts that the element has no visible content (no text, no child elements). */
74
+ @send
75
+ external toBeEmptyDOMElement: t => promise<unit> = "toBeEmptyDOMElement"
76
+
77
+ // =============================================================================
78
+ // Content Matchers
79
+ // =============================================================================
80
+
81
+ /** Asserts that the element has the expected text content. Accepts a string or RegExp. */
82
+ @send
83
+ external toHaveTextContent: (t, VitestExtras__BrowserLocator.stringOrRegExp) => promise<unit> =
84
+ "toHaveTextContent"
85
+
86
+ /** Asserts that the element contains the given element as a descendant. Accepts a Locator. */
87
+ @send
88
+ external toContainElement: (t, VitestExtras__BrowserLocator.t) => promise<unit> = "toContainElement"
89
+
90
+ /** Asserts that the element contains the given HTML string in its `innerHTML`. */
91
+ @send
92
+ external toContainHTML: (t, string) => promise<unit> = "toContainHTML"
93
+
94
+ /** Asserts that the element has the expected accessible name. */
95
+ @send
96
+ external toHaveAccessibleName: (
97
+ t,
98
+ ~name: VitestExtras__BrowserLocator.stringOrRegExp=?,
99
+ ) => promise<unit> = "toHaveAccessibleName"
100
+
101
+ /** Asserts that the element has the expected accessible description. */
102
+ @send
103
+ external toHaveAccessibleDescription: (
104
+ t,
105
+ ~description: VitestExtras__BrowserLocator.stringOrRegExp=?,
106
+ ) => promise<unit> = "toHaveAccessibleDescription"
107
+
108
+ /** Asserts that the element has the expected accessible error message. */
109
+ @send
110
+ external toHaveAccessibleErrorMessage: (
111
+ t,
112
+ ~message: VitestExtras__BrowserLocator.stringOrRegExp=?,
113
+ ) => promise<unit> = "toHaveAccessibleErrorMessage"
114
+
115
+ // =============================================================================
116
+ // Attribute Matchers
117
+ // =============================================================================
118
+
119
+ /** Asserts that the element has the given attribute, optionally with the expected value. */
120
+ @send
121
+ external toHaveAttribute: (t, string, ~value: string=?) => promise<unit> = "toHaveAttribute"
122
+
123
+ /** Asserts that the element has the given CSS class name. */
124
+ @send
125
+ external toHaveClass: (t, string) => promise<unit> = "toHaveClass"
126
+
127
+ /** Asserts that the element has the given CSS styles applied. Accepts a CSS string. */
128
+ @send
129
+ external toHaveStyle: (t, string) => promise<unit> = "toHaveStyle"
130
+
131
+ /** Asserts that the element has the given ARIA role. */
132
+ @send
133
+ external toHaveRole: (t, VitestExtras__BrowserLocator.ariaRole) => promise<unit> = "toHaveRole"
134
+
135
+ // =============================================================================
136
+ // Form Matchers
137
+ // =============================================================================
138
+
139
+ /** Asserts that the form element has the expected value. The value type is intentionally
140
+ polymorphic to support `string`, `int`, `null`, or `array<string>`. */
141
+ @send
142
+ external toHaveValue: (t, 'a) => promise<unit> = "toHaveValue"
143
+
144
+ /** Asserts that the form element displays the expected value. The value type is intentionally
145
+ polymorphic to support `string`, `int`, `RegExp`, or `array<string | RegExp | int>`. */
146
+ @send
147
+ external toHaveDisplayValue: (t, 'a) => promise<unit> = "toHaveDisplayValue"
148
+
149
+ /** Asserts that the form has the expected field values. Accepts an open object. */
150
+ @send
151
+ external toHaveFormValues: (t, {..}) => promise<unit> = "toHaveFormValues"
152
+
153
+ /** Asserts that the element currently has focus. */
154
+ @send
155
+ external toHaveFocus: t => promise<unit> = "toHaveFocus"
156
+
157
+ /** Asserts that the element has the expected text selection. */
158
+ @send
159
+ external toHaveSelection: (t, ~selection: string=?) => promise<unit> = "toHaveSelection"