@@ -70,7 +70,7 @@ exports['Regression - new line in <pre> tag'] = function () {
70
70
} ;
71
71
72
72
exports [ 'Regression - escapeEntities option' ] = function ( ) {
73
- var testCases = [
73
+ var testHtmlCases = [
74
74
{
75
75
options : { encodeHtmlEntities : true } ,
76
76
src : '<!DOCTYPE html><html><head></head><body>&</body></html>' ,
@@ -85,7 +85,30 @@ exports['Regression - escapeEntities option'] = function () {
85
85
] ,
86
86
parser = new Parser ( ) ;
87
87
88
- testCases . forEach ( function ( testCase ) {
88
+ testHtmlCases . forEach ( function ( testCase ) {
89
+ var serializer = new Serializer ( null , testCase . options ) ;
90
+ var document = parser . parse ( testCase . src ) ,
91
+ serializedResult = serializer . serialize ( document ) ;
92
+
93
+ assert . strictEqual ( serializedResult , testCase . expected ) ;
94
+ } ) ;
95
+
96
+ var testAttributeCases = [
97
+ {
98
+ options : { encodeHtmlEntities : true } ,
99
+ src : '<!DOCTYPE html><html><head></head><body><a href="http://example.com?hello=1&world=2"></a></body></html>' ,
100
+ expected : '<!DOCTYPE html><html><head></head><body><a href="http://example.com?hello=1&world=2"></a></body></html>'
101
+ } ,
102
+
103
+ {
104
+ options : { encodeHtmlEntities : false } ,
105
+ src : '<!DOCTYPE html><html><head></head><body><a href="http://example.com?hello=1&world=2"></a></body></html>' ,
106
+ expected : '<!DOCTYPE html><html><head></head><body><a href="http://example.com?hello=1&world=2"></a></body></html>'
107
+ }
108
+ ] ,
109
+ parser = new Parser ( ) ;
110
+
111
+ testAttributeCases . forEach ( function ( testCase ) {
89
112
var serializer = new Serializer ( null , testCase . options ) ;
90
113
var document = parser . parse ( testCase . src ) ,
91
114
serializedResult = serializer . serialize ( document ) ;
0 commit comments