@carbon/react
Version:
React components for the Carbon Design System
72 lines (71 loc) • 2.51 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import '@testing-library/jest-dom/jest-globals';
export declare const findListBoxNode: () => Element | null;
export declare const findMenuNode: () => Element | null;
export declare const findMenuItemNode: (index: number) => Element;
export declare const findMenuIconNode: () => Element | null;
export declare const findFieldNode: () => Element | null;
export declare const findComboboxNode: () => Element | null;
export declare const findPopupNode: () => Element | null;
export declare const openMenu: () => Promise<void>;
export declare const assertMenuOpen: (mockProps: {
items: unknown[];
}) => void;
export declare const assertMenuClosed: () => void;
/**
* 'GenericItem' corresponds to an item in a collection that is passed to
* `MultiSelect` that is in a predictable shape and works with the default
* `itemToString` function.
*/
export declare const generateGenericItem: (index: number) => {
id: string;
label: string;
value: number;
};
/**
* 'CustomItem' corresponds to a potentially different item structure that might
* be passed into `MultiSelect` that we would need to supply a custom
* `itemToString` method for.
*/
export declare const generateCustomItem: (index: number) => {
field: string;
value: string;
};
/**
* Generates an array of values generated by the `generator` function.
*/
export declare const generateItems: <T>(amount: number, generator: (index: number) => T) => T[];
export declare const customItemToString: ({ field, }: {
field: string;
value: string;
}) => string;
/**
* This object contains two sets of three items that share the same root
* word in different portions of the string (beginning, middle, end):
*
* - 'struct'
* - 'port'
*
* Separated by a disabled item, these derivative words are helpful when
* testing fuzzy search functions and components that do substring filtering.
*/
export declare const cognateItems: ({
id: string;
text: string;
disabled?: undefined;
} | {
id: string;
text: string;
disabled: boolean;
})[];
/**
* Flushes microtasks to ensure element position state is settled
* From https://floating-ui.com/docs/react#testing
* More context here: https://github.com/floating-ui/react-popper/issues/368#issuecomment-1340413010
*/
export declare const waitForPosition: () => Promise<void>;