From 5386b34e33c74a81e96b593e68cd2abca9a6c199 Mon Sep 17 00:00:00 2001 From: Emily Plummer Date: Tue, 2 Mar 2021 14:10:58 -0800 Subject: [PATCH 1/2] pass aria-label down to nav --- src/TabNav.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TabNav.tsx b/src/TabNav.tsx index fd93a9f41cc..921b7dac5fd 100644 --- a/src/TabNav.tsx +++ b/src/TabNav.tsx @@ -26,10 +26,10 @@ const TabNavBody = styled.nav` export type TabNavProps = ComponentProps -function TabNav({children, ...rest}: TabNavProps) { +function TabNav({children, "aria-label": ariaLabel, ...rest}: TabNavProps) { return ( - {children} + {children} ) } From fdb10f6c29a0b58fd080359d05d5ff0b238a7d7a Mon Sep 17 00:00:00 2001 From: Emily Plummer Date: Tue, 2 Mar 2021 14:33:15 -0800 Subject: [PATCH 2/2] fix test so this doesn't happen again :) --- src/__tests__/TabNav.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/__tests__/TabNav.tsx b/src/__tests__/TabNav.tsx index bb0dec20851..216919beec4 100644 --- a/src/__tests__/TabNav.tsx +++ b/src/__tests__/TabNav.tsx @@ -1,6 +1,6 @@ import React from 'react' import {TabNav} from '..' -import {mount, render, rendersClass, behavesAsComponent, checkExports} from '../utils/testing' +import {render, behavesAsComponent, checkExports} from '../utils/testing' import {COMMON} from '../constants' import {render as HTMLRender, cleanup} from '@testing-library/react' import {axe, toHaveNoViolations} from 'jest-axe' @@ -19,13 +19,15 @@ describe('TabNav', () => { }) it('should have no axe violations', async () => { - const {container} = HTMLRender() + const {container} = HTMLRender() const results = await axe(container) expect(results).toHaveNoViolations() cleanup() }) it('sets aria-label appropriately', () => { - expect(render().props['aria-label']).toEqual('foo') + const {getByLabelText} = HTMLRender() + expect(getByLabelText("stuff")).toBeTruthy(); + expect(getByLabelText("stuff").tagName).toEqual("NAV") }) })