blob: a4c1b989dac9c7c36b74fddf765bf3f00b7a1de6 (
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 { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import SettingsBlock from '~/packages_and_registries/shared/components/settings_block.vue';
describe('SettingsBlock', () => {
let wrapper;
const mountComponent = (propsData) => {
wrapper = shallowMountExtended(SettingsBlock, {
propsData,
slots: {
title: '<div data-testid="title-slot"></div>',
description: '<div data-testid="description-slot"></div>',
default: '<div data-testid="default-slot"></div>',
},
});
};
afterEach(() => {
wrapper.destroy();
});
const findDefaultSlot = () => wrapper.findByTestId('default-slot');
const findTitleSlot = () => wrapper.findByTestId('title-slot');
const findDescriptionSlot = () => wrapper.findByTestId('description-slot');
it('has a default slot', () => {
mountComponent();
expect(findDefaultSlot().exists()).toBe(true);
});
it('has a title slot', () => {
mountComponent();
expect(findTitleSlot().exists()).toBe(true);
});
it('has a description slot', () => {
mountComponent();
expect(findDescriptionSlot().exists()).toBe(true);
});
});
|