I cant seem to find much/any docs on this really simple thing I'm trying to achieve
I have a dropdown that is display: none
. when I click a checkbox it becomes display: block
all I'm trying to assert is when I click the checkbox, it shows the dropdown
expect(getByLabelText('Locale')).toHaveStyle(`
display: none;
`)
getByLabelText('Locale').checked = true
expect(getByLabelText('Locale')).toHaveStyle(`
display: block;
`)
the code works as expected but the test is failing on the second expect block saying: it should still be display: none
is the correct way to assert this?
when I click the checkbox it updates 2 attributes in my object to true
which is how it renders in the code. when I manually pass these attributes the test still fails but it fails in the first expectation.
I feel like I need to do something like setProps
I have now tried to use renderWithRedux
but it doesn't seem to be firing my action creator correctly?
is fireEvent.click(queryByTestId('LocaleCheckbox'))
the best thing to try and update a checkbox?
display: none;
? – Spume