2018-10-17 03:13:26 -04:00
|
|
|
import bp, { breakpoints } from '~/breakpoints';
|
2017-08-10 07:38:45 -04:00
|
|
|
|
|
|
|
describe('breakpoints', () => {
|
2018-10-17 03:13:26 -04:00
|
|
|
Object.keys(breakpoints).forEach(key => {
|
2017-08-10 07:38:45 -04:00
|
|
|
const size = breakpoints[key];
|
|
|
|
|
|
|
|
it(`returns ${key} when larger than ${size}`, () => {
|
|
|
|
spyOn(bp, 'windowWidth').and.returnValue(size + 10);
|
|
|
|
|
|
|
|
expect(bp.getBreakpointSize()).toBe(key);
|
|
|
|
});
|
|
|
|
});
|
2019-04-10 16:39:03 -04:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
2017-08-10 07:38:45 -04:00
|
|
|
});
|