From 79be49d8961d41066c680604e9e7c258b1ebb0b9 Mon Sep 17 00:00:00 2001 From: Abbey Hart Date: Mon, 18 Nov 2019 17:36:31 -0600 Subject: [PATCH] fix(tab): add aria-disabled depending on disabled prop (#4698) --- packages/react/src/components/Tab/Tab-test.js | 10 ++++++++++ packages/react/src/components/Tab/Tab.js | 1 + 2 files changed, 11 insertions(+) diff --git a/packages/react/src/components/Tab/Tab-test.js b/packages/react/src/components/Tab/Tab-test.js index d6240a94f284..fdd59ac083c4 100644 --- a/packages/react/src/components/Tab/Tab-test.js +++ b/packages/react/src/components/Tab/Tab-test.js @@ -63,6 +63,15 @@ describe('Tab', () => { ); }); + it('has aria-disabled that matches disabled', () => { + const getDisabledRegion = () => wrapper.find('[aria-disabled]'); + + expect(getDisabledRegion().length).toEqual(0); + + wrapper.setProps({ disabled: true }); + expect(getDisabledRegion().prop('aria-disabled')).toEqual(true); + }); + it(`adds [className="${prefix}--tabs__nav-item--selected"] when selected prop is true`, () => { wrapper.setProps({ selected: true }); expect(wrapper.hasClass(`${prefix}--tabs__nav-item--selected`)).toBe( @@ -110,6 +119,7 @@ describe('Tab', () => { }); }); }); + describe('custom render label', () => { const wrapper = mount( { this.tabAnchor = e; },