File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 42
42
},
43
43
"devDependencies" : {
44
44
"browserify" : " ^16.0.0" ,
45
+ "mdast-util-from-markdown" : " ^0.7.0" ,
45
46
"nyc" : " ^15.0.0" ,
46
47
"prettier" : " ^2.0.0" ,
47
48
"remark-cli" : " ^8.0.0" ,
Original file line number Diff line number Diff line change 1
1
var test = require ( 'tape' )
2
+ var from = require ( 'mdast-util-from-markdown' )
2
3
var to = require ( '.' )
3
4
4
5
test ( 'mdast-util-to-markdown' , function ( t ) {
@@ -2384,3 +2385,47 @@ test('escape', function (t) {
2384
2385
2385
2386
t . end ( )
2386
2387
} )
2388
+
2389
+ test ( 'roundtrip' , function ( t ) {
2390
+ var doc = [
2391
+ '> * Lorem ipsum dolor sit amet' ,
2392
+ '>' ,
2393
+ '> * consectetur adipisicing elit'
2394
+ ] . join ( '\n' )
2395
+
2396
+ t . equal ( to ( from ( doc ) ) , doc , 'should roundtrip spread items in block quotes' )
2397
+
2398
+ doc = [
2399
+ '* Lorem ipsum dolor sit amet' ,
2400
+ '' ,
2401
+ ' 1. consectetur adipisicing elit' ,
2402
+ '' ,
2403
+ ' 2. sed do eiusmod tempor incididunt'
2404
+ ] . join ( '\n' )
2405
+
2406
+ t . equal ( to ( from ( doc ) ) , doc , 'should roundtrip spread items in sublists (1)' )
2407
+
2408
+ doc = [
2409
+ '* 1. Lorem ipsum dolor sit amet' ,
2410
+ '' ,
2411
+ ' 2. consectetur adipisicing elit'
2412
+ ] . join ( '\n' )
2413
+
2414
+ t . equal ( to ( from ( doc ) ) , doc , 'should roundtrip spread items in sublists (2)' )
2415
+
2416
+ doc = [
2417
+ '* hello' ,
2418
+ ' * world' ,
2419
+ ' how' ,
2420
+ '' ,
2421
+ ' are' ,
2422
+ ' you' ,
2423
+ '' ,
2424
+ ' * today' ,
2425
+ '* hi'
2426
+ ] . join ( '\n' )
2427
+
2428
+ t . equal ( to ( from ( doc ) ) , doc , 'should roundtrip spread items in sublists (3)' )
2429
+
2430
+ t . end ( )
2431
+ } )
You can’t perform that action at this time.
0 commit comments