Skip to content

Commit dc6f718

Browse files
author
Artem Sapegin
committedOct 18, 2018
Test: Update tests
1 parent ffd8adb commit dc6f718

File tree

7 files changed

+60
-41
lines changed

7 files changed

+60
-41
lines changed
 

‎loaders/utils/__tests__/__snapshots__/getProps.spec.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ exports[`should highlight code in description (fenced code block) 1`] = `
130130
Object {
131131
"description": "The only true button.
132132
133-
<span class=\\"hljs-selector-tag\\">alert</span>(<span class=\\"hljs-string\\">'Hello world'</span>);
133+
<span class=\\"hljs-function\\"><span class=\\"hljs-title\\">alert</span>(<span class=\\"hljs-string\\">'Hello world'</span>);</span>
134134
",
135135
"doclets": Object {},
136136
"methods": Array [],
@@ -142,7 +142,7 @@ exports[`should highlight code in description (regular code block) 1`] = `
142142
Object {
143143
"description": "The only true button.
144144
145-
<span class=\\"hljs-selector-tag\\">alert</span>(<span class=\\"hljs-string\\">'Hello world'</span>);
145+
<span class=\\"hljs-function\\"><span class=\\"hljs-title\\">alert</span>(<span class=\\"hljs-string\\">'Hello world'</span>);</span>
146146
",
147147
"doclets": Object {},
148148
"methods": Array [],

‎src/rsg-components/ComponentsList/__snapshots__/ComponentsList.spec.js.snap

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports[`if a custom href is provided, should use it instead of generating inter
1111
"visibleName": "External example",
1212
},
1313
Object {
14-
"href": "blank#input",
14+
"href": "/#input",
1515
"name": "Input",
1616
"slug": "input",
1717
"visibleName": "Input",
@@ -70,13 +70,13 @@ exports[`should set a parameter on link when useHashId is activated 1`] = `
7070
items={
7171
Array [
7272
Object {
73-
"href": "blank#/Components?id=button",
73+
"href": "/#/Components?id=button",
7474
"name": "Button",
7575
"slug": "button",
7676
"visibleName": "Button",
7777
},
7878
Object {
79-
"href": "blank#/Components?id=input",
79+
"href": "/#/Components?id=input",
8080
"name": "Input",
8181
"slug": "input",
8282
"visibleName": "Input",
@@ -92,12 +92,12 @@ exports[`should set a sub route on link when useHashId is deactivated 1`] = `
9292
items={
9393
Array [
9494
Object {
95-
"href": "blank#/Components/Button",
95+
"href": "/#/Components/Button",
9696
"name": "Button",
9797
"slug": "button",
9898
},
9999
Object {
100-
"href": "blank#/Components/Input",
100+
"href": "/#/Components/Input",
101101
"name": "Input",
102102
"slug": "input",
103103
},
@@ -112,13 +112,13 @@ exports[`should set the correct href for items 1`] = `
112112
items={
113113
Array [
114114
Object {
115-
"href": "blank#button",
115+
"href": "/#button",
116116
"name": "Button",
117117
"slug": "button",
118118
"visibleName": "Button",
119119
},
120120
Object {
121-
"href": "blank#input",
121+
"href": "/#input",
122122
"name": "Input",
123123
"slug": "input",
124124
"visibleName": "Input",

‎src/rsg-components/Preview/Preview.spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ afterEach(() => {
3030

3131
it('should unmount Wrapper component', () => {
3232
const actual = mount(<Preview code={code} evalInContext={evalInContext} />, options);
33+
const node = actual.instance().mountNode;
3334

34-
expect(actual.html()).toMatch('<button');
35+
expect(node.innerHTML).toMatch('<button');
3536
actual.unmount();
36-
expect(actual.html()).toBe(null);
37+
expect(node.innerHTML).toBe('');
3738
});
3839

3940
it('should not not fail when Wrapper wasn’t mounted', () => {

‎src/rsg-components/Preview/__snapshots__/Preview.spec.js.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`should handle errors 1`] = `
4-
<React.Fragment>
4+
<Fragment>
55
<div />
66
<Styled(PlaygroundError)
77
message="Invariant Violation: Target container is not a DOM element."
88
/>
9-
</React.Fragment>
9+
</Fragment>
1010
`;
1111

1212
exports[`should handle no code 1`] = `
@@ -17,9 +17,9 @@ exports[`should handle no code 1`] = `
1717
`;
1818

1919
exports[`should render component renderer 1`] = `
20-
<React.Fragment>
20+
<Fragment>
2121
<div />
22-
</React.Fragment>
22+
</Fragment>
2323
`;
2424

2525
exports[`should update 1`] = `

‎src/rsg-components/SectionHeading/SectionHeading.spec.js

+12-22
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import SectionHeadingRenderer from './SectionHeadingRenderer';
55
describe('SectionHeading', () => {
66
const FakeToolbar = () => <div>Fake toolbar</div>;
77

8-
it('should forward slot properties to the toolbar', () => {
8+
test('should forward slot properties to the toolbar', () => {
99
const actual = shallow(
1010
<SectionHeading id="section" slotName="slot" slotProps={{ foo: 1, bar: 'baz' }} depth={2}>
1111
A Section
@@ -15,18 +15,18 @@ describe('SectionHeading', () => {
1515
expect(actual).toMatchSnapshot();
1616
});
1717

18-
it('should render a section heading', () => {
19-
const actual = shallow(
18+
test('render a section heading', () => {
19+
const actual = mount(
2020
<SectionHeadingRenderer id="section" href="/section" depth={2} toolbar={<FakeToolbar />}>
2121
A Section
2222
</SectionHeadingRenderer>
2323
);
2424

25-
expect(actual.dive()).toMatchSnapshot();
25+
expect(actual.find('h2')).toMatchSnapshot();
2626
});
2727

28-
it('should render a deprecated section heading', () => {
29-
const actual = shallow(
28+
test('render a deprecated section heading', () => {
29+
const actual = mount(
3030
<SectionHeadingRenderer
3131
id="section"
3232
href="/section"
@@ -38,25 +38,20 @@ describe('SectionHeading', () => {
3838
</SectionHeadingRenderer>
3939
);
4040

41-
expect(actual.dive()).toMatchSnapshot();
41+
expect(actual.find('h2')).toMatchSnapshot();
4242
});
4343

44-
it('should prevent the heading level from exceeding the maximum allowed by the Heading component', () => {
45-
const actual = shallow(
44+
test('prevent the heading level from exceeding the maximum allowed by the Heading component', () => {
45+
const actual = mount(
4646
<SectionHeadingRenderer id="section" href="/section" depth={7} toolbar={<FakeToolbar />}>
4747
A Section
4848
</SectionHeadingRenderer>
4949
);
5050

51-
expect(
52-
actual
53-
.dive()
54-
.find('Styled(Heading)')
55-
.prop('level')
56-
).toEqual(6);
51+
expect(actual.find('h6')).toHaveLength(1);
5752
});
5853

59-
it('should the href have a parameter id=section', () => {
54+
test('the href have id=section query parameter ', () => {
6055
const actual = shallow(
6156
<SectionHeading
6257
id="section"
@@ -69,11 +64,6 @@ describe('SectionHeading', () => {
6964
</SectionHeading>
7065
);
7166

72-
expect(
73-
actual
74-
.dive()
75-
.find('SectionHeadingRenderer')
76-
.prop('href')
77-
).toEqual('blank?id=section');
67+
expect(actual.prop('href')).toEqual('/?id=section');
7868
});
7969
});

‎src/rsg-components/SectionHeading/__snapshots__/SectionHeading.spec.js.snap

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`SectionHeading render a deprecated section heading 1`] = `
4+
<h2
5+
className="rsg--heading-5 rsg--heading2-7"
6+
id="section"
7+
>
8+
<a
9+
className="rsg--sectionName-2 rsg--isDeprecated-3"
10+
href="/section"
11+
>
12+
A Section
13+
</a>
14+
</h2>
15+
`;
16+
17+
exports[`SectionHeading render a section heading 1`] = `
18+
<h2
19+
className="rsg--heading-5 rsg--heading2-7"
20+
id="section"
21+
>
22+
<a
23+
className="rsg--sectionName-2"
24+
href="/section"
25+
>
26+
A Section
27+
</a>
28+
</h2>
29+
`;
30+
331
exports[`SectionHeading should forward slot properties to the toolbar 1`] = `
432
<Styled(SectionHeading)
533
depth={2}
6-
href="blank#section"
34+
href="/#section"
735
id="section"
836
toolbar={
937
<Slot

‎src/rsg-components/slots/__snapshots__/IsolateButton.spec.js.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`should renderer a link home in isolated mode 1`] = `
44
<Styled(ToolbarButton)
5-
href="blank#/"
5+
href="/#/"
66
title="Show all components"
77
>
88
<MdFullscreenExit />
@@ -11,7 +11,7 @@ exports[`should renderer a link home in isolated mode 1`] = `
1111

1212
exports[`should renderer a link to example isolated mode 1`] = `
1313
<Styled(ToolbarButton)
14-
href="blank#!/Pizza/3"
14+
href="/#!/Pizza/3"
1515
title="Open isolated"
1616
>
1717
<MdFullscreen />
@@ -20,7 +20,7 @@ exports[`should renderer a link to example isolated mode 1`] = `
2020

2121
exports[`should renderer a link to isolated mode 1`] = `
2222
<Styled(ToolbarButton)
23-
href="blank#!/Pizza"
23+
href="/#!/Pizza"
2424
title="Open isolated"
2525
>
2626
<MdFullscreen />

0 commit comments

Comments
 (0)
Please sign in to comment.