@@ -68,12 +68,30 @@ test.skip('should be parse tag with object in attribute data escape', t => {
68
68
t . deepEqual ( tree , expected ) ;
69
69
} ) ;
70
70
71
- test ( 'should be parse comment in content ' , t => {
71
+ test ( 'should be parse isolated comment ' , t => {
72
72
const tree = parser ( '<div><!--comment--></div>' ) ;
73
73
const expected = [ { tag : 'div' , content : [ '<!--comment-->' ] } ] ;
74
74
t . deepEqual ( tree , expected ) ;
75
75
} ) ;
76
76
77
+ test ( 'should be parse comment before text content' , t => {
78
+ const tree = parser ( '<div><!--comment-->Text after comment</div>' ) ;
79
+ const expected = [ { tag : 'div' , content : [ '<!--comment-->' , 'Text after comment' ] } ] ;
80
+ t . deepEqual ( tree , expected ) ;
81
+ } ) ;
82
+
83
+ test ( 'should be parse comment after text content' , t => {
84
+ const tree = parser ( '<div>Text before comment.<!--comment--></div>' ) ;
85
+ const expected = [ { tag : 'div' , content : [ 'Text before comment.' , '<!--comment-->' ] } ] ;
86
+ t . deepEqual ( tree , expected ) ;
87
+ } ) ;
88
+
89
+ test ( 'should be parse comment in the middle of text content' , t => {
90
+ const tree = parser ( '<div>Text surrounding <!--comment--> a comment.</div>' ) ;
91
+ const expected = [ { tag : 'div' , content : [ 'Text surrounding ' , '<!--comment-->' , ' a comment.' ] } ] ;
92
+ t . deepEqual ( tree , expected ) ;
93
+ } ) ;
94
+
77
95
test ( 'should be parse doctype' , t => {
78
96
const tree = parser ( '<!doctype html>' ) ;
79
97
const expected = [ '<!doctype html>' ] ;
0 commit comments