Make switch use a random id if none is provided#779
Conversation
d29c9a8 to
543bc3c
Compare
db5a1d4 to
4d650b2
Compare
| test('is rendered', () => { | ||
| const component = render( | ||
| <EuiSwitch {...requiredProps} /> | ||
| <EuiSwitch id="test" {...requiredProps} /> |
There was a problem hiding this comment.
Alternatively, you can mock the makeId function; having two tests, one where you pass id and one where id is generated, would provide the best coverage of the component's id logic.
|
This PR shows really, that someone should look into the whole |
cjcenizal
left a comment
There was a problem hiding this comment.
Didn't look at the code but I tested this in VoiceOver in Chrome and it works as expected.
4d650b2 to
3541d13
Compare
|
Updated / rebased. I'll make an issue to update the test to be more intense, but merge this for now since it's been hanging for awhile. |
Fixes #748
Fixes #1027
Switches now generate a random id if none are passed (similar to how we do it in
EuiFormRow. This should only happen when used on their own, since most other situations will usually generate one.This seemed like the best solution since I could not require ids to be provided, otherwise it would spit out errors when
EuiFormRowcloned ids down.