@stencil/vitest 1.9.2 → 1.9.3
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.js +14 -14
- package/package.json +2 -2
package/dist/testing/render.js
CHANGED
|
@@ -172,19 +172,6 @@ export async function render(template, options = {
|
|
|
172
172
|
if (!element) {
|
|
173
173
|
throw new Error('Failed to render component');
|
|
174
174
|
}
|
|
175
|
-
// Wait for custom element to be defined
|
|
176
|
-
const tagName = element.tagName.toLowerCase();
|
|
177
|
-
if (tagName.includes('-')) {
|
|
178
|
-
await customElements.whenDefined(tagName);
|
|
179
|
-
}
|
|
180
|
-
// Wait for component to be ready
|
|
181
|
-
if (typeof element.componentOnReady === 'function') {
|
|
182
|
-
await element.componentOnReady();
|
|
183
|
-
}
|
|
184
|
-
// Clear per-render spy config after component is ready
|
|
185
|
-
if (options.spyOn) {
|
|
186
|
-
setRenderSpyConfig(null);
|
|
187
|
-
}
|
|
188
175
|
// Define waitForChanges first so we can use it in the ready check
|
|
189
176
|
function waitForChanges(documentElement = element) {
|
|
190
177
|
return new Promise((resolve) => {
|
|
@@ -219,11 +206,24 @@ export async function render(template, options = {
|
|
|
219
206
|
}
|
|
220
207
|
// Wait for component to be fully rendered if requested (default: true)
|
|
221
208
|
if (options.waitForReady !== false) {
|
|
209
|
+
// Wait for custom element to be defined
|
|
210
|
+
const tagName = element.tagName.toLowerCase();
|
|
211
|
+
if (tagName.includes('-')) {
|
|
212
|
+
await customElements.whenDefined(tagName);
|
|
213
|
+
}
|
|
214
|
+
// Wait for component to be ready
|
|
215
|
+
if (typeof element.componentOnReady === 'function') {
|
|
216
|
+
await element.componentOnReady();
|
|
217
|
+
}
|
|
222
218
|
// Wait for Stencil's hydration flag (skipped if hydration disabled)
|
|
223
219
|
await waitForHydrated(element);
|
|
224
|
-
//
|
|
220
|
+
// Wait for Stencil's update cycle to complete
|
|
225
221
|
await waitForChanges();
|
|
226
222
|
}
|
|
223
|
+
// Clear per-render spy config after component is ready
|
|
224
|
+
if (options.spyOn) {
|
|
225
|
+
setRenderSpyConfig(null);
|
|
226
|
+
}
|
|
227
227
|
const setProps = async (newProps) => {
|
|
228
228
|
Object.entries(newProps).forEach(([key, value]) => {
|
|
229
229
|
element[key] = value;
|
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.9.
|
|
7
|
+
"version": "1.9.3",
|
|
8
8
|
"description": "First-class testing utilities for Stencil design systems with Vitest",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"type": "module",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"jiti": "^2.6.1",
|
|
102
102
|
"local-pkg": "^1.1.2",
|
|
103
|
-
"vitest-environment-stencil": "1.9.
|
|
103
|
+
"vitest-environment-stencil": "1.9.3"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@eslint/js": "^9.39.2",
|