@stencil/vitest 1.4.0 → 1.5.0
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.
package/dist/testing/render.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export declare function waitForStable(elementOrSelector: Element | string, timeo
|
|
|
28
28
|
*/
|
|
29
29
|
export declare function waitForExist(selector: string, timeout?: number): Promise<Element | null>;
|
|
30
30
|
/**
|
|
31
|
-
* Render using Stencil's render
|
|
31
|
+
* Render using Stencil's render or raw HTML template string
|
|
32
32
|
*/
|
|
33
|
-
export declare function render<T extends HTMLElement = HTMLElement, I = any>(
|
|
33
|
+
export declare function render<T extends HTMLElement = HTMLElement, I = any>(template: any | string, options?: RenderOptions): Promise<RenderResult<T, I>>;
|
|
34
34
|
export {};
|
|
35
35
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/testing/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,aAAa,CAAC;AAE1D,UAAU,aAAa;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAyBD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCtG;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAY5F;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,GAAG,GAAG,EACvE,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/testing/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,aAAa,CAAC;AAE1D,UAAU,aAAa;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAyBD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCtG;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAO,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAY5F;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,GAAG,GAAG,EACvE,QAAQ,EAAE,GAAG,GAAG,MAAM,EACtB,OAAO,GAAE,aAGR,GACA,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAkJ7B"}
|
package/dist/testing/render.js
CHANGED
|
@@ -71,9 +71,9 @@ export async function waitForExist(selector, timeout = 5000) {
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* Render using Stencil's render
|
|
74
|
+
* Render using Stencil's render or raw HTML template string
|
|
75
75
|
*/
|
|
76
|
-
export async function render(
|
|
76
|
+
export async function render(template, options = {
|
|
77
77
|
clearStage: true,
|
|
78
78
|
stageAttrs: { class: 'stencil-component-stage' },
|
|
79
79
|
}) {
|
|
@@ -87,8 +87,14 @@ export async function render(vnode, options = {
|
|
|
87
87
|
existingStages.forEach((stage) => stage.remove());
|
|
88
88
|
}
|
|
89
89
|
document.body.appendChild(container);
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
if (typeof template === 'string') {
|
|
91
|
+
// Handle string template - add as innerHTML
|
|
92
|
+
container.innerHTML = template;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// Use Stencil's render which handles VNodes properly in the browser
|
|
96
|
+
await stencilRender(template, container);
|
|
97
|
+
}
|
|
92
98
|
// Get the rendered element
|
|
93
99
|
const element = container.firstElementChild;
|
|
94
100
|
if (!element) {
|
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.
|
|
7
|
+
"version": "1.5.0",
|
|
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.
|
|
100
|
+
"vitest-environment-stencil": "1.5.0"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@eslint/js": "^9.39.2",
|