blob: 85466578e1861f738a160dc9b561484ac975a280 (
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
|
import { GlIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue';
let wrapper;
function createComponent(propsData) {
wrapper = shallowMount(WorkItemTypeIcon, { propsData });
}
describe('Work Item type component', () => {
const findIcon = () => wrapper.findComponent(GlIcon);
afterEach(() => {
wrapper.destroy();
});
describe.each`
workItemType | workItemIconName | iconName | text
${'TASK'} | ${''} | ${'issue-type-task'} | ${'Task'}
${''} | ${'issue-type-task'} | ${'issue-type-task'} | ${''}
${'ISSUE'} | ${''} | ${'issue-type-issue'} | ${'Issue'}
${''} | ${'issue-type-issue'} | ${'issue-type-issue'} | ${''}
${'REQUIREMENTS'} | ${''} | ${'issue-type-requirements'} | ${'Requirements'}
${'INCIDENT'} | ${''} | ${'issue-type-incident'} | ${'Incident'}
${'TEST_CASE'} | ${''} | ${'issue-type-test-case'} | ${'Test case'}
${'random-issue-type'} | ${''} | ${'issue-type-issue'} | ${''}
`(
'with workItemType set to "$workItemType" and workItemIconName set to "$workItemIconName"',
({ workItemType, workItemIconName, iconName, text }) => {
beforeEach(() => {
createComponent({
workItemType,
workItemIconName,
});
});
it(`renders icon with name '${iconName}'`, () => {
expect(findIcon().props('name')).toBe(iconName);
});
it(`renders correct text`, () => {
expect(wrapper.text()).toBe(text);
});
},
);
});
|