-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make switch use a random id if none is provided #779
Conversation
d29c9a8
to
543bc3c
Compare
db5a1d4
to
4d650b2
Compare
@@ -7,7 +7,7 @@ import { EuiSwitch } from './switch'; | |||
describe('EuiSwitch', () => { | |||
test('is rendered', () => { | |||
const component = render( | |||
<EuiSwitch {...requiredProps} /> | |||
<EuiSwitch id="test" {...requiredProps} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
EuiFormRow
cloned ids down.