Welcome to mirror list, hosted at ThFree Co, Russian Federation.

status_filter_spec.js « components « sidebar « search « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2ed199469e6e24f4dcb2532166a204275563c917 (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
37
38
39
40
41
42
43
44
45
import { shallowMount } from '@vue/test-utils';
import RadioFilter from '~/search/sidebar/components/radio_filter.vue';
import StatusFilter from '~/search/sidebar/components/status_filter.vue';

describe('StatusFilter', () => {
  let wrapper;

  const createComponent = (initProps) => {
    wrapper = shallowMount(StatusFilter, {
      ...initProps,
    });
  };

  const findRadioFilter = () => wrapper.findComponent(RadioFilter);

  describe('template', () => {
    beforeEach(() => {
      createComponent();
    });

    it('renders the component', () => {
      expect(findRadioFilter().exists()).toBe(true);
    });
  });

  describe.each`
    hasFeatureFlagEnabled | paddingClass
    ${true}               | ${'gl-px-5'}
    ${false}              | ${'gl-px-0'}
  `(`RadioFilter`, ({ hasFeatureFlagEnabled, paddingClass }) => {
    beforeEach(() => {
      createComponent({
        provide: {
          glFeatures: {
            searchPageVerticalNav: hasFeatureFlagEnabled,
          },
        },
      });
    });

    it(`has ${paddingClass} class`, () => {
      expect(findRadioFilter().classes(paddingClass)).toBe(true);
    });
  });
});