Skip to content
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

Fixed a11y property error message #1673

Merged
merged 2 commits into from Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Dropdown.js
Expand Up @@ -206,7 +206,7 @@ class Dropdown extends React.Component {
addonType,
tag,
...attrs
} = omit(this.props, ['toggle', 'disabled', 'inNavbar']);
} = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'a11y']);

const Tag = tag || (nav ? 'li' : 'div');

Expand Down
16 changes: 16 additions & 0 deletions src/__tests__/Dropdown.spec.js
Expand Up @@ -68,6 +68,22 @@ describe('Dropdown', () => {
});

describe('handleProps', () => {
it('should not pass custom props to html attrs', () => {
const wrapper = mount(
<Dropdown inNavbar a11y isOpen={isOpen} toggle={toggle}>
<DropdownToggle>Toggle</DropdownToggle>
<DropdownMenu>
<DropdownItem>Test</DropdownItem>
</DropdownMenu>
</Dropdown>
);

expect(wrapper.find('.dropdown').prop('inNavbar')).toBe(undefined);
expect(wrapper.find('.dropdown').prop('toggle')).toBe(undefined);
expect(wrapper.find('.dropdown').prop('a11y')).toBe(undefined);
expect(wrapper.find('.dropdown').prop('isOpen')).toBe(undefined);
});

it('should be called on componentDidUpdate when isOpen changed', () => {
jest.spyOn(Dropdown.prototype, 'componentDidUpdate');
jest.spyOn(Dropdown.prototype, 'handleProps');
Expand Down