Commit 2f836faa authored by Martin Wortschack's avatar Martin Wortschack Committed by Phil Hughes

Replace breakpoints with GlBreakpointInstance in feature_highlight_options.js

parent b159a2c8
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import { highlightFeatures } from './feature_highlight'; import { highlightFeatures } from './feature_highlight';
import bp from '../breakpoints';
export default function domContentLoaded() { export default function domContentLoaded() {
if (bp.getBreakpointSize() === 'lg') { if (bp.getBreakpointSize() === 'xl') {
highlightFeatures(); highlightFeatures();
return true; return true;
} }
......
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import domContentLoaded from '~/feature_highlight/feature_highlight_options'; import domContentLoaded from '~/feature_highlight/feature_highlight_options';
import bp from '~/breakpoints';
describe('feature highlight options', () => { describe('feature highlight options', () => {
describe('domContentLoaded', () => { describe('domContentLoaded', () => {
...@@ -21,9 +21,15 @@ describe('feature highlight options', () => { ...@@ -21,9 +21,15 @@ describe('feature highlight options', () => {
expect(domContentLoaded()).toBe(false); expect(domContentLoaded()).toBe(false);
}); });
it('should call highlightFeatures when breakpoint is lg', () => { it('should not call highlightFeatures when breakpoint is not xl', () => {
jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('lg'); jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('lg');
expect(domContentLoaded()).toBe(false);
});
it('should call highlightFeatures when breakpoint is xl', () => {
jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('xl');
expect(domContentLoaded()).toBe(true); expect(domContentLoaded()).toBe(true);
}); });
}); });
......
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