Skip to content

Commit f89665e

Browse files
committed
✅ add more tests to NAVBAR
improves coverage
1 parent badf363 commit f89665e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/navbar/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class Navbar extends React.Component {
6767
onBlur={this.hideMenu}
6868
onMouseEnter={this.blockBlur}
6969
onMouseLeave={this.blockBlur}
70+
aria-label="navbar-mobile"
7071
>
7172
<div className={navLinks}>
7273
{children && typeof children === 'object' && children.map ? children.map(child => <div onClick={this.toggleMenu}>{child}</div>) : children}

lib/navbar/tests/edgecase.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,12 @@ describe('Navbar Edge case tests', () => {
4141
wrappedComponent.find(FaBars).simulate('blur');
4242
expect(simulatedValue()).equals(false);
4343
});
44+
45+
it('Shoud toggle blockOnBlur state on mouseneter and mountleave events', () => {
46+
const actualValue = () => wrappedComponent.state().blockBlur;
47+
wrappedComponent.find('div[aria-label="navbar-mobile"]').simulate('mouseenter');
48+
expect(actualValue()).to.equal(true);
49+
wrappedComponent.find('div[aria-label="navbar-mobile"]').simulate('mouseleave');
50+
expect(actualValue()).to.equal(false);
51+
});
4452
});

0 commit comments

Comments
 (0)