@globalpayments/vega-testing-library

中文文档
1.3.4发布于 2026/05/28UNLICENSEDTypeScriptCommonJS近 30 天下载 3760

A lightweight testing utility that extends @testing-library/user-event to seamlessly simulate user interactions with Vega Web Components.

原始使用文档
文档目录11 节
  1. Installation
  2. What is userEvent api
  3. Why we need to extending user event api
  4. When should use this library
  5. Usage
  6. waitForVega — choosing the right import
  7. mockResizeObserver
  8. Jest fake timers compatibility
  9. V14
  10. V13
  11. Supported Components

vega-testing-library

Installation

npm install @globalpayments/vega-testing-library

What is userEvent api

user-event is a companion library for Testing Library that simulates user interactions by dispatching the events that would happen if the interaction took place in a browser

Why we need to extending user event api

Currently, when using the test library for interactive operations, it becomes very troublesome and cumbersome to find triggerable elements because Shadow DOM is used

const shadowInput: Element = document
.querySelector("vega-input")
?.shadowRoot?.querySelector("input") as Element;

userEvent.type(shadowInput, "input text");

When should use this library

Components that involve user interaction should all use this library to simplify operations and make user events simple and efficient.

Usage

waitForVega — choosing the right import

There are two waitForVega functions in the Vega ecosystem. Use the correct one for your context:

ContextImport fromNotes
Production / application code@globalpayments/vegaWaits for all Vega web components on the page to hydrate. No delay, no test-framework coupling.
Test code@globalpayments/vega-testing-librarySuperset of the above: also waits an optional post-hydration delay and supports Jest fake timers automatically.
// ✅ In tests — use the testing-library version
import { waitForVega } from '@globalpayments/vega-testing-library';

it('renders the button label', async () => {
  render(<MyComponent />);
  await waitForVega(); // supports jest.useFakeTimers(), optional delay param (default 300 ms)
  // Optional: pass a custom delay when a test needs additional render settling time
  // await waitForVega(500);
  expect(screen.getByText('Submit')).toBeInTheDocument();
});
// ✅ In application / production code — use the core version
import { waitForVega } from '@globalpayments/vega';

async function initPage() {
    await waitForVega(); // waits for hydration only
}

waitForVegaReady from @globalpayments/vega-angular, @globalpayments/vega-react, and @globalpayments/vega-vue is deprecated. Migrate to waitForVega from @globalpayments/vega-testing-library:

// Before (deprecated)
import { waitForVegaReady } from '@globalpayments/vega-angular/testing';
const result = await waitForVegaReady(renderResult);

// After
import { waitForVega } from '@globalpayments/vega-testing-library';
await waitForVega();

mockResizeObserver

Replaces the global ResizeObserver with a controllable mock for deterministic resize-event testing. Previously available individually in each framework wrapper library, it is now consolidated here.

import { mockResizeObserver, MockedResizeObserverController } from '@globalpayments/vega-testing-library';

let resizeController: MockedResizeObserverController;

beforeEach(() => {
    resizeController = mockResizeObserver();
});

it('hides element when height is 0', () => {
    resizeController.hide('.my-element');
    expect(screen.queryByText('Content')).not.toBeVisible();
});

mockResizeObserver from @globalpayments/vega-angular, @globalpayments/vega-react, and @globalpayments/vega-vue is deprecated. Migrate to the version from @globalpayments/vega-testing-library.

Jest fake timers compatibility

vega-testing-library auto-advances Jest timers inside all internal render waits, including inside waitForVega. Test suites using jest.useFakeTimers() can use all userForVega APIs and waitForVega without manually calling jest.advanceTimersByTime(...).

If your test also has its own debounced logic, you can still explicitly advance timers in your assertion flow as needed.

V14

npm i @testing-library/user-event -D
npm i @globalpayments/vega-testing-library -D
import userEvent, { UserEvent } from '@testing-library/user-event'; // v14
import { createUserEventForVega, CompatibleUserEventMethods, UserEventCompatible } from '@globalpayments/vega-testing-library';
let user: UserEvent = userEvent.setup();
const userForVega: CompatibleUserEventMethods<UserEventCompatible> = createUserEventForVega(user);
// Example using vega-input
const vegaInputElement = document.querySelector('vega-input');
await userForVega.type(vegaInputElement, 'input text');
expect(vegaInputElement.value).toBe('input text');
....

V13

npm i @testing-library/[email protected] -D
npm i @globalpayments/vega-testing-library -D
import userEvent from '@testing-library/user-event'; // v13
import { createUserEventForVega, CompatibleUserEventMethods, UserEventType13 } from '@globalpayments/vega-testing-library';
const userForVega: CompatibleUserEventMethods<UserEventType13<typeof userEvent>> = createUserEventForVega(userEvent);
// Example using vega-input
const vegaInputElement = document.querySelector('vega-input');
userEvent.type(vegaInputElement, 'input text');
expect(vegaInputElement.value).toBe('input text');
....

Supported Components

Component NameUser Event API supported
vega-accordionclick: simulates a user clicking on the accordion
Usage example:
V14
await userForVega.click(vegaAccordion); // will click to toggle expand
V13
userForVega.click(vegaAccordion); // will click to toggle expand

hover: simulates a user hovering the pointer over the accordion
Usage example:
V14
await userForVega.hover(vegaAccordion); // will hover toggle button
V13
userForVega.hover(vegaAccordion); // will hover toggle button

unhover: simulates a user moving the pointer away from the accordion
Usage example:
V14
await userForVega.unhover(vegaAccordion); // will unhover toggle button
V13
userForVega.unhover(vegaAccordion); // will unhover toggle button
vega-breadcrumbclick: simulates a user clicking on the breadcrumb
Usage example:
V14
await userForVega.click(vegaBreadcrumb, { index: 0 }); // will click breadcrumb item by index
await userForVega.click(vegaBreadcrumb, { label: 'level2' }); // will click item by label (visible or in dropdown)
V13
userForVega.click(vegaBreadcrumb, undefined, { index: 0 }); // will click breadcrumb item by index
userForVega.click(vegaBreadcrumb, undefined, { label: 'level2' }); // will click item by label (visible or in dropdown)

