Skip to content

Commit 43ab5da

Browse files
committed
fix test texts & add test tag
1 parent d829aaa commit 43ab5da

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

test/test.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,29 @@ describe('PostHTML-Parser test', function() {
1212
expect(parser(html)).to.eql(tree);
1313
});
1414

15-
it('comment', function() {
15+
it('should be parse comment', function() {
16+
expect(parser('<!--comment-->')).to.eql(['<!--comment-->']);
17+
});
18+
19+
it('should be parse comment in content', function() {
1620
expect(parser('<div><!--comment--></div>')).to.eql([{tag: 'div', content: ['<!--comment-->']}]);
1721
});
1822

19-
it('last comment', function() {
20-
expect(parser('<!--comment-->')).to.eql(['<!--comment-->']);
23+
it('should be parse doctype', function() {
24+
expect(parser('<!doctype html>')).to.eql(['<!doctype html>']);
2125
});
2226

23-
it('doctype', function() {
27+
it('should be parse tag', function() {
28+
expect(parser('<html></html>')).to.eql([{ tag: 'html' }]);
29+
});
30+
31+
it('should be parse doctype and tag', function() {
2432
expect(parser('<!doctype html><html></html>')).to.eql(['<!doctype html>', { tag: 'html' }]);
2533
});
34+
35+
it('should be parse tag attrs', function() {
36+
expect(parser('<div id="id" class="class"></div>')).to.eql([{
37+
tag: 'div', attrs: { id: 'id', class: 'class'} }
38+
]);
39+
});
2640
});

0 commit comments

Comments
 (0)