diff options
-rw-r--r-- | app/assets/javascripts/breakpoints.js | 2 | ||||
-rw-r--r-- | spec/javascripts/breakpoints_spec.js | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/app/assets/javascripts/breakpoints.js b/app/assets/javascripts/breakpoints.js index 4d5d6bb864b..93aacba0e8e 100644 --- a/app/assets/javascripts/breakpoints.js +++ b/app/assets/javascripts/breakpoints.js @@ -15,7 +15,7 @@ const BreakpointInstance = { return breakpoint; }, isDesktop() { - return ['lg', 'md'].includes(this.getBreakpointSize); + return ['lg', 'md'].includes(this.getBreakpointSize()); }, }; diff --git a/spec/javascripts/breakpoints_spec.js b/spec/javascripts/breakpoints_spec.js index 5ee777fee3f..fc0d9eb907a 100644 --- a/spec/javascripts/breakpoints_spec.js +++ b/spec/javascripts/breakpoints_spec.js @@ -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); + }); + }); }); |