blob: 08f0338d41bf375bd2d5ecd6d83d3d35a3968c43 (
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
46
47
48
49
50
51
52
53
54
55
|
import { GlAlert, GlLink } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import { sprintf } from '~/locale';
import { IssuableType } from '~/issues/constants';
import LockedWarning, { i18n } from '~/issues/show/components/locked_warning.vue';
describe('LockedWarning component', () => {
let wrapper;
const createComponent = (props = {}) => {
wrapper = mountExtended(LockedWarning, {
propsData: props,
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
const findAlert = () => wrapper.findComponent(GlAlert);
const findLink = () => wrapper.findComponent(GlLink);
describe.each([IssuableType.Issue, IssuableType.Epic])(
'with issuableType set to %s',
(issuableType) => {
let alert;
let link;
beforeEach(() => {
createComponent({ issuableType });
alert = findAlert();
link = findLink();
});
afterEach(() => {
alert = null;
link = null;
});
it('displays a non-closable alert', () => {
expect(alert.exists()).toBe(true);
expect(alert.props('dismissible')).toBe(false);
});
it(`displays correct message`, async () => {
expect(alert.text()).toMatchInterpolatedText(sprintf(i18n.alertMessage, { issuableType }));
});
it(`displays a link with correct text`, async () => {
expect(link.exists()).toBe(true);
expect(link.text()).toBe(`the ${issuableType}`);
});
},
);
});
|