11const 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' ) ;
34
45// Suite
56// -----------------------------------------------------------------------------
67describe ( 'render' , function ( ) {
78 // Setup & Teardown
89 // -------------------------------------------------------------------------
9- beforeEach ( async ( ) => {
10- await docsifyInit ( ) ;
11- } ) ;
10+ // beforeEach(async () => {
11+ // await docsifyInit();
12+ // });
1213
1314 // Helpers
1415 // ---------------------------------------------------------------------------
1516 describe ( 'helpers' , ( ) => {
1617 test ( 'important content' , ( ) => {
17- const output = window . marked ( '!> Important content' ) ;
18+ const output = marked ( '!> Important content' ) ;
1819
1920 expect ( output ) . toMatchInlineSnapshot (
2021 `"<p class=\\"tip\\">Important content</p>"`
2122 ) ;
2223 } ) ;
2324
2425 test ( 'general tip' , ( ) => {
25- const output = window . marked ( '?> General tip' ) ;
26+ const output = marked ( '?> General tip' ) ;
2627
2728 expect ( output ) . toMatchInlineSnapshot (
2829 `"<p class=\\"warn\\">General tip</p>"`
@@ -34,7 +35,7 @@ describe('render', function() {
3435 // ---------------------------------------------------------------------------
3536 describe ( 'lists' , function ( ) {
3637 test ( 'as unordered task list' , async function ( ) {
37- const output = window . marked ( stripIndent `
38+ const output = marked ( stripIndent `
3839 - [x] Task 1
3940 - [ ] Task 2
4041 - [ ] Task 3
@@ -46,7 +47,7 @@ describe('render', function() {
4647 } ) ;
4748
4849 test ( 'as ordered task list' , async function ( ) {
49- const output = window . marked ( stripIndent `
50+ const output = marked ( stripIndent `
5051 1. [ ] Task 1
5152 2. [x] Task 2
5253 ` ) ;
@@ -57,7 +58,7 @@ describe('render', function() {
5758 } ) ;
5859
5960 test ( 'normal unordered' , async function ( ) {
60- const output = window . marked ( stripIndent `
61+ const output = marked ( stripIndent `
6162 - [linktext](link)
6263 - just text
6364 ` ) ;
@@ -68,7 +69,7 @@ describe('render', function() {
6869 } ) ;
6970
7071 test ( 'unordered with custom start' , async function ( ) {
71- const output = window . marked ( stripIndent `
72+ const output = marked ( stripIndent `
7273 1. first
7374 2. second
7475
@@ -83,7 +84,7 @@ describe('render', function() {
8384 } ) ;
8485
8586 test ( 'nested' , async function ( ) {
86- const output = window . marked ( stripIndent `
87+ const output = marked ( stripIndent `
8788 - 1
8889 - 2
8990 - 2 a
@@ -101,15 +102,15 @@ describe('render', function() {
101102 // ---------------------------------------------------------------------------
102103 describe ( 'images' , function ( ) {
103104 test ( 'regular' , async function ( ) {
104- const output = window . marked ( '' ) ;
105+ const output = marked ( '' ) ;
105106
106107 expect ( output ) . toMatchInlineSnapshot (
107108 `"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\"></p>"`
108109 ) ;
109110 } ) ;
110111
111112 test ( 'class' , async function ( ) {
112- const output = window . marked (
113+ const output = marked (
113114 ""
114115 ) ;
115116
@@ -119,17 +120,15 @@ describe('render', function() {
119120 } ) ;
120121
121122 test ( 'id' , async function ( ) {
122- const output = window . marked (
123- ""
124- ) ;
123+ const output = marked ( "" ) ;
125124
126125 expect ( output ) . toMatchInlineSnapshot (
127126 `"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" id=\\"someCssID\\" /></p>"`
128127 ) ;
129128 } ) ;
130129
131130 test ( 'no-zoom' , async function ( ) {
132- const output = window . marked ( "" ) ;
131+ const output = marked ( "" ) ;
133132
134133 expect ( output ) . toMatchInlineSnapshot (
135134 `"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" data-no-zoom /></p>"`
@@ -138,7 +137,7 @@ describe('render', function() {
138137
139138 describe ( 'size' , function ( ) {
140139 test ( 'width and height' , async function ( ) {
141- const output = window . marked (
140+ const output = marked (
142141 ""
143142 ) ;
144143
@@ -148,7 +147,7 @@ describe('render', function() {
148147 } ) ;
149148
150149 test ( 'width' , async function ( ) {
151- const output = window . marked ( "" ) ;
150+ const output = marked ( "" ) ;
152151
153152 expect ( output ) . toMatchInlineSnapshot (
154153 `"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" width=\\"50\\" /></p>"`
@@ -161,47 +160,47 @@ describe('render', function() {
161160 // ---------------------------------------------------------------------------
162161 describe ( 'headings' , function ( ) {
163162 test ( 'h1' , async function ( ) {
164- const output = window . marked ( '# h1 tag' ) ;
163+ const output = marked ( '# h1 tag' ) ;
165164
166165 expect ( output ) . toMatchInlineSnapshot (
167166 `"<h1 id=\\"h1-tag\\"><a href=\\"#/?id=h1-tag\\" data-id=\\"h1-tag\\" class=\\"anchor\\"><span>h1 tag</span></a></h1>"`
168167 ) ;
169168 } ) ;
170169
171170 test ( 'h2' , async function ( ) {
172- const output = window . marked ( '## h2 tag' ) ;
171+ const output = marked ( '## h2 tag' ) ;
173172
174173 expect ( output ) . toMatchInlineSnapshot (
175174 `"<h2 id=\\"h2-tag\\"><a href=\\"#/?id=h2-tag\\" data-id=\\"h2-tag\\" class=\\"anchor\\"><span>h2 tag</span></a></h2>"`
176175 ) ;
177176 } ) ;
178177
179178 test ( 'h3' , async function ( ) {
180- const output = window . marked ( '### h3 tag' ) ;
179+ const output = marked ( '### h3 tag' ) ;
181180
182181 expect ( output ) . toMatchInlineSnapshot (
183182 `"<h3 id=\\"h3-tag\\"><a href=\\"#/?id=h3-tag\\" data-id=\\"h3-tag\\" class=\\"anchor\\"><span>h3 tag</span></a></h3>"`
184183 ) ;
185184 } ) ;
186185
187186 test ( 'h4' , async function ( ) {
188- const output = window . marked ( '#### h4 tag' ) ;
187+ const output = marked ( '#### h4 tag' ) ;
189188
190189 expect ( output ) . toMatchInlineSnapshot (
191190 `"<h4 id=\\"h4-tag\\"><a href=\\"#/?id=h4-tag\\" data-id=\\"h4-tag\\" class=\\"anchor\\"><span>h4 tag</span></a></h4>"`
192191 ) ;
193192 } ) ;
194193
195194 test ( 'h5' , async function ( ) {
196- const output = window . marked ( '##### h5 tag' ) ;
195+ const output = marked ( '##### h5 tag' ) ;
197196
198197 expect ( output ) . toMatchInlineSnapshot (
199198 `"<h5 id=\\"h5-tag\\"><a href=\\"#/?id=h5-tag\\" data-id=\\"h5-tag\\" class=\\"anchor\\"><span>h5 tag</span></a></h5>"`
200199 ) ;
201200 } ) ;
202201
203202 test ( 'h6' , async function ( ) {
204- const output = window . marked ( '###### h6 tag' ) ;
203+ const output = marked ( '###### h6 tag' ) ;
205204
206205 expect ( output ) . toMatchInlineSnapshot (
207206 `"<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() {
211210
212211 describe ( 'link' , function ( ) {
213212 test ( 'regular' , async function ( ) {
214- const output = window . marked ( '[alt text](http://url)' ) ;
213+ const output = marked ( '[alt text](http://url)' ) ;
215214
216215 expect ( output ) . toMatchInlineSnapshot (
217216 `"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\">alt text</a></p>"`
@@ -223,41 +222,39 @@ describe('render', function() {
223222 // externalLinkTarget: '_blank',
224223 // externalLinkRel: 'noopener',
225224 // });
226- const output = window . marked ( '[alt text](http://www.example.com)' ) ;
225+ const output = marked ( '[alt text](http://www.example.com)' ) ;
227226
228227 expect ( output ) . toMatchInlineSnapshot (
229228 `"<p><a href=\\"http://www.example.com\\" target=\\"_blank\\" rel=\\"noopener\\">alt text</a></p>"`
230229 ) ;
231230 } ) ;
232231
233232 test ( 'disabled' , async function ( ) {
234- const output = window . marked ( "[alt text](http://url ':disabled')" ) ;
233+ const output = marked ( "[alt text](http://url ':disabled')" ) ;
235234
236235 expect ( output ) . toMatchInlineSnapshot (
237236 `"<p><a href=\\"javascript:void(0)\\" target=\\"_blank\\" rel=\\"noopener\\" disabled>alt text</a></p>"`
238237 ) ;
239238 } ) ;
240239
241240 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')" ) ;
243242
244243 expect ( output ) . toMatchInlineSnapshot (
245244 `"<p><a href=\\"http://url\\" target=\\"_self\\" >alt text</a></p>"`
246245 ) ;
247246 } ) ;
248247
249248 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')" ) ;
253250
254251 expect ( output ) . toMatchInlineSnapshot (
255252 `"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\" class=\\"someCssClass\\">alt text</a></p>"`
256253 ) ;
257254 } ) ;
258255
259256 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')" ) ;
261258
262259 expect ( output ) . toMatchInlineSnapshot (
263260 `"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\" id=\\"someCssID\\">alt text</a></p>"`
0 commit comments