Skip to content

Commit 8c044df

Browse files
* Write test to cover Nav component
1 parent 5f315b9 commit 8c044df

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/NavMenu.test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,40 @@ describe('Test NavMenu', () => {
5757

5858
done();
5959
});
60+
61+
it('should show message of offline with mobile screen', (done) => {
62+
63+
window.screen.__defineGetter__('width', function(){
64+
return 600;
65+
});
66+
67+
let component = shallow(
68+
<NavMenu />
69+
);
70+
71+
component.instance().setState({ toggleNavStatus: 'whatever'} );
72+
expect(component.state().toggleNavStatus).toEqual('whatever');
73+
component.instance().hide(null);
74+
expect(component.state().toggleNavStatus).toEqual('');
75+
76+
done();
77+
});
78+
79+
it('should show message of offline with desktop screen', (done) => {
80+
81+
window.screen.__defineGetter__('width', function(){
82+
return 900;
83+
});
84+
85+
let component = shallow(
86+
<NavMenu />
87+
);
88+
component.instance().setState({ toggleNavStatus: 'whatever'} );
89+
expect(component.state().toggleNavStatus).toEqual('whatever');
90+
component.instance().hide(null);
91+
expect(component.state().toggleNavStatus).toEqual('');
92+
93+
done();
94+
});
6095
});
6196

0 commit comments

Comments
 (0)