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

settings_titles_spec.js « components « group « settings « packages_and_registries « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fcfad4b42b814f1dd04cf618795a6183d7563c84 (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
import { shallowMount } from '@vue/test-utils';
import SettingsTitles from '~/packages_and_registries/settings/group/components/settings_titles.vue';

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

  const defaultProps = {
    title: 'foo',
    subTitle: 'bar',
  };

  const mountComponent = (propsData = defaultProps) => {
    wrapper = shallowMount(SettingsTitles, {
      propsData,
    });
  };

  const findSubTitle = () => wrapper.find('p');

  afterEach(() => {
    wrapper.destroy();
  });

  it('renders properly', () => {
    mountComponent();

    expect(wrapper.element).toMatchSnapshot();
  });

  it('does not render the subtitle paragraph when no subtitle is passed', () => {
    mountComponent({ title: defaultProps.title });

    expect(findSubTitle().exists()).toBe(false);
  });
});