selectOptionInTest.ts 519 B

1234567891011
  1. import { select } from 'react-select-event';
  2. // Used to select an option or options from a Select in unit tests
  3. export const selectOptionInTest = async (
  4. input: HTMLElement,
  5. optionOrOptions: string | RegExp | Array<string | RegExp>
  6. ) => await select(input, optionOrOptions, { container: document.body });
  7. // Finds the parent of the Select so you can assert if it has a value
  8. export const getSelectParent = (input: HTMLElement) =>
  9. input.parentElement?.parentElement?.parentElement?.parentElement?.parentElement;