summaryrefslogtreecommitdiff
path: root/spec/frontend/feature_highlight/feature_highlight_options_spec.js
blob: 8b75c46fd4c345c1718e68b86268662116eb1ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import domContentLoaded from '~/feature_highlight/feature_highlight_options';

describe('feature highlight options', () => {
  describe('domContentLoaded', () => {
    it('should not call highlightFeatures when breakpoint is xs', () => {
      jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('xs');

      expect(domContentLoaded()).toBe(false);
    });

    it('should not call highlightFeatures when breakpoint is sm', () => {
      jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('sm');

      expect(domContentLoaded()).toBe(false);
    });

    it('should not call highlightFeatures when breakpoint is md', () => {
      jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('md');

      expect(domContentLoaded()).toBe(false);
    });

    it('should not call highlightFeatures when breakpoint is not xl', () => {
      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);
    });
  });
});