hover: simulates a user hovering the pointer over the breadcrumb
Usage example:
V14
await userForVega.hover(vegaBreadcrumb, { index: 0 }); // will hover breadcrumb item by index
await userForVega.hover(vegaBreadcrumb, { label: 'level2' }); // will hover item by label (visible or in dropdown)
V13
userForVega.hover(vegaBreadcrumb, undefined, { index: 0 }); // will hover breadcrumb item by index
userForVega.hover(vegaBreadcrumb, undefined, { label: 'level2' }); // will hover item by label (visible or in dropdown)

unhover: simulates a user moving the pointer away from the breadcrumb
Usage example:
V14
await userForVega.unhover(vegaBreadcrumb, { index: 0 }); // will unhover breadcrumb item by index
await userForVega.unhover(vegaBreadcrumb, { label: 'level2' }); // will unhover item by label (visible or in dropdown)
V13
userForVega.unhover(vegaBreadcrumb, undefined, { index: 0 }); // will unhover breadcrumb item by index
userForVega.unhover(vegaBreadcrumb, undefined, { label: 'level2' }); // will unhover item by label (visible or in dropdown)
vega-buttonclick: simulates a user clicking on the button
Usage example:
V14
await userForVega.click(vegaButton); // will click button
V13
userForVega.click(vegaButton); // will click button

hover: simulates a user hovering the pointer over the button
Usage example:
V14
await userForVega.hover(vegaButton); // will hover button
V13
userForVega.hover(vegaButton); // will hover button

unhover: simulates a user moving the pointer away from the button
Usage example:
V14
await userForVega.unhover(vegaButton); // will unhover button
V13
userForVega.unhover(vegaButton); // will unhover button
vega-button-circleclick: simulates a user clicking on the button circle
Usage example:
V14
await userForVega.click(vegaButtonCircle); // will click button circle
V13
userForVega.click(vegaButtonCircle); // will click button circle

hover: simulates a user hovering the pointer over the button circle
Usage example:
V14
await userForVega.hover(vegaButtonCircle); // will hover button circle
V13
userForVega.hover(vegaButtonCircle); // will hover button circle

unhover: simulates a user moving the pointer away from the button circle
Usage example:
V14
await userForVega.unhover(vegaButtonCircle); // will unhover button circle
V13
userForVega.unhover(vegaButtonCircle); // will unhover button circle
vega-button-linkclick: simulates a user clicking on the button link
Usage example:
V14
await userForVega.click(vegaButtonLink); // will click button link
V13
userForVega.click(vegaButtonLink); // will click button link

hover: simulates a user hovering the pointer over the button link
Usage example:
V14
await userForVega.hover(vegaButtonLink); // will hover button link
V13
userForVega.hover(vegaButtonLink); // will hover button link

unhover: simulates a user moving the pointer away from the button link
Usage example:
V14
await userForVega.unhover(vegaButtonLink); // will unhover button link
V13
userForVega.unhover(vegaButtonLink); // will unhover button link
vega-carouselclick: simulates a user clicking on the carousel
Usage example:
V14
await userForVega.click(vegaCarousel); // Click page 1
await userForVega.click(vegaCarousel, { page: 2 }); // Click page 2
V13
userForVega.click(vegaCarousel); // Click page 1
userForVega.click(vegaCarousel, undefined, { page: 2 }); // Click page 2

hover: simulates a user hovering the pointer over the carousel
Usage example:
V14
await userForVega.hover(vegaCarousel); // Hover on carousel
V13
userForVega.hover(vegaCarousel); // Hover on carousel

unhover: simulates a user moving the pointer away from the carousel
Usage example:
V14
await userForVega.unhover(vegaCarousel); // Unhover on carousel
V13
userForVega.unhover(vegaCarousel); // Unhover on carousel
vega-checkboxclick: simulates a user clicking on the checkbox
Usage example:
V14
await userForVega.click(vegaCheckbox); // will click checkbox
V13
userForVega.click(vegaCheckbox); // will click checkbox

hover: simulates a user hovering the pointer over the checkbox
Usage example:
V14
await userForVega.hover(vegaCheckbox); // will hover checkbox
V13
userForVega.hover(vegaCheckbox); // will hover checkbox

unhover: simulates a user moving the pointer away from the checkbox
Usage example:
V14
await userForVega.unhover(vegaCheckbox); // will unhover checkbox
V13
userForVega.unhover(vegaCheckbox); // will unhover checkbox
vega-chipclick: simulates a user clicking on the chip
Usage example:
V14
await userForVega.click(vegaChip, { iconClose: true }); // will click close icon
await userForVega.click(vegaChip); // will click vega-chip button
V13
userForVega.click(vegaChip, { iconClose: true }); // will click close icon
userForVega.click(vegaChip); // will click vega-chip button

hover: simulates a user hovering the pointer over the chip
Usage example:
V14
await userForVega.hover(vegaChip); // will hover chip
V13
userForVega.hover(vegaChip); // will hover chip

unhover: simulates a user moving the pointer away from the chip
Usage example:
V14
await userForVega.unhover(vegaChip); // will unhover chip
V13
userForVega.unhover(vegaChip); // will unhover chip
vega-color-pickerclick: simulates a user clicking on the color picker
Usage example:
V14
await userForVega.click(vegaColorPicker, {value: '#00BBFF'}); // will selected the color
V13
userForVega.click(vegaColorPicker, undefined, {value: '#00BBFF'}); // will selected the color
vega-combo-boxclear: simulates a user clearing the value of the combo box
Usage example:
V14
await userForVega.clear(vegaComboBox, 'key', {keyOrLabel: 'key'}); // will clear chip by key
await userForVega.clear(vegaComboBox, 'label', {keyOrLabel: 'label'}); // will clear chip by label
await userForVega.clear(vegaComboBox, ['label', ...], {keyOrLabel: 'label'}); // will clear multiple chips by label
await userForVega.clear(vegaComboBox, ['key', ...], {keyOrLabel: 'key'}); // will clear multiple chips by key
V13
userForVega.clear(vegaComboBox, 'key', {keyOrLabel: 'key'}); // will clear chip by key
userForVega.clear(vegaComboBox, 'label', {keyOrLabel: 'label'}); // will clear chip by label
userForVega.clear(vegaComboBox, ['label', ...], {keyOrLabel: 'label'}); // will clear multiple chips by label
userForVega.clear(vegaComboBox, ['key', ...], {keyOrLabel: 'key'}); // will clear multiple chips by key

click: simulates a user clicking on the combo box
Usage example:
V14
await userForVega.click(vegaComboBox, {triggerDynamicAdd: true}); // will trigger the "Add" button in the dropdown
V13
userForVega.click(vegaComboBox, undefined, {triggerDynamicAdd: true}); // will trigger the "Add" button in the dropdown

