blob: 887c5f615e9263a5c307467f885eb54d9e930ff3 (
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
|
import { mount } from '@vue/test-utils';
import { GlAlert, GlLink } from '@gitlab/ui';
import WorkItemInformation from '~/work_items/components/work_item_information.vue';
import { helpPagePath } from '~/helpers/help_page_helper';
const createComponent = () => mount(WorkItemInformation);
describe('Work item information alert', () => {
let wrapper;
const tasksHelpPath = helpPagePath('user/tasks');
const findAlert = () => wrapper.findComponent(GlAlert);
const findHelpLink = () => wrapper.findComponent(GlLink);
beforeEach(() => {
wrapper = createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('should be visible', () => {
expect(findAlert().exists()).toBe(true);
});
it('should emit `work-item-banner-dismissed` event when cross icon is clicked', () => {
findAlert().vm.$emit('dismiss');
expect(wrapper.emitted('work-item-banner-dismissed').length).toBe(1);
});
it('the alert variant should be tip', () => {
expect(findAlert().props('variant')).toBe('tip');
});
it('should have the correct text for title', () => {
expect(findAlert().props('title')).toBe(WorkItemInformation.i18n.tasksInformationTitle);
});
it('should have the correct link to work item link', () => {
expect(findHelpLink().exists()).toBe(true);
expect(findHelpLink().attributes('href')).toBe(tasksHelpPath);
});
});
|