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

hidden_files_warning_spec.js « components « diffs « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b748a3ed6f472852ce01356eb42e9ec691c6fc5 (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 { mount } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
import HiddenFilesWarning from '~/diffs/components/hidden_files_warning.vue';

const propsData = {
  total: '10',
  visible: 5,
  plainDiffPath: 'plain-diff-path',
  emailPatchPath: 'email-patch-path',
};

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

  const createComponent = () => {
    wrapper = mount(HiddenFilesWarning, {
      propsData,
    });
  };

  beforeEach(() => {
    createComponent();
  });

  it('has a correct plain diff URL', () => {
    const plainDiffLink = wrapper.findAllComponents(GlButton).at(0);

    expect(plainDiffLink.attributes('href')).toBe(propsData.plainDiffPath);
  });

  it('has a correct email patch URL', () => {
    const emailPatchLink = wrapper.findAllComponents(GlButton).at(1);

    expect(emailPatchLink.attributes('href')).toBe(propsData.emailPatchPath);
  });

  it('has a correct visible/total files text', () => {
    expect(wrapper.text()).toContain(
      __(
        'For a faster browsing experience, only 5 of 10 files are shown. Download one of the files below to see all changes',
      ),
    );
  });
});