@@ -2,103 +2,24 @@ import test from 'tape'
2
2
import { u } from 'unist-builder'
3
3
import { toHtml } from '../index.js'
4
4
5
- test ( '`text `' , function ( t ) {
5
+ test ( '`doctype `' , function ( t ) {
6
6
t . deepEqual (
7
7
toHtml ( u ( 'doctype' ) ) ,
8
- '<!doctype>' ,
9
- 'should serialize doctypes without `name`'
10
- )
11
-
12
- t . deepEqual (
13
- toHtml ( u ( 'doctype' , { name : 'html' } ) ) ,
14
8
'<!doctype html>' ,
15
- 'should serialize doctypes with `name` '
9
+ 'should serialize doctypes'
16
10
)
17
11
18
12
t . deepEqual (
19
- toHtml ( u ( 'doctype' , { name : 'html' } ) , { tightDoctype : true } ) ,
13
+ toHtml ( u ( 'doctype' ) , { tightDoctype : true } ) ,
20
14
'<!doctypehtml>' ,
21
- 'should serialize doctypes with `name` tightly in `tightDoctype` mode'
15
+ 'should serialize doctypes tightly in `tightDoctype` mode'
22
16
)
23
17
24
18
t . deepEqual (
25
- toHtml ( u ( 'doctype' , { name : 'html' } ) , { upperDoctype : true } ) ,
19
+ toHtml ( u ( 'doctype' ) , { upperDoctype : true } ) ,
26
20
'<!DOCTYPE html>' ,
27
21
'should serialize uppercase doctypes in `upperDoctype` mode'
28
22
)
29
23
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
-
103
24
t . end ( )
104
25
} )
0 commit comments