mirror of
https://github.com/grafana/grafana.git
synced 2025-01-06 22:23:19 -06:00
ccd75d72f8
* refactor(selectoptiontest): move helper function out of grafana/ui so testing-lib isn't in bundle * test(selectoptionintest): update import location of helper function * test(amroutes): put back missing selectOptionInTest helper * test(selectoptionintest): clean up remaining file imports / exports * test(queryeditor): fix failing import * refactor(grafana-ui): reuse selectOptionInTest in SelectBase test
12 lines
519 B
TypeScript
12 lines
519 B
TypeScript
import { select } from 'react-select-event';
|
|
|
|
// Used to select an option or options from a Select in unit tests
|
|
export const selectOptionInTest = async (
|
|
input: HTMLElement,
|
|
optionOrOptions: string | RegExp | Array<string | RegExp>
|
|
) => await select(input, optionOrOptions, { container: document.body });
|
|
|
|
// Finds the parent of the Select so you can assert if it has a value
|
|
export const getSelectParent = (input: HTMLElement) =>
|
|
input.parentElement?.parentElement?.parentElement?.parentElement?.parentElement;
|