diff --git a/CHANGELOG.md b/CHANGELOG.md index ebeed954fc1..54ea5b7cd01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Updated `EuiPage` background color to match body background color ([#1513](https://github.com/elastic/eui/pull/1513)) - Fixed React key usage in `EuiPagination` ([#1514](https://github.com/elastic/eui/pull/1514)) +- Fixed bug which prevented `EuiSwitch` with generated ID from having its label announced by VoiceOver ([#1519](https://github.com/elastic/eui/pull/1519)) ## [`6.8.0`](https://github.com/elastic/eui/tree/v6.8.0) diff --git a/src/components/form/switch/__snapshots__/switch.test.js.snap b/src/components/form/switch/__snapshots__/switch.test.js.snap index 40be4bfbf4f..8e1fe28df6d 100644 --- a/src/components/form/switch/__snapshots__/switch.test.js.snap +++ b/src/components/form/switch/__snapshots__/switch.test.js.snap @@ -1,5 +1,53 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`EuiSwitch assigns automatically generated ID to label 1`] = ` +
+ + + + + + + + + + + + +
+`; + exports[`EuiSwitch is rendered 1`] = `
{label} diff --git a/src/components/form/switch/switch.test.js b/src/components/form/switch/switch.test.js index 2d916946266..e641d961956 100644 --- a/src/components/form/switch/switch.test.js +++ b/src/components/form/switch/switch.test.js @@ -4,6 +4,8 @@ import { requiredProps } from '../../../test/required_props'; import { EuiSwitch } from './switch'; +jest.mock(`../form_row/make_id`, () => () => `generated-id`); + describe('EuiSwitch', () => { test('is rendered', () => { const component = render( @@ -13,4 +15,13 @@ describe('EuiSwitch', () => { expect(component) .toMatchSnapshot(); }); + + test('assigns automatically generated ID to label', () => { + const component = render( + + ); + + expect(component) + .toMatchSnapshot(); + }); });