@@ -371,5 +371,37 @@ describe('PostHTML Render', () => {
371
371
expect ( render ( fixture , options ) ) . to . eql ( expected ) ;
372
372
} ) ;
373
373
} ) ;
374
+
375
+ describe ( 'quoteStyle' , ( ) => {
376
+ it ( '1 - single quote' , ( ) => {
377
+ const options = { replaceQuote : false , quoteStyle : 1 } ;
378
+
379
+ const fixture = { tag : 'img' , attrs : { src : 'https://example.com/example.png' , onload : 'testFunc("test")' } } ;
380
+ const expected = '<img src=\'https://example.com/example.png\' onload=\'testFunc("test")\'>' ;
381
+
382
+ fs . writeFileSync ( 'test.html' , render ( fixture , options ) ) ;
383
+ expect ( render ( fixture , options ) ) . to . eql ( expected ) ;
384
+ } ) ;
385
+
386
+ it ( '2 - double quote' , ( ) => {
387
+ const options = { replaceQuote : false , quoteStyle : 2 } ;
388
+
389
+ const fixture = { tag : 'img' , attrs : { src : 'https://example.com/example.png' , onload : 'testFunc("test")' } } ;
390
+ const expected = '<img src="https://example.com/example.png" onload="testFunc("test")">' ;
391
+
392
+ fs . writeFileSync ( 'test.html' , render ( fixture , options ) ) ;
393
+ expect ( render ( fixture , options ) ) . to . eql ( expected ) ;
394
+ } ) ;
395
+
396
+ it ( '0 - smart quote' , ( ) => {
397
+ const options = { replaceQuote : false , quoteStyle : 0 } ;
398
+
399
+ const fixture = { tag : 'img' , attrs : { src : 'https://example.com/example.png' , onload : 'testFunc("test")' } } ;
400
+ const expected = '<img src="https://example.com/example.png" onload=\'testFunc("test")\'>' ;
401
+
402
+ fs . writeFileSync ( 'test.html' , render ( fixture , options ) ) ;
403
+ expect ( render ( fixture , options ) ) . to . eql ( expected ) ;
404
+ } ) ;
405
+ } ) ;
374
406
} ) ;
375
407
} ) ;
0 commit comments