I'm testing a combobox, which has a placeholder value like so:
<option key='blankChoice' hidden value>{blankChoice}</option>
I want to run a test, that checks if the blank choice is actually appended to my combobox, therefore I did the following:
beforeEach(() => {
wrapper = mount(<ComboBox options={options} />)
});
afterEach(() => {
wrapper.unmount();
})
test('Combobox has 1 hidden options', () => {
const elem = wrapper.find('option')
expect(elem).toHaveAttribute("hidden").toBe(1)
})
The above returns an error to me:
received value must be an HTMLElement or an SVGElement.
I sort of understand this error, but I'm in doubt if my general approach is correct at all. Therefore, how do I test if my comobobx has 1 hidden <option>