Fix isDesktop function to return proper value
This commit is contained in:
parent
539ac25899
commit
9dca4f127f
2 changed files with 15 additions and 1 deletions
|
@ -15,7 +15,7 @@ const BreakpointInstance = {
|
|||
return breakpoint;
|
||||
},
|
||||
isDesktop() {
|
||||
return ['lg', 'md'].includes(this.getBreakpointSize);
|
||||
return ['lg', 'md'].includes(this.getBreakpointSize());
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -10,4 +10,18 @@ describe('breakpoints', () => {
|
|||
expect(bp.getBreakpointSize()).toBe(key);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isDesktop', () => {
|
||||
it('returns true when screen size is medium', () => {
|
||||
spyOn(bp, 'windowWidth').and.returnValue(breakpoints.md + 10);
|
||||
|
||||
expect(bp.isDesktop()).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false when screen size is small', () => {
|
||||
spyOn(bp, 'windowWidth').and.returnValue(breakpoints.sm + 10);
|
||||
|
||||
expect(bp.isDesktop()).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue