Skip to content

Commit

Permalink
fix(AbstractNav): Re-add role attribute to abstract nav (#4331)
Browse files Browse the repository at this point in the history
* Update tests to match host component rather than React component

* Pass the role along to the Component
  • Loading branch information
jmooserific authored and taion committed Aug 24, 2019
1 parent f5db00a commit 6c2dd84
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/AbstractNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ const AbstractNav = React.forwardRef(
getControllerId: getControllerId || noop,
}}
>
<Component {...props} onKeyDown={handleKeyDown} ref={mergedRef} />
<Component
{...props}
onKeyDown={handleKeyDown}
ref={mergedRef}
role={role}
/>
</NavContext.Provider>
</SelectableContext.Provider>
);
Expand Down
2 changes: 1 addition & 1 deletion test/NavSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ describe('<Nav>', () => {
</Nav>,
);

wrapper.assertSingle('.nav[role="tablist"]');
wrapper.assertSingle('div.nav[role="tablist"]');
wrapper.find('a[role="tab"]').length.should.equal(2);
});
});
Expand Down
5 changes: 2 additions & 3 deletions test/TabContainerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ describe('<TabContainer>', () => {
</div>
</TabContainer>,
);

instance.assertSingle('.nav[role="tablist"]');
instance.assertSingle('div.nav[role="tablist"]');

instance
.find('NavLink a')
Expand All @@ -112,7 +111,7 @@ describe('<TabContainer>', () => {
</TabContainer>,
);

instance.assertSingle('.nav[role="navigation"]');
instance.assertSingle('div.nav[role="navigation"]');

// make sure its not passed to the Nav.Link
expect(
Expand Down

0 comments on commit 6c2dd84

Please sign in to comment.