@stencil/vitest 1.1.15 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-serializer.d.ts","sourceRoot":"","sources":["../../src/testing/html-serializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"html-serializer.d.ts","sourceRoot":"","sources":["../../src/testing/html-serializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkCH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,gBAAgB,GAAG,MAAM,EAC3D,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAWR;AAqHD;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkDjD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
* Shared HTML serialization utilities for Stencil components
|
|
3
3
|
* Used by both matchers and snapshot serializers
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* HTML void elements (self-closing tags) that don't have closing tags
|
|
7
|
+
*/
|
|
8
|
+
const VOID_ELEMENTS = new Set([
|
|
9
|
+
'area',
|
|
10
|
+
'base',
|
|
11
|
+
'br',
|
|
12
|
+
'col',
|
|
13
|
+
'embed',
|
|
14
|
+
'hr',
|
|
15
|
+
'img',
|
|
16
|
+
'input',
|
|
17
|
+
'link',
|
|
18
|
+
'meta',
|
|
19
|
+
'param',
|
|
20
|
+
'source',
|
|
21
|
+
'track',
|
|
22
|
+
'wbr',
|
|
23
|
+
]);
|
|
5
24
|
/**
|
|
6
25
|
* Serialize HTML element to string
|
|
7
26
|
* Works across mock-doc, jsdom, and happy-dom environments
|
|
@@ -37,6 +56,10 @@ function serializeElementWithShadow(element, excludeStyles, serializeShadowRoot
|
|
|
37
56
|
if (text)
|
|
38
57
|
html += text;
|
|
39
58
|
}
|
|
59
|
+
else if (child.nodeType === 8 && !!child.textContent) {
|
|
60
|
+
// Comment node
|
|
61
|
+
html += `<!--${child.textContent}-->`;
|
|
62
|
+
}
|
|
40
63
|
}
|
|
41
64
|
return html;
|
|
42
65
|
}
|
|
@@ -83,6 +106,10 @@ function serializeElementWithShadow(element, excludeStyles, serializeShadowRoot
|
|
|
83
106
|
if (text)
|
|
84
107
|
html += text;
|
|
85
108
|
}
|
|
109
|
+
else if (child.nodeType === 8 && !!child.textContent) {
|
|
110
|
+
// Comment node
|
|
111
|
+
html += `<!--${child.textContent}-->`;
|
|
112
|
+
}
|
|
86
113
|
}
|
|
87
114
|
html += '</mock:shadow-root>';
|
|
88
115
|
}
|
|
@@ -107,8 +134,15 @@ function serializeElementWithShadow(element, excludeStyles, serializeShadowRoot
|
|
|
107
134
|
if (text)
|
|
108
135
|
html += text;
|
|
109
136
|
}
|
|
137
|
+
else if (child.nodeType === 8 && !!child.textContent) {
|
|
138
|
+
// Comment node
|
|
139
|
+
html += `<!--${child.textContent}-->`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Void elements don't have closing tags
|
|
143
|
+
if (!VOID_ELEMENTS.has(tagName)) {
|
|
144
|
+
html += `</${tagName}>`;
|
|
110
145
|
}
|
|
111
|
-
html += `</${tagName}>`;
|
|
112
146
|
return html;
|
|
113
147
|
}
|
|
114
148
|
/**
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/stenciljs/vitest"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.1.
|
|
7
|
+
"version": "1.1.17",
|
|
8
8
|
"description": "First-class testing utilities for Stencil design systems with Vitest",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"type": "module",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"jiti": "^2.6.1",
|
|
99
99
|
"local-pkg": "^1.1.2",
|
|
100
|
-
"vitest-environment-stencil": "1.1.
|
|
100
|
+
"vitest-environment-stencil": "1.1.17"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@eslint/js": "^9.39.2",
|