@@ -68,12 +68,30 @@ test.skip('should be parse tag with object in attribute data escape', t => {
6868 t . deepEqual ( tree , expected ) ;
6969} ) ;
7070
71- test ( 'should be parse comment in content ' , t => {
71+ test ( 'should be parse isolated comment ' , t => {
7272 const tree = parser ( '<div><!--comment--></div>' ) ;
7373 const expected = [ { tag : 'div' , content : [ '<!--comment-->' ] } ] ;
7474 t . deepEqual ( tree , expected ) ;
7575} ) ;
7676
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+
7795test ( 'should be parse doctype' , t => {
7896 const tree = parser ( '<!doctype html>' ) ;
7997 const expected = [ '<!doctype html>' ] ;
0 commit comments