fix(webhelpers): improve browser test fixture to append element and await custom element upgrade and Lit update completion; add generic return type; update npm packaging release config; remove pnpm onlyBuiltDependencies
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-12-30 - 3.1.4 - fix(webhelpers)
|
||||||
|
improve browser test fixture to append element and await custom element upgrade and Lit update completion; add generic return type; update npm packaging release config; remove pnpm onlyBuiltDependencies
|
||||||
|
|
||||||
|
- ts_tapbundle/webhelpers.ts: make fixture generic and return T; append created element to document; await customElements.whenDefined for custom elements and await updateComplete for Lit/async components to ensure stable rendering in tests
|
||||||
|
- npmextra.json: add @git.zone/cli module metadata and release.registries/accessLevel; add @ship.zone/szci entry
|
||||||
|
- pnpm-workspace.yaml: remove onlyBuiltDependencies entries
|
||||||
|
|
||||||
## 2025-11-21 - 3.1.3 - fix(docs)
|
## 2025-11-21 - 3.1.3 - fix(docs)
|
||||||
Update package author and expand license/legal and issue-reporting information in tapbundle docs
|
Update package author and expand license/legal and issue-reporting information in tapbundle docs
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"@git.zone/cli": {
|
||||||
"npmGlobalTools": [],
|
|
||||||
"npmAccessLevel": "public"
|
|
||||||
},
|
|
||||||
"gitzone": {
|
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
@@ -12,6 +8,16 @@
|
|||||||
"description": "a test utility to run tests that match test/**/*.ts",
|
"description": "a test utility to run tests that match test/**/*.ts",
|
||||||
"npmPackagename": "@git.zone/tstest",
|
"npmPackagename": "@git.zone/tstest",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"registries": [
|
||||||
|
"https://verdaccio.lossless.digital",
|
||||||
|
"https://registry.npmjs.org"
|
||||||
|
],
|
||||||
|
"accessLevel": "public"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"@ship.zone/szci": {
|
||||||
|
"npmGlobalTools": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
onlyBuiltDependencies:
|
|
||||||
- esbuild
|
|
||||||
- mongodb-memory-server
|
|
||||||
- puppeteer
|
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tstest',
|
name: '@git.zone/tstest',
|
||||||
version: '3.1.3',
|
version: '3.1.4',
|
||||||
description: 'a test utility to run tests that match test/**/*.ts'
|
description: 'a test utility to run tests that match test/**/*.ts'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,24 @@ class WebHelpers {
|
|||||||
|
|
||||||
// Initialize fixture function based on environment
|
// Initialize fixture function based on environment
|
||||||
if (smartenv.isBrowser) {
|
if (smartenv.isBrowser) {
|
||||||
this.fixture = async (htmlString: string): Promise<HTMLElement> => {
|
this.fixture = async <T extends HTMLElement>(htmlString: string): Promise<T> => {
|
||||||
const container = document.createElement('div');
|
const container = document.createElement('div');
|
||||||
container.innerHTML = htmlString.trim();
|
container.innerHTML = htmlString.trim();
|
||||||
const element = container.firstChild as HTMLElement;
|
const element = container.firstElementChild as T;
|
||||||
|
|
||||||
|
// Append to document so custom elements upgrade and lifecycle hooks fire
|
||||||
|
document.body.appendChild(element);
|
||||||
|
|
||||||
|
// Wait for custom element definition if it's a custom element
|
||||||
|
if (element.localName.includes('-')) {
|
||||||
|
await customElements.whenDefined(element.localName).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for Lit/async components to finish rendering
|
||||||
|
if ((element as any).updateComplete) {
|
||||||
|
await (element as any).updateComplete;
|
||||||
|
}
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user