Skip to content

Commit

Permalink
fix: navbar toggle correct 'collapsed' className when collapsed (#4412)
Browse files Browse the repository at this point in the history
* Navbar toggle correct 'collapsed' className when collapsed

* navbar spec updates
  • Loading branch information
mattywong authored and jquense committed Sep 5, 2019
1 parent 27c162f commit bcb0c8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/NavbarToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const NavbarToggle = React.forwardRef(
ref={ref}
onClick={handleClick}
aria-label={label}
className={classNames(className, bsPrefix, !!expanded && 'collapsed')}
className={classNames(className, bsPrefix, !expanded && 'collapsed')}
>
{children || <span className={`${bsPrefix}-icon`} />}
</Component>
Expand Down
4 changes: 2 additions & 2 deletions test/NavbarSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ describe('<Navbar>', () => {
let collapse = wrapper.find('Collapse');

expect(collapse.is('[in=false]')).to.equal(true);
expect(toggle.hasClass('collapsed')).to.equal(false);
expect(toggle.hasClass('collapsed')).to.equal(true);

toggle.simulate('click');

toggle = wrapper.find('.navbar-toggler');
collapse = wrapper.find('Collapse');

expect(collapse.is('[in=true]')).to.equal(true);
expect(toggle.hasClass('collapsed')).to.equal(true);
expect(toggle.hasClass('collapsed')).to.equal(false);
});

it('Should open external href link in collapseOnSelect', () => {
Expand Down

0 comments on commit bcb0c8e

Please sign in to comment.