Commit f49a15b9 authored by Martin Wortschack's avatar Martin Wortschack

Remove breakpoints utils

- Removes deprecated breakpoint utils
parent 16f76007
export const breakpoints = {
lg: 1200,
md: 992,
sm: 768,
xs: 0,
};
const BreakpointInstance = {
windowWidth: () => window.innerWidth,
getBreakpointSize() {
const windowWidth = this.windowWidth();
const breakpoint = Object.keys(breakpoints).find(key => windowWidth > breakpoints[key]);
return breakpoint;
},
isDesktop() {
return ['lg', 'md'].includes(this.getBreakpointSize());
},
};
export default BreakpointInstance;
import bp, { breakpoints } from '~/breakpoints';
describe('breakpoints', () => {
Object.keys(breakpoints).forEach(key => {
const size = breakpoints[key];
it(`returns ${key} when larger than ${size}`, () => {
jest.spyOn(bp, 'windowWidth').mockReturnValue(size + 10);
expect(bp.getBreakpointSize()).toBe(key);
});
});
describe('isDesktop', () => {
it('returns true when screen size is medium', () => {
jest.spyOn(bp, 'windowWidth').mockReturnValue(breakpoints.md + 10);
expect(bp.isDesktop()).toBe(true);
});
it('returns false when screen size is small', () => {
jest.spyOn(bp, 'windowWidth').mockReturnValue(breakpoints.sm + 10);
expect(bp.isDesktop()).toBe(false);
});
});
});
...@@ -3,7 +3,6 @@ import MockAdapter from 'axios-mock-adapter'; ...@@ -3,7 +3,6 @@ import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import MergeRequestTabs from '~/merge_request_tabs'; import MergeRequestTabs from '~/merge_request_tabs';
import '~/commit/pipelines/pipelines_bundle'; import '~/commit/pipelines/pipelines_bundle';
import '~/breakpoints';
import '~/lib/utils/common_utils'; import '~/lib/utils/common_utils';
import 'vendor/jquery.scrollTo'; import 'vendor/jquery.scrollTo';
import initMrPage from './helpers/init_vue_mr_page_helper'; import initMrPage from './helpers/init_vue_mr_page_helper';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment