debian-mirror-gitlab/spec/frontend/diffs/components/hidden_files_warning_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-05-07 20:08:51 +05:30
import { mount } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
2019-07-07 11:18:12 +05:30
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 = () => {
2022-05-07 20:08:51 +05:30
wrapper = mount(HiddenFilesWarning, {
2019-07-07 11:18:12 +05:30
propsData,
});
};
beforeEach(() => {
createComponent();
});
it('has a correct plain diff URL', () => {
2022-05-07 20:08:51 +05:30
const plainDiffLink = wrapper.findAllComponents(GlButton).at(0);
2019-07-07 11:18:12 +05:30
expect(plainDiffLink.attributes('href')).toBe(propsData.plainDiffPath);
});
it('has a correct email patch URL', () => {
2022-05-07 20:08:51 +05:30
const emailPatchLink = wrapper.findAllComponents(GlButton).at(1);
2019-07-07 11:18:12 +05:30
expect(emailPatchLink.attributes('href')).toBe(propsData.emailPatchPath);
});
it('has a correct visible/total files text', () => {
2022-05-07 20:08:51 +05:30
expect(wrapper.text()).toContain(
2023-06-20 00:43:36 +05:30
__(
'For a faster browsing experience, only 5 of 10 files are shown. Download one of the files below to see all changes',
),
2022-05-07 20:08:51 +05:30
);
2019-07-07 11:18:12 +05:30
});
});