( container: HTMLElement, option: Option | OptionNumberValue | OptionBooleanValue, options: readonly (Option | OptionNumberValue | OptionBooleanValue)[] )
| 856 | ); |
| 857 | |
| 858 | function focusOption( |
| 859 | container: HTMLElement, |
| 860 | option: Option | OptionNumberValue | OptionBooleanValue, |
| 861 | options: readonly (Option | OptionNumberValue | OptionBooleanValue)[] |
| 862 | ) { |
| 863 | let indexOfSelectedOption = options.findIndex( |
| 864 | (o) => o.value === option.value |
| 865 | ); |
| 866 | |
| 867 | for (let i = -1; i < indexOfSelectedOption; i++) { |
| 868 | fireEvent.keyDown(container.querySelector('.react-select__menu')!, { |
| 869 | keyCode: 40, |
| 870 | key: 'ArrowDown', |
| 871 | }); |
| 872 | } |
| 873 | expect( |
| 874 | container.querySelector('.react-select__option--is-focused')!.textContent |
| 875 | ).toEqual(option.label); |
| 876 | } |
| 877 | |
| 878 | cases( |
| 879 | 'hitting escape on select option', |
no outgoing calls
no test coverage detected
searching dependent graphs…