@vitest/browser 4.0.17 → 4.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/context.d.ts +89 -0
- package/dist/client/.vite/manifest.json +1 -1
- package/dist/client/__vitest__/assets/index-DHXSWiHD.js +57 -0
- package/dist/client/__vitest__/index.html +1 -1
- package/dist/client/__vitest_browser__/{tester-k74mgIRa.js → tester-cVWT4Xmu.js} +2 -2
- package/dist/client/tester/tester.html +1 -1
- package/dist/context.js +53 -0
- package/dist/expect-element.js +3 -3
- package/dist/{index-D6m36C6U.js → index-5ZLDAkrH.js} +1 -1
- package/dist/index.js +20 -15
- package/dist/locators.d.ts +2 -1
- package/dist/locators.js +1 -1
- package/package.json +8 -8
- package/dist/client/__vitest__/assets/index-BUCFJtth.js +0 -57
package/context.d.ts
CHANGED
|
@@ -207,6 +207,25 @@ export interface UserEvent {
|
|
|
207
207
|
* @see {@link https://testing-library.com/docs/user-event/convenience/#tripleclick} testing-library API
|
|
208
208
|
*/
|
|
209
209
|
tripleClick: (element: Element | Locator, options?: UserEventTripleClickOptions) => Promise<void>
|
|
210
|
+
/**
|
|
211
|
+
* Triggers a {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event|`wheel` event} on an element.
|
|
212
|
+
*
|
|
213
|
+
* @param element - The target element to receive wheel events.
|
|
214
|
+
* @param options - Scroll configuration using `delta` or `direction`.
|
|
215
|
+
* @returns A promise that resolves when all wheel events have been dispatched.
|
|
216
|
+
*
|
|
217
|
+
* @since 4.1.0
|
|
218
|
+
* @see {@link https://vitest.dev/api/browser/interactivity#userevent-wheel}
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* // Scroll down by 100 pixels
|
|
222
|
+
* await userEvent.wheel(container, { delta: { y: 100 } })
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* // Scroll up 5 times
|
|
226
|
+
* await userEvent.wheel(container, { direction: 'up', times: 5 })
|
|
227
|
+
*/
|
|
228
|
+
wheel(element: Element | Locator, options: UserEventWheelOptions): Promise<void>
|
|
210
229
|
/**
|
|
211
230
|
* Choose one or more values from a select element. Uses provider's API under the hood.
|
|
212
231
|
* If select doesn't have `multiple` attribute, only the first value will be selected.
|
|
@@ -345,6 +364,58 @@ export interface UserEventTripleClickOptions {}
|
|
|
345
364
|
export interface UserEventDragAndDropOptions {}
|
|
346
365
|
export interface UserEventUploadOptions {}
|
|
347
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Base options shared by all wheel event configurations.
|
|
369
|
+
*
|
|
370
|
+
* @since 4.1.0
|
|
371
|
+
*/
|
|
372
|
+
export interface UserEventWheelBaseOptions {
|
|
373
|
+
/**
|
|
374
|
+
* Number of wheel events to fire. Defaults to `1`.
|
|
375
|
+
*
|
|
376
|
+
* Useful for triggering multiple scroll steps in a single call.
|
|
377
|
+
*/
|
|
378
|
+
times?: number
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Wheel options using pixel-based `delta` values for precise scroll control.
|
|
383
|
+
*
|
|
384
|
+
* @since 4.1.0
|
|
385
|
+
*/
|
|
386
|
+
export interface UserEventWheelDeltaOptions extends UserEventWheelBaseOptions {
|
|
387
|
+
/**
|
|
388
|
+
* Precise scroll delta values in pixels. At least one axis must be specified.
|
|
389
|
+
*
|
|
390
|
+
* - Positive `y` scrolls down, negative `y` scrolls up.
|
|
391
|
+
* - Positive `x` scrolls right, negative `x` scrolls left.
|
|
392
|
+
*/
|
|
393
|
+
delta: { x: number; y?: number } | { x?: number; y: number }
|
|
394
|
+
direction?: undefined
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Wheel options using semantic `direction` values for simpler scroll control.
|
|
399
|
+
*
|
|
400
|
+
* @since 4.1.0
|
|
401
|
+
*/
|
|
402
|
+
export interface UserEventWheelDirectionOptions extends UserEventWheelBaseOptions {
|
|
403
|
+
/**
|
|
404
|
+
* Semantic scroll direction. Use this for readable tests when exact pixel values don't matter.
|
|
405
|
+
*/
|
|
406
|
+
direction: 'up' | 'down' | 'left' | 'right'
|
|
407
|
+
delta?: undefined
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Options for triggering wheel events.
|
|
412
|
+
*
|
|
413
|
+
* Specify scrolling using either `delta` for precise pixel values, or `direction` for semantic scrolling. These are mutually exclusive.
|
|
414
|
+
*
|
|
415
|
+
* @since 4.1.0
|
|
416
|
+
*/
|
|
417
|
+
export type UserEventWheelOptions = UserEventWheelDeltaOptions | UserEventWheelDirectionOptions
|
|
418
|
+
|
|
348
419
|
export interface LocatorOptions {
|
|
349
420
|
/**
|
|
350
421
|
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a
|
|
@@ -489,6 +560,24 @@ export interface Locator extends LocatorSelectors {
|
|
|
489
560
|
* @see {@link https://vitest.dev/api/browser/interactivity#userevent-tripleclick}
|
|
490
561
|
*/
|
|
491
562
|
tripleClick(options?: UserEventTripleClickOptions): Promise<void>
|
|
563
|
+
/**
|
|
564
|
+
* Triggers a {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event|`wheel` event} on an element.
|
|
565
|
+
*
|
|
566
|
+
* @param options - Scroll configuration using `delta` or `direction`.
|
|
567
|
+
* @returns A promise that resolves when all wheel events have been dispatched.
|
|
568
|
+
*
|
|
569
|
+
* @since 4.1.0
|
|
570
|
+
* @see {@link https://vitest.dev/api/browser/interactivity#userevent-wheel}
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* // Scroll down by 100 pixels
|
|
574
|
+
* await container.wheel({ delta: { y: 100 } })
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* // Scroll up 5 times
|
|
578
|
+
* await container.wheel({ direction: 'up', times: 5 })
|
|
579
|
+
*/
|
|
580
|
+
wheel(options: UserEventWheelOptions): Promise<void>
|
|
492
581
|
/**
|
|
493
582
|
* Clears the input element content
|
|
494
583
|
* @see {@link https://vitest.dev/api/browser/interactivity#userevent-clear}
|