This repository was archived by the owner on Nov 28, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed
packages/markdown/__tests__ Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,10 @@ exports[`anchors 1`] = `
11
11
`;
12
12
13
13
exports[`anchors with baseUrl 1`] = `
14
- " <p><a href=\\" /child/v1.0/docs/slug\\" target =\\"_self\\" class =\\"doc-link\\" data-sidebar =\\"slug\\">doc</a><br/ >
15
- <a href =\\"/child/v1.0/reference-link/slug\\" target =\\"_self\\">ref</a><br/ >
16
- <a href =\\"/child/v1.0/blog/slug\\" target =\\"_self\\">blog</a><br/ >
17
- <a href =\\"/child/v1.0/page/slug\\" target =\\"_self\\">page</a><br/ >
14
+ " <p><a href=\\" /child/v1.0/docs/slug\\" target =\\"_self\\" class =\\"doc-link\\" data-sidebar =\\"slug\\">doc</a><br>
15
+ <a href =\\"/child/v1.0/reference-link/slug\\" target =\\"_self\\">ref</a><br>
16
+ <a href =\\"/child/v1.0/blog/slug\\" target =\\"_self\\">blog</a><br>
17
+ <a href =\\"/child/v1.0/page/slug\\" target =\\"_self\\">page</a><br>
18
18
</p>"
19
19
`;
20
20
Original file line number Diff line number Diff line change 1
- const { shallow } = require ( 'enzyme' ) ;
1
+ const { shallow, mount } = require ( 'enzyme' ) ;
2
+ const React = require ( 'react' ) ;
3
+ const BaseUrlContext = require ( '../contexts/BaseUrl' ) ;
2
4
3
5
const markdown = require ( '../' ) ;
4
6
@@ -65,20 +67,23 @@ test('anchors', () => {
65
67
} ) ;
66
68
67
69
test ( 'anchors with baseUrl' , ( ) => {
68
- const opts = { baseUrl : '/child/v1.0' } ;
69
- expect (
70
- shallow (
70
+ const wrapper = mount (
71
+ React . createElement (
72
+ BaseUrlContext . Provider ,
73
+ {
74
+ value : '/child/v1.0' ,
75
+ } ,
71
76
markdown (
72
77
`
73
78
[doc](doc:slug)
74
79
[ref](ref:slug)
75
80
[blog](blog:slug)
76
81
[page](page:slug)
77
82
` ,
78
- opts ,
79
83
) ,
80
- ) . html ( ) ,
81
- ) . toMatchSnapshot ( ) ;
84
+ ) ,
85
+ ) ;
86
+ expect ( wrapper . html ( ) ) . toMatchSnapshot ( ) ;
82
87
} ) ;
83
88
84
89
test ( 'emojis' , ( ) => {
You can’t perform that action at this time.
0 commit comments