Skip to content

Commit 0b0f098

Browse files
committed
test: for directives and tag
1 parent 3d7ef5a commit 0b0f098

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@ describe('PostHTML-Parser test', function() {
7474
expect(parser('<?php echo "Hello word"; ?>', customDirectives)).to.eql(['<?php echo "Hello word"; ?>']);
7575
});
7676

77+
it('should be parse directives and tag', function() {
78+
var customDirectives = {directives: [
79+
{name: '!doctype', start: '<', end: '>'},
80+
{name: '?php', start: '<', end: '>'}
81+
]};
82+
83+
var html = '<!doctype html><html><?php echo \"Hello word\"; ?></html>';
84+
var tree = [
85+
'<!doctype html>',
86+
{
87+
content: ['<?php echo \"Hello word\"; ?>'],
88+
tag: 'html'
89+
}
90+
];
91+
92+
expect(parser(html, customDirectives)).to.eql(tree);
93+
});
94+
7795
it('should be parse tag', function() {
7896
expect(parser('<html></html>')).to.eql([{ tag: 'html' }]);
7997
});

0 commit comments

Comments
 (0)