forked from swiftlang/swift-docc-render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBetaLegalText.spec.js
58 lines (52 loc) · 1.88 KB
/
BetaLegalText.spec.js
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
56
57
58
/**
* This source file is part of the Swift.org open source project
*
* Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
* Licensed under Apache License v2.0 with Runtime Library Exception
*
* See https://swift.org/LICENSE.txt for license information
* See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/
import BetaLegalText from 'docc-render/components/DocumentationTopic/BetaLegalText.vue';
import { shallowMount } from '@vue/test-utils';
import GridRow from 'docc-render/components/GridRow.vue';
import GridColumn from 'docc-render/components/GridColumn.vue';
describe('BetaLegalText', () => {
let wrapper;
beforeEach(() => {
wrapper = shallowMount(BetaLegalText);
});
it('renders the BetaLegalText inside a grid', () => {
expect(wrapper.find(GridRow).exists()).toBe(true);
expect(wrapper.find(GridColumn).exists()).toBe(true);
expect(wrapper.find(GridColumn).props('span')).toEqual({ large: 12 });
});
it('renders a title', () => {
expect(wrapper.find('.betainfo-label').text()).toEqual('metadata.beta.software');
});
it('renders default content in the content slot', () => {
const content = wrapper.find('.betainfo-content');
expect(content.exists()).toBe(true);
expect(content.text()).toContain('metadata.beta.legal');
});
it('exposes a content slot', () => {
wrapper = shallowMount(BetaLegalText, {
slots: {
content: '<div class="foo">Foo</div>',
},
});
const content = wrapper.find('.foo');
expect(content.exists()).toBe(true);
expect(content.text()).toContain('Foo');
});
it('exposes an `after` slot', () => {
wrapper = shallowMount(BetaLegalText, {
slots: {
content: '<div class="after">After</div>',
},
});
const content = wrapper.find('.after');
expect(content.exists()).toBe(true);
expect(content.text()).toContain('After');
});
});