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

mr_widget_nothing_to_merge_spec.js « states « components « vue_merge_request_widget « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8eec16539544a9a4e88ca3aabc505496bb791cb (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 { GlSprintf, GlLink } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { helpPagePath } from '~/helpers/help_page_helper';
import NothingToMerge from '~/vue_merge_request_widget/components/states/nothing_to_merge.vue';

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

  const createComponent = () => {
    wrapper = shallowMountExtended(NothingToMerge, {
      stubs: {
        GlSprintf,
      },
    });
  };

  const findNothingToMergeTextBody = () => wrapper.findByTestId('nothing-to-merge-body');
  const findHelpLink = () => wrapper.findComponent(GlLink);

  describe('With Blob link', () => {
    beforeEach(() => {
      createComponent();
    });

    it('shows the component with the correct text and highlights', () => {
      expect(wrapper.text()).toContain('Merge request contains no changes');
      expect(findNothingToMergeTextBody().text()).toContain(
        'Use merge requests to propose changes to your project and discuss them with your team. To make changes, use the Code dropdown list above, then test them with CI/CD before merging.',
      );
    });

    it('renders text with link to CI Help Page', () => {
      expect(findHelpLink().attributes('href')).toBe(helpPagePath('ci/quick_start/index.html'));
    });
  });
});