@@ -2,103 +2,24 @@ import test from 'tape'
22import { u } from 'unist-builder'
33import { toHtml } from '../index.js'
44
5- test ( '`text `' , function ( t ) {
5+ test ( '`doctype `' , function ( t ) {
66 t . deepEqual (
77 toHtml ( u ( 'doctype' ) ) ,
8- '<!doctype>' ,
9- 'should serialize doctypes without `name`'
10- )
11-
12- t . deepEqual (
13- toHtml ( u ( 'doctype' , { name : 'html' } ) ) ,
148 '<!doctype html>' ,
15- 'should serialize doctypes with `name` '
9+ 'should serialize doctypes'
1610 )
1711
1812 t . deepEqual (
19- toHtml ( u ( 'doctype' , { name : 'html' } ) , { tightDoctype : true } ) ,
13+ toHtml ( u ( 'doctype' ) , { tightDoctype : true } ) ,
2014 '<!doctypehtml>' ,
21- 'should serialize doctypes with `name` tightly in `tightDoctype` mode'
15+ 'should serialize doctypes tightly in `tightDoctype` mode'
2216 )
2317
2418 t . deepEqual (
25- toHtml ( u ( 'doctype' , { name : 'html' } ) , { upperDoctype : true } ) ,
19+ toHtml ( u ( 'doctype' ) , { upperDoctype : true } ) ,
2620 '<!DOCTYPE html>' ,
2721 'should serialize uppercase doctypes in `upperDoctype` mode'
2822 )
2923
30- t . deepEqual (
31- toHtml (
32- u ( 'doctype' , {
33- name : 'html' ,
34- public : '-//W3C//DTD XHTML 1.0 Transitional//EN'
35- } )
36- ) ,
37- '<!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN">' ,
38- 'should serialize doctypes with a public identifier'
39- )
40-
41- t . deepEqual (
42- toHtml (
43- u ( 'doctype' , {
44- name : 'html' ,
45- public : '-//W3C//DTD XHTML 1.0 Transitional//EN'
46- } ) ,
47- { tightDoctype : true }
48- ) ,
49- '<!doctypehtml public"-//W3C//DTD XHTML 1.0 Transitional//EN">' ,
50- 'should serialize doctypes with a public identifier tightly in `tightDoctype` mode'
51- )
52-
53- t . deepEqual (
54- toHtml ( u ( 'doctype' , { name : 'html' , system : 'about:legacy-compat' } ) ) ,
55- '<!doctype html system "about:legacy-compat">' ,
56- 'should serialize doctypes with a system identifier'
57- )
58-
59- t . deepEqual (
60- toHtml ( u ( 'doctype' , { name : 'html' , system : 'about:legacy-compat' } ) , {
61- tightDoctype : true
62- } ) ,
63- '<!doctypehtml system"about:legacy-compat">' ,
64- 'should serialize doctypes with a system identifier tightly in `tightDoctype` mode'
65- )
66-
67- t . deepEqual (
68- toHtml (
69- u ( 'doctype' , {
70- name : 'html' ,
71- public : '-//W3C//DTD HTML 4.01//' ,
72- system : 'http://www.w3.org/TR/html4/strict.dtd'
73- } )
74- ) ,
75- '<!doctype html public "-//W3C//DTD HTML 4.01//" "http://www.w3.org/TR/html4/strict.dtd">' ,
76- 'should serialize doctypes with both identifiers'
77- )
78-
79- t . deepEqual (
80- toHtml (
81- u ( 'doctype' , {
82- name : 'html' ,
83- public : '-//W3C//DTD HTML 4.01//' ,
84- system : 'http://www.w3.org/TR/html4/strict.dtd'
85- } ) ,
86- { tightDoctype : true }
87- ) ,
88- '<!doctypehtml public"-//W3C//DTD HTML 4.01//""http://www.w3.org/TR/html4/strict.dtd">' ,
89- 'should serialize doctypes with both identifiers tightly in `tightDoctype` mode'
90- )
91-
92- t . deepEqual (
93- toHtml (
94- u ( 'doctype' , {
95- name : 'html' ,
96- system : 'taco"'
97- } )
98- ) ,
99- "<!doctype html system 'taco\"'>" ,
100- 'should quote smartly'
101- )
102-
10324 t . end ( )
10425} )
0 commit comments