deselectOptions: simulates a user deselecting options from a multi-select
Usage example:
V14
await userForVega.deselectOptions(vegaComboBox, ['key', ...], {keyOrLabel: 'key'}); // will deselect the options according to key
await userForVega.deselectOptions(vegaComboBox, ['label', ...], {keyOrLabel: 'label'}); // will deselect the options according to label
V13
userForVega.deselectOptions(vegaComboBox, ['key', ...], {keyOrLabel: 'key'}); // will deselect the options according to key
userForVega.deselectOptions(vegaComboBox, ['label', ...], {keyOrLabel: 'label'}); // will deselect the options according to label

selectOptions: simulates a user selecting options from a select
Usage example:
V14
await userForVega.selectOptions(vegaComboBox, 'label', {keyOrLabel: 'label'}); // will select the option according to label
await userForVega.selectOptions(vegaComboBox, 'key', {keyOrLabel: 'key'}); // will select the option according to key
await userForVega.selectOptions(vegaComboBox, ['label', ...], {keyOrLabel: 'label'}); // will select the options according to label
await userForVega.selectOptions(vegaComboBox, ['key', ...], {keyOrLabel: 'key'}); // will select the options according to key
V13
userForVega.selectOptions(vegaComboBox, 'label', {keyOrLabel: 'label'}); // will select the option according to label
userForVega.selectOptions(vegaComboBox, 'key', {keyOrLabel: 'key'}); // will select the option according to key
userForVega.selectOptions(vegaComboBox, ['label', ...], {keyOrLabel: 'label'}); // will select the options according to label
userForVega.selectOptions(vegaComboBox, ['key', ...], {keyOrLabel: 'key'}); // will select the options according to key

type: simulates a user typing text into the combo box
Usage example:
V14
await userForVega.type(vegaComboBox, 'Peaches'); // will type 'Peaches' in the input box
V13
userForVega.type(vegaComboBox, 'Peaches'); // will type 'Peaches' in the input box
vega-date-pickerclear: simulates a user clearing the value of the date picker
Usage example:
V14
await userForVega.clear(vegaDatePicker); //For both single & range mode
V13
userForVega.clear(vegaDatePicker); //For both single & range mode

click: simulates a user clicking on the date picker
Usage example:
V14
await userForVega.click(vegaDatePicker); //Click start input
await userForVega.click(vegaDatePicker, {startOrEnd: 'start'}); //Click start input
await userForVega.click(vegaDatePicker, {startOrEnd: 'end'}); //Click end input
V13
userForVega.click(vegaDatePicker); //Click start input
userForVega.click(vegaDatePicker, undefined, {startOrEnd: 'start'}); //Click start input
userForVega.click(vegaDatePicker, undefined, {startOrEnd: 'end'}); //Click end input

type: simulates a user typing text into the date picker
Usage example:
V14
await userForVega.type(vegaDatePicker, '12/12/2000'); //Type in start input
await userForVega.type(vegaDatePicker, '12/12/2000', {startOrEnd: 'start', delay: 0}); //Type in start input
await userForVega.type(vegaDatePicker, '12/12/2000', {startOrEnd: 'end', delay: 0}); //Type in start input
V13
userForVega.type(vegaDatePicker, '12/12/2000'); //Type in start input
userForVega.type(vegaDatePicker, '12/12/2000', {startOrEnd: 'start', delay: 0}); //Type in start input
userForVega.type(vegaDatePicker, '12/12/2000', {startOrEnd: 'end', delay: 0}); //Type in start input
vega-dropdownclear: simulates a user clearing the value of the dropdown
Usage example:
V14
await userForVega.clear(vegaDropdown, 'string'); // Will open dropdown and clear search input
V13
userForVega.clear(vegaDropdown, 'string'); // Will open dropdown and clear search input

click: simulates a user clicking on the dropdown
Usage example:
V14
await userForVega.click(vegaDropdown); // will click to open
await userForVega.click(vegaDropdown, { keyOrLabel: 'key', value: 'key' }); // will click dropdown item by item key
await userForVega.click(vegaDropdown, { keyOrLabel: 'key', value: ['key1', 'key2', 'key3'] }); // will click multiple dropdown items by item key
await userForVega.click(vegaDropdown, { keyOrLabel: 'label', value: 'Label 1' }); // will click dropdown item by item label
await userForVega.click(vegaDropdown, { keyOrLabel: 'label', value: ['Label 1', 'Label 2', 'Label 3'] }); // will click multiple dropdown items by item label
await userForVega.click(vegaDropdown, { action: 'reset' }); // will click reset selection button when items are selected
await userForVega.click(vegaDropdown, { action: 'add' }); // will click add item button when searched item is not found
V13
userForVega.click(vegaDropdown); // will click to open
userForVega.click(vegaDropdown, undefined, { keyOrLabel: 'key', value: 'key' }); // will click dropdown item by item key
userForVega.click(vegaDropdown, undefined, { keyOrLabel: 'key', value: ['key1', 'key2', 'key3'] }); // will click multiple dropdown items by item key
userForVega.click(vegaDropdown, undefined, { keyOrLabel: 'label', value: 'Label 1' }); // will click dropdown item by item label
userForVega.click(vegaDropdown, undefined, { keyOrLabel: 'label', value: ['Label 1', 'Label 2', 'Label 3'] }); // will click multiple dropdown items by item label
userForVega.click(vegaDropdown, undefined, { action: 'reset' }); // will click reset selection button when items are selected
userForVega.click(vegaDropdown, undefined, { action: 'add' }); // will click add item button when searched item is not found

type: simulates a user typing text into the dropdown
Usage example:
V14
await userForVega.type(vegaDropdown, 'string'); // Will open dropdown and search by string
V13
userForVega.type(vegaDropdown, 'string'); // Will open dropdown and search by string
vega-dropdown-groupclick: simulates a user clicking on the dropdown group
Usage example:
V14
await userForVega.click(vegaDropdownGroup); // will click dropdown group first item
await userForVega.click(vegaDropdownGroup, { keyOrLabel: 'key', value: 'item1' }); // will click dropdown item by key
await userForVega.click(vegaDropdownGroup, { keyOrLabel: 'label', value: 'Item 1' }); // will click dropdown item by label
V13
userForVega.click(vegaDropdownGroup); // will click dropdown group first item
userForVega.click(vegaDropdownGroup, undefined, { keyOrLabel: 'key', value: 'item1' }); // will click dropdown item by key
userForVega.click(vegaDropdownGroup, undefined, { keyOrLabel: 'label', value: 'Item 1' }); // will click dropdown item by label
vega-dropdown-itemclick: simulates a user clicking on the dropdown item
Usage example:
V14
await userForVega.click(vegaDropdownItem); // will click dropdown item
V13
userForVega.click(vegaDropdownItem); // will click dropdown item

