1
1
const stripIndent = require ( 'common-tags/lib/stripIndent' ) ;
2
- const docsifyInit = require ( '../helpers/docsify-init' ) ;
2
+ // const docsifyInit = require('../helpers/docsify-init');
3
+ const marked = require ( 'marked' ) ;
3
4
4
5
// Suite
5
6
// -----------------------------------------------------------------------------
6
7
describe ( 'render' , function ( ) {
7
8
// Setup & Teardown
8
9
// -------------------------------------------------------------------------
9
- beforeEach ( async ( ) => {
10
- await docsifyInit ( ) ;
11
- } ) ;
10
+ // beforeEach(async () => {
11
+ // await docsifyInit();
12
+ // });
12
13
13
14
// Helpers
14
15
// ---------------------------------------------------------------------------
15
16
describe ( 'helpers' , ( ) => {
16
17
test ( 'important content' , ( ) => {
17
- const output = window . marked ( '!> Important content' ) ;
18
+ const output = marked ( '!> Important content' ) ;
18
19
19
20
expect ( output ) . toMatchInlineSnapshot (
20
21
`"<p class=\\"tip\\">Important content</p>"`
21
22
) ;
22
23
} ) ;
23
24
24
25
test ( 'general tip' , ( ) => {
25
- const output = window . marked ( '?> General tip' ) ;
26
+ const output = marked ( '?> General tip' ) ;
26
27
27
28
expect ( output ) . toMatchInlineSnapshot (
28
29
`"<p class=\\"warn\\">General tip</p>"`
@@ -34,7 +35,7 @@ describe('render', function() {
34
35
// ---------------------------------------------------------------------------
35
36
describe ( 'lists' , function ( ) {
36
37
test ( 'as unordered task list' , async function ( ) {
37
- const output = window . marked ( stripIndent `
38
+ const output = marked ( stripIndent `
38
39
- [x] Task 1
39
40
- [ ] Task 2
40
41
- [ ] Task 3
@@ -46,7 +47,7 @@ describe('render', function() {
46
47
} ) ;
47
48
48
49
test ( 'as ordered task list' , async function ( ) {
49
- const output = window . marked ( stripIndent `
50
+ const output = marked ( stripIndent `
50
51
1. [ ] Task 1
51
52
2. [x] Task 2
52
53
` ) ;
@@ -57,7 +58,7 @@ describe('render', function() {
57
58
} ) ;
58
59
59
60
test ( 'normal unordered' , async function ( ) {
60
- const output = window . marked ( stripIndent `
61
+ const output = marked ( stripIndent `
61
62
- [linktext](link)
62
63
- just text
63
64
` ) ;
@@ -68,7 +69,7 @@ describe('render', function() {
68
69
} ) ;
69
70
70
71
test ( 'unordered with custom start' , async function ( ) {
71
- const output = window . marked ( stripIndent `
72
+ const output = marked ( stripIndent `
72
73
1. first
73
74
2. second
74
75
@@ -83,7 +84,7 @@ describe('render', function() {
83
84
} ) ;
84
85
85
86
test ( 'nested' , async function ( ) {
86
- const output = window . marked ( stripIndent `
87
+ const output = marked ( stripIndent `
87
88
- 1
88
89
- 2
89
90
- 2 a
@@ -101,15 +102,15 @@ describe('render', function() {
101
102
// ---------------------------------------------------------------------------
102
103
describe ( 'images' , function ( ) {
103
104
test ( 'regular' , async function ( ) {
104
- const output = window . marked ( '' ) ;
105
+ const output = marked ( '' ) ;
105
106
106
107
expect ( output ) . toMatchInlineSnapshot (
107
108
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\"></p>"`
108
109
) ;
109
110
} ) ;
110
111
111
112
test ( 'class' , async function ( ) {
112
- const output = window . marked (
113
+ const output = marked (
113
114
""
114
115
) ;
115
116
@@ -119,17 +120,15 @@ describe('render', function() {
119
120
} ) ;
120
121
121
122
test ( 'id' , async function ( ) {
122
- const output = window . marked (
123
- ""
124
- ) ;
123
+ const output = marked ( "" ) ;
125
124
126
125
expect ( output ) . toMatchInlineSnapshot (
127
126
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" id=\\"someCssID\\" /></p>"`
128
127
) ;
129
128
} ) ;
130
129
131
130
test ( 'no-zoom' , async function ( ) {
132
- const output = window . marked ( "" ) ;
131
+ const output = marked ( "" ) ;
133
132
134
133
expect ( output ) . toMatchInlineSnapshot (
135
134
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" data-no-zoom /></p>"`
@@ -138,7 +137,7 @@ describe('render', function() {
138
137
139
138
describe ( 'size' , function ( ) {
140
139
test ( 'width and height' , async function ( ) {
141
- const output = window . marked (
140
+ const output = marked (
142
141
""
143
142
) ;
144
143
@@ -148,7 +147,7 @@ describe('render', function() {
148
147
} ) ;
149
148
150
149
test ( 'width' , async function ( ) {
151
- const output = window . marked ( "" ) ;
150
+ const output = marked ( "" ) ;
152
151
153
152
expect ( output ) . toMatchInlineSnapshot (
154
153
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" width=\\"50\\" /></p>"`
@@ -161,47 +160,47 @@ describe('render', function() {
161
160
// ---------------------------------------------------------------------------
162
161
describe ( 'headings' , function ( ) {
163
162
test ( 'h1' , async function ( ) {
164
- const output = window . marked ( '# h1 tag' ) ;
163
+ const output = marked ( '# h1 tag' ) ;
165
164
166
165
expect ( output ) . toMatchInlineSnapshot (
167
166
`"<h1 id=\\"h1-tag\\"><a href=\\"#/?id=h1-tag\\" data-id=\\"h1-tag\\" class=\\"anchor\\"><span>h1 tag</span></a></h1>"`
168
167
) ;
169
168
} ) ;
170
169
171
170
test ( 'h2' , async function ( ) {
172
- const output = window . marked ( '## h2 tag' ) ;
171
+ const output = marked ( '## h2 tag' ) ;
173
172
174
173
expect ( output ) . toMatchInlineSnapshot (
175
174
`"<h2 id=\\"h2-tag\\"><a href=\\"#/?id=h2-tag\\" data-id=\\"h2-tag\\" class=\\"anchor\\"><span>h2 tag</span></a></h2>"`
176
175
) ;
177
176
} ) ;
178
177
179
178
test ( 'h3' , async function ( ) {
180
- const output = window . marked ( '### h3 tag' ) ;
179
+ const output = marked ( '### h3 tag' ) ;
181
180
182
181
expect ( output ) . toMatchInlineSnapshot (
183
182
`"<h3 id=\\"h3-tag\\"><a href=\\"#/?id=h3-tag\\" data-id=\\"h3-tag\\" class=\\"anchor\\"><span>h3 tag</span></a></h3>"`
184
183
) ;
185
184
} ) ;
186
185
187
186
test ( 'h4' , async function ( ) {
188
- const output = window . marked ( '#### h4 tag' ) ;
187
+ const output = marked ( '#### h4 tag' ) ;
189
188
190
189
expect ( output ) . toMatchInlineSnapshot (
191
190
`"<h4 id=\\"h4-tag\\"><a href=\\"#/?id=h4-tag\\" data-id=\\"h4-tag\\" class=\\"anchor\\"><span>h4 tag</span></a></h4>"`
192
191
) ;
193
192
} ) ;
194
193
195
194
test ( 'h5' , async function ( ) {
196
- const output = window . marked ( '##### h5 tag' ) ;
195
+ const output = marked ( '##### h5 tag' ) ;
197
196
198
197
expect ( output ) . toMatchInlineSnapshot (
199
198
`"<h5 id=\\"h5-tag\\"><a href=\\"#/?id=h5-tag\\" data-id=\\"h5-tag\\" class=\\"anchor\\"><span>h5 tag</span></a></h5>"`
200
199
) ;
201
200
} ) ;
202
201
203
202
test ( 'h6' , async function ( ) {
204
- const output = window . marked ( '###### h6 tag' ) ;
203
+ const output = marked ( '###### h6 tag' ) ;
205
204
206
205
expect ( output ) . toMatchInlineSnapshot (
207
206
`"<h6 id=\\"h6-tag\\"><a href=\\"#/?id=h6-tag\\" data-id=\\"h6-tag\\" class=\\"anchor\\"><span>h6 tag</span></a></h6>"`
@@ -211,7 +210,7 @@ describe('render', function() {
211
210
212
211
describe ( 'link' , function ( ) {
213
212
test ( 'regular' , async function ( ) {
214
- const output = window . marked ( '[alt text](http://url)' ) ;
213
+ const output = marked ( '[alt text](http://url)' ) ;
215
214
216
215
expect ( output ) . toMatchInlineSnapshot (
217
216
`"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\">alt text</a></p>"`
@@ -223,41 +222,39 @@ describe('render', function() {
223
222
// externalLinkTarget: '_blank',
224
223
// externalLinkRel: 'noopener',
225
224
// });
226
- const output = window . marked ( '[alt text](http://www.example.com)' ) ;
225
+ const output = marked ( '[alt text](http://www.example.com)' ) ;
227
226
228
227
expect ( output ) . toMatchInlineSnapshot (
229
228
`"<p><a href=\\"http://www.example.com\\" target=\\"_blank\\" rel=\\"noopener\\">alt text</a></p>"`
230
229
) ;
231
230
} ) ;
232
231
233
232
test ( 'disabled' , async function ( ) {
234
- const output = window . marked ( "[alt text](http://url ':disabled')" ) ;
233
+ const output = marked ( "[alt text](http://url ':disabled')" ) ;
235
234
236
235
expect ( output ) . toMatchInlineSnapshot (
237
236
`"<p><a href=\\"javascript:void(0)\\" target=\\"_blank\\" rel=\\"noopener\\" disabled>alt text</a></p>"`
238
237
) ;
239
238
} ) ;
240
239
241
240
test ( 'target' , async function ( ) {
242
- const output = window . marked ( "[alt text](http://url ':target=_self')" ) ;
241
+ const output = marked ( "[alt text](http://url ':target=_self')" ) ;
243
242
244
243
expect ( output ) . toMatchInlineSnapshot (
245
244
`"<p><a href=\\"http://url\\" target=\\"_self\\" >alt text</a></p>"`
246
245
) ;
247
246
} ) ;
248
247
249
248
test ( 'class' , async function ( ) {
250
- const output = window . marked (
251
- "[alt text](http://url ':class=someCssClass')"
252
- ) ;
249
+ const output = marked ( "[alt text](http://url ':class=someCssClass')" ) ;
253
250
254
251
expect ( output ) . toMatchInlineSnapshot (
255
252
`"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\" class=\\"someCssClass\\">alt text</a></p>"`
256
253
) ;
257
254
} ) ;
258
255
259
256
test ( 'id' , async function ( ) {
260
- const output = window . marked ( "[alt text](http://url ':id=someCssID')" ) ;
257
+ const output = marked ( "[alt text](http://url ':id=someCssID')" ) ;
261
258
262
259
expect ( output ) . toMatchInlineSnapshot (
263
260
`"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\" id=\\"someCssID\\">alt text</a></p>"`
0 commit comments