hover: simulates a user hovering the pointer over the dropdown item
Usage example:
V14
await userForVega.hover(vegaDropdownItem); // will hover dropdown item
V13
userForVega.hover(vegaDropdownItem); // will hover dropdown item

unhover: simulates a user moving the pointer away from the dropdown item
Usage example:
V14
await userForVega.unhover(vegaDropdownItem); // will unhover dropdown item
V13
userForVega.unhover(vegaDropdownItem); // will unhover dropdown item
vega-file-uploaderclear: simulates a user clearing the value of the file uploader
Usage example:
V14
await userForVega.clear(vegaFileUploader, {values: 'file name', indexOrName: 'name'}); // Delete file by name
await userForVega.clear(vegaFileUploader, {values: ['file name1', 'file name2', ...], indexOrName: 'name'}); // Delete files by name
await userForVega.clear(vegaFileUploader, {values: '0', indexOrName: 'index'}); // Delete file by index
await userForVega.clear(vegaFileUploader, {values: ['0', '1', ...], indexOrName: 'index'}); // Delete files by index
V13
userForVega.clear(vegaFileUploader, {values: 'file name', indexOrName: 'name'}); // Delete file by name
userForVega.clear(vegaFileUploader, {values: ['file name1', 'file name2', ...], indexOrName: 'name'}); // Delete files by name
userForVega.clear(vegaFileUploader, {values: '0', indexOrName: 'index'}); // Delete file by index
userForVega.clear(vegaFileUploader, {values: ['0', '1', ...], indexOrName: 'index'}); // Delete files by index

upload: simulates a user uploading files to the file uploader
Usage example:
V14
await userForVega.upload(vegaFileUploader, 'file name'); // will upload the single file according to file name
await userForVega.upload(vegaFileUploader, '['file name', 'file name 1', ....]); // will upload the multiple files according to file names
V13
userForVega.upload(vegaFileUploader, 'file name'); // will upload the single file according to file name
userForVega.upload(vegaFileUploader, '['file name', 'file name 1', ....]); // will upload the multiple files according to file names
vega-image-uploaderclear: simulates a user clearing the value of the image uploader
Usage example:
V14
await userForVega.clear(vegaImageUploader); //Delete uploaded image
V13
userForVega.clear(vegaImageUploader); //Delete uploaded image

click: simulates a user clicking on the image uploader
Usage example:
V14
await userForVega.click(vegaImageUploader, { action: 'replace', file: file }); //Replace image
await userForVega.click(vegaImageUploader, { action: 'delete' }); //Remove uploaded image
await userForVega.click(vegaImageUploader, { action: 'cancel' }); //Cancel upload of image
await userForVega.click(vegaImageUploader, { action: 'preview' }); //Preview uploaded image
V13
userForVega.click(vegaImageUploader, undefined, { action: 'replace', file: file }); //Replace image
userForVega.click(vegaImageUploader, undefined, { action: 'delete' }); //Remove uploaded image
userForVega.click(vegaImageUploader, undefined, { action: 'cancel' }); //Cancel upload of image
userForVega.click(vegaImageUploader, undefined, { action: 'preview' }); //Preview uploaded image

upload: simulates a user uploading files to the image uploader
Usage example:
V14
await userForVega.upload(vegaImageUploader, imageFile); //Upload image
V13
userForVega.upload(vegaImageUploader, imageFile); //Upload image
vega-inputclear: simulates a user clearing the value of the input
Usage example:
V14
await userForVega.clear(vegaInput, { iconClear: true }); // Clear input field by clicking the clear icon
await userForVega.clear(vegaInput); // Clear input field by userEvent.clear
V13
userForVega.clear(vegaInput, { iconClear: true }); // Clear input field by clicking the clear icon
userForVega.clear(vegaInput); // Clear input field by userEvent.clear

click: simulates a user clicking on the input
Usage example:
V14
await userForVega.click(vegaInput); // will click the input box
V13
userForVega.click(vegaInput); // will click the input box

type: simulates a user typing text into the input
Usage example:
V14
await userForVega.type(vegaInput, 'Hello World'); // will type 'Hello World' in the input box
V13
userForVega.type(vegaInput, 'Hello World'); // will type 'Hello World' in the input box
vega-input-credit-cardclear: simulates a user clearing the value of the credit card input
Usage example:
V14
await userForVega.clear(vegaInputCreditCard); // Clear input field by userEvent.clear
V13
userForVega.clear(vegaInputCreditCard); // Clear input field by userEvent.clear

click: simulates a user clicking on the credit card input
Usage example:
V14
await userForVega.click(vegaInputCreditCard); // Click input field by userEvent.click
V13
userForVega.click(vegaInputCreditCard); // Click input field by userEvent.click

type: simulates a user typing text into the credit card input
Usage example:
V14
await userForVega.type(vegaInputCreditCard, '1234'); // Type into input field by userEvent.type
V13
userForVega.type(vegaInputCreditCard, '1234'); // Type into input field by userEvent.type
vega-input-numericclear: simulates a user clearing the value of the numeric input
Usage example:
V14
await userForVega.clear(vegaInputNumeric, { iconClear: true }); // Clear input field by clicking the clear icon
await userForVega.clear(vegaInputNumeric); // Clear input field by userEvent.clear
V13
userForVega.clear(vegaInputNumeric, { iconClear: true }); // Clear input field by clicking the clear icon
userForVega.clear(vegaInputNumeric); // Clear input field by userEvent.clear

click: simulates a user clicking on the numeric input
Usage example:
V14
await userForVega.click(vegaInputNumeric); // will click the input box
V13
userForVega.click(vegaInputNumeric); // will click the input box

type: simulates a user typing text into the numeric input
Usage example:
V14
await userForVega.type(vegaInputNumeric, '12345'); // will type '12345' in the input box
V13
userForVega.type(vegaInputNumeric, '12345'); // will type '12345' in the input box
vega-input-phone-numberclear: simulates a user clearing the value of the phone number input
Usage example:
V14
await userForVega.clear(vegaInputPhoneNumber); // Clear input field with userEvent clear method
await userForVega.clear(vegaInputPhoneNumber, { source: 'input' }); // Clear input field with userEvent clear method
await userForVega.clear(vegaInputPhoneNumber, { source: 'dropDown' }); // Clear drop down input field with userEvent clear method
await userForVega.clear(vegaInputPhoneNumber, { iconClear: true }); // Clear input field with clear icon button
await userForVega.clear(vegaInputPhoneNumber, { source: 'dropDown', iconClear: true }); // Clear drop down input field with clear icon button
V13
userForVega.clear(vegaInputPhoneNumber); // Clear input field with userEvent clear method
userForVega.clear(vegaInputPhoneNumber, { source: 'input' }); // Clear input field with userEvent clear method
userForVega.clear(vegaInputPhoneNumber, { source: 'dropDown' }); // Clear drop down input field with userEvent clear method
userForVega.clear(vegaInputPhoneNumber, { iconClear: true }); // Clear input field with clear icon button
userForVega.clear(vegaInputPhoneNumber, { source: 'dropDown', iconClear: true }); // Clear drop down input field with clear icon button

selectOptions: simulates a user selecting options from a select
Usage example:
V14
await userForVega.selectOptions(vegaInputPhoneNumber, 'key', {keyOrLabel: 'key'}); // Select option by key using userEvent.click
await userForVega.selectOptions(vegaInputPhoneNumber, 'label', {keyOrLabel: 'label'}); // Select option by label using userEvent.click
V13
userForVega.selectOptions(vegaInputPhoneNumber, 'key', {keyOrLabel: 'key'}); // Select option by key using userEvent.click
userForVega.selectOptions(vegaInputPhoneNumber, 'label', {keyOrLabel: 'label'}); // Select option by label using userEvent.click

type: simulates a user typing text into the phone number input
Usage example:
V14
await userForVega.type(vegaInputPhoneNumber, '123', {source: 'input'}); // Type into input field or dropdown input field using userEvent.type
V13
userForVega.type(vegaInputPhoneNumber, '123', {source: 'input', delay: 0}); // Type into input field or dropdown input field using userEvent.type
vega-input-rangeclear: simulates a user clearing the value of the range input
Usage example:
V14
await userForVega.clear(vegaInputRange); // Clear minimum input field using userEvent.clear (keyboard action)
await userForVega.clear(vegaInputRange, {minOrMax: 'min'}); // Clear minimum input field using userEvent.clear (keyboard action)
await userForVega.clear(vegaInputRange, {minOrMax: 'max'}); // Clear maximum input field using userEvent.clear (keyboard action)
await userForVega.clear(vegaInputRange, {iconClear: true}); // Clear both fields (min and max) using the clear icon
V13
userForVega.clear(vegaInputRange); // Clear minimum input field using userEvent.clear (keyboard action)
userForVega.clear(vegaInputRange, {minOrMax: 'min'}); // Clear minimum input field using userEvent.clear (keyboard action)
userForVega.clear(vegaInputRange, {minOrMax: 'max'}); // Clear maximum input field using userEvent.clear (keyboard action)
userForVega.clear(vegaInputRange, {iconClear: true}); // Clear both fields (min and max) using the clear icon

click: simulates a user clicking on the range input
Usage example:
V14
await userForVega.click(vegaInputRange, {minOrMax: 'min'}); // will click the minimum input box
await userForVega.click(vegaInputRange, {minOrMax: 'max'}); // will click the maximum input box
V13
userForVega.click(vegaInputRange, undefined, {minOrMax: 'max'}); // will click the maximum input box

type: simulates a user typing text into the range input
Usage example:
V14
await userForVega.type(vegaInputRange, '10', {minOrMax: 'min'}); // will type '10' in the minimum input box
await userForVega.type(vegaInputRange, '10', {minOrMax: 'max'}); // will type '10' in the maximum input box
V13
userForVega.type(vegaInputRange, '10', {minOrMax: 'min', delay: 0}); // will type '10' in the minimum input box
userForVega.type(vegaInputRange, '10', {minOrMax: 'max', delay: 0}); // will type '10' in the maximum input box
vega-input-selectdeselectOptions: simulates a user deselecting options from a multi-select
Usage example:
V14
await userForVega.deselectOptions(vegaInputSelect, ['key', 'key1', ...], {keyOrLabel: 'key'}); // will deselect the option with specified key
await userForVega.deselectOptions(vegaInputSelect, ['label', 'label1', ...], {keyOrLabel: 'label'}); // will deselect the option with specified label
V13
userForVega.deselectOptions(vegaInputSelect, ['key', 'key1', ...], {keyOrLabel: 'key'}); // will deselect the option with specified key
userForVega.deselectOptions(vegaInputSelect, ['label', 'label1', ...], {keyOrLabel: 'label'}); // will deselect the option with specified label

selectOptions: simulates a user selecting options from a select
Usage example:
V14
await userForVega.selectOptions(vegaInputSelect, 'key', {keyOrLabel: 'key'}); // will select the option with specified key
await userForVega.selectOptions(vegaInputSelect, ['label', 'label1', ...], {keyOrLabel: 'label'}); // will select the option with specified label
V13
userForVega.selectOptions(vegaInputSelect, 'label', {keyOrLabel: 'label'}); // will select the option with specified label
userForVega.selectOptions(vegaInputSelect, ['key', 'key1', ...], {keyOrLabel: 'key'}); // will select the options with specified keys

type: simulates a user typing text into the select input
Usage example:
V14
await userForVega.type(vegaInputSelect, 'Peaches'); // will type 'text' in the input box and filter options by label
V13
userForVega.type(vegaInputSelect, 'Peaches'); // will type 'text' in the input box and filter options by label
vega-item-toggleclick: simulates a user clicking on the item toggle
Usage example:
V14
await userForVega.click(vegaItemToggle); // will click item toggle
await waitFor(() => { expect(vegaItemToggle.isToggled).toBe(true); }, { timeout: 1550 }); // wait for the toggle animation to finish
V13
userForVega.click(vegaItemToggle); // will click item toggle
await waitFor(() => { expect(vegaItemToggle.isToggled).toBe(true); }, { timeout: 1550 }); // wait for the toggle animation to finish
vega-left-nav-groupclick: simulates a user clicking on the left nav group
Usage example:
V14
await userForVega.click(vegaLeftNavGroup); //Click left nav group
V13
userForVega.click(vegaLeftNavGroup); //Click left nav group

hover: simulates a user hovering the pointer over the left nav group
Usage example:
V14
await userForVega.hover(vegaLeftNavGroup); //hover left nav group
V13
userForVega.hover(vegaLeftNavGroup); //hover left nav group

unhover: simulates a user moving the pointer away from the left nav group
Usage example:
V14
await userForVega.unhover(vegaLeftNavGroup); //unhover left nav group
V13
userForVega.unhover(vegaLeftNavGroup); //unhover left nav group
vega-left-nav-linkclick: simulates a user clicking on the left nav link
Usage example:
V14
await userForVega.click(vegaLeftNavLink); //Click left nav link
V13
userForVega.click(vegaLeftNavLink); //Click left nav link

hover: simulates a user hovering the pointer over the left nav link
Usage example:
V14
await userForVega.hover(vegaLeftNavLink); //hover left nav link
V13
userForVega.hover(vegaLeftNavLink); //hover left nav link

unhover: simulates a user moving the pointer away from the left nav link
Usage example:
V14
await userForVega.unhover(vegaLeftNavLink); //unhover left nav link
V13
userForVega.unhover(vegaLeftNavLink); //unhover left nav link
vega-left-nav-sectionclick: simulates a user clicking on the left nav section
Usage example:
V14
await userForVega.click(vegaLeftNavSection); //Click left nav section action button link if action title is set
V13
userForVega.click(vegaLeftNavSection); //Click left nav section action button link if action title is set

hover: simulates a user hovering the pointer over the left nav section
Usage example:
V14
await userForVega.hover(vegaLeftNavSection); //hover left nav section action button link if action title is set
V13
userForVega.hover(vegaLeftNavSection); //hover left nav section action button link if action title is set

unhover: simulates a user moving the pointer away from the left nav section
Usage example:
V14
await userForVega.unhover(vegaLeftNavSection); //unhover left nav section
V13
userForVega.unhover(vegaLeftNavSection); //unhover left nav section
vega-modalclick: simulates a user clicking on the modal
Usage example:
V14
await userForVega.click(vegaModal); // will simulate click to open modal
await userForVega.click(vegaModal, { action: 'open' }); // will open modal
await userForVega.click(vegaModal, { action: 'close' }); // will close modal
await userForVega.click(vegaModal, { target: 'closeIcon' }); // On open modal, click close icon
V13
userForVega.click(vegaModal); // will simulate click to open modal
userForVega.click(vegaModal, undefined, { action: 'open' }); // will open modal
userForVega.click(vegaModal, undefined, { action: 'close' }); // will close modal
userForVega.click(vegaModal, { target: 'closeIcon' }); // On open modal, click close icon
vega-nav-cardclick: simulates a user clicking on the nav card
Usage example:
V14
await userForVega.click(vegaNavCard); //Click first vega-left-nav-link by default
await userForVega.click(vegaNavCard, { prop: 'key', propValue: 'settings' }); //Click nav item by key:'settings'
await userForVega.click(vegaNavCard, { prop: 'url', propValue: '#settings' }); //Click nav item by url
await userForVega.click(vegaNavCard, { prop: 'label', propValue: 'SETTINGS' }); //Click nav item by label text
await userForVega.click(vegaNavCard, { prop: 'label', propValue: 'Profile', targetType: 'group' }); //Click label for for group element
V13
userForVega.click(vegaNavCard); //Click first vega-left-nav-link by default
userForVega.click(vegaNavCard, undefined, { prop: 'key', propValue: 'settings' }); //Click nav item by key:'settings'
userForVega.click(vegaNavCard, undefined, { prop: 'url', propValue: '#settings' }); //Click nav item by url
userForVega.click(vegaNavCard, undefined, { prop: 'label', propValue: 'SETTINGS' }); //Click nav item by label text
userForVega.click(vegaNavCard, undefined, { prop: 'label', propValue: 'Profile', targetType: 'group' }); //Click label for for group element
vega-paginationclick: simulates a user clicking on the pagination
Usage example:
V14
await userForVega.click(vegaPagination, { next: true }); // go to next page
await userForVega.click(vegaPagination, { prev: true }); // go to previous page
await userForVega.click(vegaPagination, { page: 5 }); // go to specific page
V13
userForVega.click(vegaPagination, undefined, { next: true }); // go to next page
userForVega.click(vegaPagination, undefined, { prev: true }); // go to previous page
userForVega.click(vegaPagination, undefined, { page: 5 }); // go to specific page

selectOptions: simulates a user selecting options from a select
Usage example:
V14
await waitFor(() => { expect(vegaPagination.shadowRoot.querySelector('vega-input-select').classList.contains('hydrated')).toBe(true); }); // wait for the inner input-select to be rendered.
await userForVega.selectOptions(vegaPagination, '20'); // change page size to 20
V13
await waitFor(() => { expect(vegaPagination.shadowRoot.querySelector('vega-input-select').classList.contains('hydrated')).toBe(true); }); // wait for the inner input-select to be rendered.
userForVega.selectOptions(vegaPagination, '20'); // change page size to 20

type: simulates a user typing text into the pagination
Usage example:
V14
await waitFor(() => { expect(vegaPagination.shadowRoot.querySelector('vega-input[data-vega-form="paginationGoTo"]').classList.contains('hydrated')).toBe(true); }); // wait for the inner vega-input to be rendered.
await userForVega.type(vegaPagination, '5'); // type target page number and goTo that page
V13
await waitFor(() => { expect(vegaPagination.shadowRoot.querySelector('vega-input[data-vega-form="paginationGoTo"]').classList.contains('hydrated')).toBe(true); }); // wait for the inner vega-input to be rendered.
userForVega.type(vegaPagination, '5'); // type target page number and goTo that page
vega-popoverclick: simulates a user clicking on the popover
Usage example:
V14
await userForVega.click(vegaPopover); // will click popover-content slot to open or close the popover
V13
userForVega.click(vegaPopover); // will click popover-content slot to open or close the popover

hover: simulates a user hovering the pointer over the popover
Usage example:
V14
await userForVega.hover(vegaPopover); // will hover popover-content slot to open or close the popover
V13
userForVega.hover(vegaPopover); // will hover popover-content slot to open or close the popover

unhover: simulates a user moving the pointer away from the popover
Usage example:
V14
await userForVega.unhover(vegaPopover); // will unhover popover-content slot to open or close the popover
await waitFor(() => { expect(vegaPopoverContent).toHaveClass('vega-force-hidden');}); // wait for the popover to be hidden
V13
userForVega.unhover(vegaPopover); // will unhover popover-content slot to open or close the popover
await waitFor(() => { expect(vegaPopoverContent).toHaveClass('vega-force-hidden');}); // wait for the popover to be hidden
vega-radioclick: simulates a user clicking on the radio
Usage example:
V14
await userForVega.click(vegaRadio); // will click radio
V13
userForVega.click(vegaRadio); // will click radio

hover: simulates a user hovering the pointer over the radio
Usage example:
V14
await userForVega.hover(vegaRadio); // will hover radio
V13
userForVega.hover(vegaRadio); // will hover radio

unhover: simulates a user moving the pointer away from the radio
Usage example:
V14
await userForVega.unhover(vegaRadio); // will unhover radio
V13
userForVega.unhover(vegaRadio); // will unhover radio
vega-segment-controlclick: simulates a user clicking on the segment control
Usage example:
V14
await userForVega.click(vegaSegmentControl, {value: 'Right', textOrIndexOrKey: 'text'}); // will click the right button
await userForVega.click(vegaSegmentControl, {value: 'Center', textOrIndexOrKey: 'text'}); // will click the center button
await userForVega.click(vegaSegmentControl, {value: 'left', textOrIndexOrKey: 'text'}); // will click the left button
await userForVega.click(vegaSegmentControl, {value: '1', textOrIndexOrKey: 'index'}); // will click the first button by index
await userForVega.click(vegaSegmentControl, {value: 'right', textOrIndexOrKey: 'key'}); // will click the button with key 'right'
await userForVega.click(vegaSegmentControl, {value: 'center', textOrIndexOrKey: 'key'}); // will click the button with key 'center'
await userForVega.click(vegaSegmentControl, {value: 'left', textOrIndexOrKey: 'key'}); // will click the button with key 'left'
V13
userForVega.click(vegaSegmentControl, undefined, {value: 'Right', textOrIndexOrKey: 'text'}); // will click the right button
userForVega.click(vegaSegmentControl, undefined, {value: 'Center', textOrIndexOrKey: 'text'}); // will click the center button
userForVega.click(vegaSegmentControl, undefined, {value: 'left', textOrIndexOrKey: 'text'}); // will click the left button
userForVega.click(vegaSegmentControl, undefined, {value: '1', textOrIndexOrKey: 'index'}); // will click the first button by index
userForVega.click(vegaSegmentControl, undefined, {value: 'right', textOrIndexOrKey: 'key'}); // will click the button with key 'right'
userForVega.click(vegaSegmentControl, undefined, {value: 'center', textOrIndexOrKey: 'key'}); // will click the button with key 'center'
userForVega.click(vegaSegmentControl, undefined, {value: 'left', textOrIndexOrKey: 'key'}); // will click the button with key 'left'
vega-selection-chipclear: simulates a user clearing the value of the selection chip
Usage example:
V14
await userForVega.clear(vegaSelectionChip); //clear selection chip
V13
userForVega.clear(vegaSelectionChip); //clear selection chip

click: simulates a user clicking on the selection chip
Usage example:
V14
await userForVega.click(vegaSelectionChip); //click selection chip
V13
userForVega.click(vegaSelectionChip); //click selection chip

hover: simulates a user hovering the pointer over the selection chip
Usage example:
V14
await userForVega.hover(vegaSelectionChip); //hover on selection chip
V13
userForVega.hover(vegaSelectionChip); //hover on selection chip

unhover: simulates a user moving the pointer away from the selection chip
Usage example:
V14
await userForVega.unhover(vegaSelectionChip); //unhover selection chip
V13
userForVega.unhover(vegaSelectionChip); //unhover selection chip
vega-selection-chip-groupclear: simulates a user clearing the value of the selection chip group
Usage example:
V14
await userForVega.clear(vegaSelectionChipGroup); //clear group selection
V13
userForVega.clear(vegaSelectionChipGroup); //clear group selection

click: simulates a user clicking on the selection chip group
Usage example:
V14
await userForVega.click(vegaSelectionChipGroup, {label: 'Label for ABC'}); //Select by label
await userForVega.click(vegaSelectionChipGroup, {label: ['Label for ABC', 'Label for DEF']}); //Multi select
await userForVega.click(vegaSelectionChipGroup, {value: 'ABC'}); //Select by value
await userForVega.click(vegaSelectionChipGroup, {value: ['ABC', 'DEF']}); //Multi select
V13
userForVega.click(vegaSelectionChipGroup, undefined, {label: 'Label for ABC'}); //Select by label
userForVega.click(vegaSelectionChipGroup, undefined, {label: ['Label for ABC', 'Label for DEF']}); //Multi select
userForVega.click(vegaSelectionChipGroup, undefined, {value: 'ABC'}); //Select by value
userForVega.click(vegaSelectionChipGroup, undefined, {value: ['ABC', 'DEF']}); //Multi select
vega-selection-tileclear: simulates a user clearing the value of the selection tile
Usage example:
V14
await userForVega.clear(vegaSelectionTile); //Clear selection
V13
userForVega.clear(vegaSelectionTile); //Clear selection

click: simulates a user clicking on the selection tile
Usage example:
V14
await userForVega.click(vegaSelectionTile); //Click selection tile
V13
userForVega.click(vegaSelectionTile); //Click selection tile

hover: simulates a user hovering the pointer over the selection tile
Usage example:
V14
await userForVega.hover(vegaSelectionTile); //Hover on selection tile
V13
userForVega.hover(vegaSelectionTile); //Hover on selection tile

unhover: simulates a user moving the pointer away from the selection tile
Usage example:
V14
await userForVega.unhover(vegaSelectionTile); //Unhover on selection tile
V13
userForVega.unhover(vegaSelectionTile); //Unhover on selection tile
vega-selection-tile-groupclear: simulates a user clearing the value of the selection tile group
Usage example:
V14
await userForVega.clear(vegaSelectionTileGroup); // Clear selected values
V13
userForVega.clear(vegaSelectionTileGroup); // Clear selected values

click: simulates a user clicking on the selection tile group
Usage example:
V14
await userForVega.click(vegaSelectionTileGroup, {value: 'ABC'}); //Select by value
await userForVega.click(vegaSelectionTileGroup, {value: ['ABC', 'DEF']}); //Select multiple options
await userForVega.click(vegaSelectionTileGroup, {title: 'Title for ABC'}); //Select by title
await userForVega.click(vegaSelectionTileGroup, {title: ['Title ABC', 'Title DEF']}); //Select multiple options
V13
userForVega.click(vegaSelectionTileGroup, undefined, {value: 'ABC'}); //Select by value
userForVega.click(vegaSelectionTileGroup, undefined, {value: ['ABC', 'DEF']}); //Select multiple options
userForVega.click(vegaSelectionTileGroup, undefined, {title: 'Title for ABC'}); //Select by title
userForVega.click(vegaSelectionTileGroup, undefined, {title: ['Title ABC', 'Title DEF']}); //Select multiple options
vega-signature-captureclear: simulates a user clearing the value of the signature capture
Usage example:
V14
await userForVega.clear(vegaSignatureCapture); // Clear the signature capture
V13
userForVega.clear(vegaSignatureCapture); // Clear the signature capture

pointer: simulates a user pointing to the signature capture
Usage example:
V14
await userForVega.pointer(vegaSignatureCapture, [{ keys: '[MouseLeft>]', coords: { x: 100, y: 200 } },{ coords: { x: 200, y: 200 } },{ keys: '[/MouseLeft]' },]); // Draw a signature
V13
userForVega.pointer(vegaSignatureCapture, [{mouseDown: { clientX: 100, clientY: 200 }, mouseMove: { clientX: 200, clientY: 200 }, mouseUp: { clientX: 200, clientY: 200 },},]); // Draw a signature
vega-stepperclear: simulates a user clearing the value of the stepper
Usage example:
V14
await userForVega.clear(vegaStepper); // will clear the stepper input and set the value to 0
V13
userForVega.clear(vegaStepper); // will clear the stepper input and set the value to 0

click: simulates a user clicking on the stepper
Usage example:
V14
await userForVega.click(vegaStepper, {actionSource: 'minus'}); // Decrease value
await userForVega.click(vegaStepper, {actionSource: 'plus'}); // Increase value
await userForVega.click(vegaStepper, {actionSource: 'input'}); // To focus on the input
V13
userForVega.click(vegaStepper, undefined, {actionSource: 'minus'}); // Decrease value
userForVega.click(vegaStepper, undefined, {actionSource: 'plus'}); // Increase value
userForVega.click(vegaStepper, undefined, {actionSource: 'input'}); // To focus on the input

type: simulates a user typing text into the stepper
Usage example:
V14
await userForVega.type(vegaStepper, '10'); // will type '10' in the stepper input
V13
userForVega.type(vegaStepper, '10'); // will type '10' in the stepper input
vega-textareaclear: simulates a user clearing the value of the textarea
Usage example:
V14
await userForVega.clear(vegaTextarea); // Delete all text
V13
userForVega.clear(vegaTextarea); // Delete all text

click: simulates a user clicking on the textarea
Usage example:
V14
await userForVega.click(vegaTextarea); // click textarea
V13
userForVega.click(vegaTextarea); // click textarea

type: simulates a user typing text into the textarea
Usage example:
V14
await userForVega.type(vegaTextarea, 'text'); // will type 'text' in the textarea box
V13
userForVega.type(vegaTextarea, 'text'); // will type '12345' in the textarea box
vega-time-pickerclear: simulates a user clearing the value of the time picker
Usage example:
V14
await userForVega.clear(vegaTimePicker); // Clear start time input
await userForVega.clear(vegaTimePicker, {startOrEnd: 'start'}); // Clear start time input
await userForVega.clear(vegaTimePicker, {startOrEnd: 'end'}); // Clear end time input
V13
userForVega.clear(vegaTimePicker); // Clear start time input
userForVega.clear(vegaTimePicker, {startOrEnd: 'start'}); // Clear start time input
userForVega.clear(vegaTimePicker, {startOrEnd: 'end'}); // Clear end time input

click: simulates a user clicking on the time picker
Usage example:
V14
await userForVega.click(vegaTimePicker); // Click start time input field
await userForVega.click(vegaTimePicker, {startOrEnd: 'start'}); // Click start time input field
await userForVega.click(vegaTimePicker, {startOrEnd: 'end'}); // Click end time input field
V13
userForVega.click(vegaTimePicker, undefined, {startOrEnd: 'start'}); // Click start time input field
userForVega.click(vegaTimePicker, undefined, {startOrEnd: 'end'}); // Click end time input field

type: simulates a user typing text into the time picker
Usage example:
V14
await userForVega.type(vegaTimePicker, '10:00'); // Type into start time input field
await userForVega.type(vegaTimePicker, '10:00', {startOrEnd: 'start'}); // Type into start time input field
await userForVega.type(vegaTimePicker, '11:15', {startOrEnd: 'end'}); // Type into end time input field
V13
userForVega.type(vegaTimePicker, '10:00', {startOrEnd: 'start', delay: 0}); // Type into start time input field
userForVega.type(vegaTimePicker, '10:00', {startOrEnd: 'end', delay: 0}); // Type into end time input field
vega-toggle-switchclick: simulates a user clicking on the toggle switch
Usage example:
V14
await userForVega.click(vegaToggleSwitch); // will click toggle switch
V13
userForVega.click(vegaToggleSwitch); // will click toggle switch

版本与发布记录

@globalpayments/vega-testing-library 共发布 2 个版本,首次发布于 2026/05/28;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.3.4latest2026/05/285 个月前
1.3.32026/05/265 个月前

关于 @globalpayments/vega-testing-library 的常见问题

@globalpayments/vega-testing-library 是什么?

A lightweight testing utility that extends @testing-library/user-event to seamlessly simulate user interactions with Vega Web Components.

如何安装 @globalpayments/vega-testing-library?

在项目目录运行 npm install @globalpayments/vega-testing-library,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@globalpayments/vega(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@globalpayments/vega-testing-library 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@globalpayments/vega-testing-library 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@globalpayments/vega-testing-library 可以商用吗?

@globalpayments/vega-testing-library 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@globalpayments/vega-testing-library 的下载量有多少?

根据 npm 官方下载统计,@globalpayments/vega-testing-library 在 2026/10/17 – 2026/11/15 这 30 天内被下载 3,760 次,日均约 125 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@globalpayments/vega-testing-library 还在维护吗?

最新版本 1.3.4 发布于 2026/05/28(5 个月前);至今共发布 2 个版本,其中过去 12 个月发布了 2 个;首次发布于 2026/05/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。