推进 INI 面板 shell handoff mount DOM contract helper
This commit is contained in:
@@ -30,7 +30,8 @@ import {
|
||||
createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
|
||||
createIniPanelShellSessionHandoffPackageMountRenderState,
|
||||
createIniPanelShellSessionHandoffPackageMountState,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
createIniPanelShellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
@@ -226,11 +227,20 @@ when an outer shell needs mount-state checks as stable read-only label/value
|
||||
rows. Use `createIniPanelShellSessionHandoffPackageMountRenderState()` or
|
||||
`linuxCncIniPanelLaunchApi.getShellSessionHandoffPackageMountRenderState()`
|
||||
when those rows need a status line and `[data-handoff-shell]` style dataset
|
||||
flags for DOM rendering. Use `renderIniPanelShellSessionHandoffMountState()` or
|
||||
flags for DOM rendering. Use
|
||||
`createIniPanelShellSessionHandoffMountDomContract()` or
|
||||
`linuxCncIniPanelLaunchApi.getShellSessionHandoffMountDomContract()` when an
|
||||
outer shell needs the required mount/status/rows selectors, mount dataset keys,
|
||||
row dataset keys, and render-result fields before rendering into shell-owned
|
||||
DOM. Use `createIniPanelShellSessionHandoffMountDomReadiness()` or
|
||||
`linuxCncIniPanelLaunchApi.getShellSessionHandoffMountDomReadiness()` to check
|
||||
that the required document and nodes exist before calling the renderer. Use
|
||||
`renderIniPanelShellSessionHandoffMountState()` or
|
||||
`linuxCncIniPanelLaunchApi.renderShellSessionHandoffMountState()` when an outer
|
||||
shell needs the shared read-only DOM renderer for those rows. The launch page renders the default waiting mount
|
||||
state into `[data-handoff-mount]`, `[data-handoff-mount-status]`, and
|
||||
`[data-handoff-mount-rows]` without opening the control page.
|
||||
shell needs the shared read-only DOM renderer for those rows. The launch page
|
||||
renders the default waiting mount state into `[data-handoff-mount]`,
|
||||
`[data-handoff-mount-status]`, and `[data-handoff-mount-rows]` without opening
|
||||
the control page.
|
||||
The browser workflow smoke
|
||||
`tests/browser/ini_panel_shell_integration_workflow_smoke.html` verifies the
|
||||
same external shell handoff: read integration manifest, pass readiness gate,
|
||||
|
||||
@@ -106,6 +106,8 @@
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createIniPanelShellViewModel,
|
||||
isSupportedIniPanelLaunchApiManifest,
|
||||
createIniPanelShellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
} from "./ui-shell.js";
|
||||
|
||||
@@ -180,6 +182,12 @@
|
||||
),
|
||||
)
|
||||
),
|
||||
getShellSessionHandoffMountDomContract: (options) => (
|
||||
createIniPanelShellSessionHandoffMountDomContract(options)
|
||||
),
|
||||
getShellSessionHandoffMountDomReadiness: (options) => (
|
||||
createIniPanelShellSessionHandoffMountDomReadiness(options ?? { documentRef: document })
|
||||
),
|
||||
renderShellSessionHandoffMountState: (renderState, options) => (
|
||||
renderIniPanelShellSessionHandoffMountState(renderState, options ?? { documentRef: document })
|
||||
),
|
||||
|
||||
@@ -143,6 +143,8 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"getShellSessionHandoffPackageMountState",
|
||||
"getShellSessionHandoffPackageMountDisplayViewModel",
|
||||
"getShellSessionHandoffPackageMountRenderState",
|
||||
"getShellSessionHandoffMountDomContract",
|
||||
"getShellSessionHandoffMountDomReadiness",
|
||||
"renderShellSessionHandoffMountState",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
@@ -1079,21 +1081,85 @@ export function createIniPanelShellSessionHandoffPackageMountRenderState(
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffMountDomContract({
|
||||
rowDatasetPrefix = "handoffMount",
|
||||
selectors = {},
|
||||
} = {}) {
|
||||
const mountSelector = selectors.mount ?? "[data-handoff-mount]";
|
||||
const statusSelector = selectors.status ?? "[data-handoff-mount-status]";
|
||||
const rowsSelector = selectors.rows ?? "[data-handoff-mount-rows]";
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-dom-contract",
|
||||
contractVersion: 1,
|
||||
requiredNodeIds: ["mount", "status", "rows"],
|
||||
selectors: {
|
||||
mount: mountSelector,
|
||||
status: statusSelector,
|
||||
rows: rowsSelector,
|
||||
},
|
||||
mountDatasetKeys: ["handoffPhase", "handoffReady", "handoffScope"],
|
||||
rowDatasetPrefix,
|
||||
rowDatasetKeys: {
|
||||
term: [`${rowDatasetPrefix}Row`, `${rowDatasetPrefix}Status`],
|
||||
detail: [`${rowDatasetPrefix}Value`, `${rowDatasetPrefix}Status`],
|
||||
},
|
||||
renderResultFields: ["rendered", "statusLine", "rowCount", "rowIds", "dataset"],
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffMountDomReadiness({
|
||||
rowDatasetPrefix = "handoffMount",
|
||||
contract = createIniPanelShellSessionHandoffMountDomContract({ rowDatasetPrefix }),
|
||||
documentRef = globalThis.document,
|
||||
mountNode = documentRef?.querySelector?.(contract.selectors.mount),
|
||||
statusNode = documentRef?.querySelector?.(contract.selectors.status),
|
||||
rowsNode = documentRef?.querySelector?.(contract.selectors.rows),
|
||||
} = {}) {
|
||||
const checks = {
|
||||
document: Boolean(documentRef?.createElement),
|
||||
mount: Boolean(mountNode),
|
||||
status: Boolean(statusNode),
|
||||
rows: Boolean(rowsNode),
|
||||
rowDatasetPrefix: Boolean(contract.rowDatasetPrefix),
|
||||
};
|
||||
const missing = Object.entries(checks)
|
||||
.filter(([, passed]) => !passed)
|
||||
.map(([name]) => name);
|
||||
const ready = missing.length === 0;
|
||||
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-dom-readiness",
|
||||
readinessVersion: 1,
|
||||
phase: ready ? "ready" : "blocked",
|
||||
ready,
|
||||
missing,
|
||||
checks,
|
||||
contract,
|
||||
};
|
||||
}
|
||||
|
||||
export function renderIniPanelShellSessionHandoffMountState(
|
||||
renderState = createIniPanelShellSessionHandoffPackageMountRenderState(),
|
||||
{
|
||||
documentRef = globalThis.document,
|
||||
mountNode = documentRef?.querySelector?.("[data-handoff-mount]"),
|
||||
statusNode = documentRef?.querySelector?.("[data-handoff-mount-status]"),
|
||||
rowsNode = documentRef?.querySelector?.("[data-handoff-mount-rows]"),
|
||||
rowDatasetPrefix = "handoffMount",
|
||||
contract = createIniPanelShellSessionHandoffMountDomContract({ rowDatasetPrefix }),
|
||||
documentRef = globalThis.document,
|
||||
mountNode = documentRef?.querySelector?.(contract.selectors.mount),
|
||||
statusNode = documentRef?.querySelector?.(contract.selectors.status),
|
||||
rowsNode = documentRef?.querySelector?.(contract.selectors.rows),
|
||||
} = {},
|
||||
) {
|
||||
if (!documentRef?.createElement) {
|
||||
throw new Error("A DOM document is required to render shell handoff mount state.");
|
||||
}
|
||||
if (!mountNode || !statusNode || !rowsNode) {
|
||||
throw new Error("Mount, status, and rows nodes are required to render shell handoff mount state.");
|
||||
const readiness = createIniPanelShellSessionHandoffMountDomReadiness({
|
||||
contract,
|
||||
documentRef,
|
||||
mountNode,
|
||||
statusNode,
|
||||
rowsNode,
|
||||
});
|
||||
if (!readiness.ready) {
|
||||
throw new Error(
|
||||
`Shell handoff mount DOM is not ready: ${readiness.missing.join(", ")}`,
|
||||
);
|
||||
}
|
||||
|
||||
mountNode.dataset.handoffPhase = renderState?.dataset?.handoffPhase ?? "blocked";
|
||||
@@ -1103,14 +1169,15 @@ export function renderIniPanelShellSessionHandoffMountState(
|
||||
rowsNode.replaceChildren();
|
||||
|
||||
const rows = Array.isArray(renderState?.rows) ? renderState.rows : [];
|
||||
const effectiveRowDatasetPrefix = contract.rowDatasetPrefix;
|
||||
for (const row of rows) {
|
||||
const term = documentRef.createElement("dt");
|
||||
term.dataset[`${rowDatasetPrefix}Row`] = row.id;
|
||||
term.dataset[`${rowDatasetPrefix}Status`] = row.status;
|
||||
term.dataset[`${effectiveRowDatasetPrefix}Row`] = row.id;
|
||||
term.dataset[`${effectiveRowDatasetPrefix}Status`] = row.status;
|
||||
term.textContent = row.label;
|
||||
const detail = documentRef.createElement("dd");
|
||||
detail.dataset[`${rowDatasetPrefix}Value`] = row.id;
|
||||
detail.dataset[`${rowDatasetPrefix}Status`] = row.status;
|
||||
detail.dataset[`${effectiveRowDatasetPrefix}Value`] = row.id;
|
||||
detail.dataset[`${effectiveRowDatasetPrefix}Status`] = row.status;
|
||||
detail.textContent = row.value;
|
||||
rowsNode.append(term, detail);
|
||||
}
|
||||
@@ -1191,6 +1258,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
const shellSessionHandoffPackageMountRenderState = createIniPanelShellSessionHandoffPackageMountRenderState(
|
||||
shellSessionHandoffPackageMountDisplayViewModel,
|
||||
);
|
||||
const shellSessionHandoffMountDomContract = createIniPanelShellSessionHandoffMountDomContract();
|
||||
return {
|
||||
pages: entries.map(({ id, href, title }) => ({
|
||||
id,
|
||||
@@ -1218,6 +1286,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffPackageMountState,
|
||||
shellSessionHandoffPackageMountDisplayViewModel,
|
||||
shellSessionHandoffPackageMountRenderState,
|
||||
shellSessionHandoffMountDomContract,
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
@@ -1240,6 +1309,8 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
createShellSessionHandoffPackageMountState: createIniPanelShellSessionHandoffPackageMountState,
|
||||
createShellSessionHandoffPackageMountDisplayViewModel: createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
|
||||
createShellSessionHandoffPackageMountRenderState: createIniPanelShellSessionHandoffPackageMountRenderState,
|
||||
createShellSessionHandoffMountDomContract: createIniPanelShellSessionHandoffMountDomContract,
|
||||
createShellSessionHandoffMountDomReadiness: createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
renderShellSessionHandoffMountState: renderIniPanelShellSessionHandoffMountState,
|
||||
isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage,
|
||||
controlPage: {
|
||||
|
||||
@@ -85,6 +85,8 @@ TOOL_TABLE = browser-shell-tool.tbl
|
||||
!launchApi?.getShellSessionHandoffPackageMountState ||
|
||||
!launchApi?.getShellSessionHandoffPackageMountDisplayViewModel ||
|
||||
!launchApi?.getShellSessionHandoffPackageMountRenderState ||
|
||||
!launchApi?.getShellSessionHandoffMountDomContract ||
|
||||
!launchApi?.getShellSessionHandoffMountDomReadiness ||
|
||||
!launchApi?.renderShellSessionHandoffMountState ||
|
||||
!launchApi?.isSupportedShellSessionHandoffPackage
|
||||
) {
|
||||
@@ -109,16 +111,27 @@ TOOL_TABLE = browser-shell-tool.tbl
|
||||
const handoffPackageMountState = launchApi.getShellSessionHandoffPackageMountState();
|
||||
const handoffPackageMountDisplay = launchApi.getShellSessionHandoffPackageMountDisplayViewModel();
|
||||
const handoffPackageMountRenderState = launchApi.getShellSessionHandoffPackageMountRenderState();
|
||||
const externalMountDomContract = launchApi.getShellSessionHandoffMountDomContract({
|
||||
rowDatasetPrefix: "externalMount",
|
||||
selectors: {
|
||||
mount: "[data-external-shell-mount]",
|
||||
status: "[data-external-shell-mount-status]",
|
||||
rows: "[data-external-shell-mount-rows]",
|
||||
},
|
||||
});
|
||||
const externalMountDomReadiness = launchApi.getShellSessionHandoffMountDomReadiness({
|
||||
contract: externalMountDomContract,
|
||||
documentRef: document,
|
||||
});
|
||||
const waitingMountRenderResult = launchApi.renderShellSessionHandoffMountState(
|
||||
handoffPackageMountRenderState,
|
||||
{
|
||||
contract: externalMountDomContract,
|
||||
documentRef: document,
|
||||
mountNode: document.querySelector("[data-external-shell-mount]"),
|
||||
statusNode: document.querySelector("[data-external-shell-mount-status]"),
|
||||
rowsNode: document.querySelector("[data-external-shell-mount-rows]"),
|
||||
rowDatasetPrefix: "externalMount",
|
||||
},
|
||||
);
|
||||
assertEqual(externalMountDomContract.rowDatasetPrefix, "externalMount", "external shell mount DOM contract prefix");
|
||||
assertEqual(externalMountDomReadiness.ready, true, "external shell mount DOM readiness");
|
||||
assertEqual(handoffSummarySchema.summaryVersion, 1, "shell handoff summary schema version");
|
||||
assertEqual(
|
||||
launchApi.isSupportedShellSessionHandoffSummary(handoffSummary),
|
||||
@@ -280,11 +293,8 @@ TOOL_TABLE = browser-shell-tool.tbl
|
||||
const readyMountRenderResult = launchApi.renderShellSessionHandoffMountState(
|
||||
readyMountRenderState,
|
||||
{
|
||||
contract: externalMountDomContract,
|
||||
documentRef: document,
|
||||
mountNode: document.querySelector("[data-external-shell-mount]"),
|
||||
statusNode: document.querySelector("[data-external-shell-mount-status]"),
|
||||
rowsNode: document.querySelector("[data-external-shell-mount-rows]"),
|
||||
rowDatasetPrefix: "externalMount",
|
||||
},
|
||||
);
|
||||
assertEqual(readyMountState.ready, true, "shell handoff package mount-state readiness");
|
||||
|
||||
@@ -27,6 +27,8 @@ import {
|
||||
createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
|
||||
createIniPanelShellSessionHandoffPackageMountRenderState,
|
||||
createIniPanelShellSessionHandoffPackageMountState,
|
||||
createIniPanelShellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
@@ -93,6 +95,8 @@ const requiredShellExports = [
|
||||
"createIniPanelShellSessionHandoffPackageMountDisplayViewModel",
|
||||
"createIniPanelShellSessionHandoffPackageMountRenderState",
|
||||
"createIniPanelShellSessionHandoffPackageMountState",
|
||||
"createIniPanelShellSessionHandoffMountDomContract",
|
||||
"createIniPanelShellSessionHandoffMountDomReadiness",
|
||||
"renderIniPanelShellSessionHandoffMountState",
|
||||
"createIniPanelShellSessionHandoffPackageReport",
|
||||
"createIniPanelShellSessionHandoffPackageRenderState",
|
||||
@@ -279,6 +283,14 @@ assert.deepEqual(
|
||||
createIniPanelShellViewModel().shellSessionHandoffPackageMountDisplayViewModel,
|
||||
),
|
||||
);
|
||||
assert.deepEqual(
|
||||
createIniPanelShellViewModel().shellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomContract(),
|
||||
);
|
||||
assert.equal(
|
||||
createIniPanelShellSessionHandoffMountDomReadiness({ documentRef: null }).ready,
|
||||
false,
|
||||
);
|
||||
assert.equal(isSupportedIniPanelShellSessionHandoffPackage(createIniPanelShellViewModel().shellSessionHandoffPackage), true);
|
||||
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
|
||||
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
|
||||
@@ -436,6 +448,8 @@ assert.match(docText, /\bdata-handoff-rows\b/);
|
||||
assert.match(docText, /\bdata-external-shell-mount\b/);
|
||||
assert.match(docText, /\brenderIniPanelShellSessionHandoffMountState\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.renderShellSessionHandoffMountState\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffMountDomContract\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffMountDomReadiness\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
|
||||
assert.match(docText, /\bini_panel_shell_integration_workflow_smoke\.html\b/);
|
||||
assert.match(browserIniPanelText, /\bini_panel_shell_integration_workflow_smoke\.html\b/);
|
||||
@@ -452,6 +466,8 @@ assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffPackage
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffPackage\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffPackageReport\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffPackageMountRenderState\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffMountDomContract\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffMountDomReadiness\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\brenderShellSessionHandoffMountState\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-shell-mount\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-mount-value\b/);
|
||||
|
||||
@@ -63,6 +63,8 @@ assert.deepEqual(manifest, {
|
||||
"getShellSessionHandoffPackageMountState",
|
||||
"getShellSessionHandoffPackageMountDisplayViewModel",
|
||||
"getShellSessionHandoffPackageMountRenderState",
|
||||
"getShellSessionHandoffMountDomContract",
|
||||
"getShellSessionHandoffMountDomReadiness",
|
||||
"renderShellSessionHandoffMountState",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
@@ -182,6 +184,8 @@ assert.match(launchText, /\bgetShellSessionHandoffPackageRenderState\b/);
|
||||
assert.match(launchText, /\bgetShellSessionHandoffPackageMountState\b/);
|
||||
assert.match(launchText, /\bgetShellSessionHandoffPackageMountDisplayViewModel\b/);
|
||||
assert.match(launchText, /\bgetShellSessionHandoffPackageMountRenderState\b/);
|
||||
assert.match(launchText, /\bgetShellSessionHandoffMountDomContract\b/);
|
||||
assert.match(launchText, /\bgetShellSessionHandoffMountDomReadiness\b/);
|
||||
assert.match(launchText, /\brenderShellSessionHandoffMountState\b/);
|
||||
assert.match(launchText, /\bisSupportedShellSessionHandoffPackage\b/);
|
||||
assert.match(launchText, /\bdata-handoff-mount\b/);
|
||||
|
||||
@@ -23,6 +23,8 @@ import {
|
||||
createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
|
||||
createIniPanelShellSessionHandoffPackageMountRenderState,
|
||||
createIniPanelShellSessionHandoffPackageMountState,
|
||||
createIniPanelShellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
createIniPanelShellSessionHandoffPackageSchema,
|
||||
@@ -93,6 +95,7 @@ const handoffPackageMountDisplayViewModel = createIniPanelShellSessionHandoffPac
|
||||
const handoffPackageMountRenderState = createIniPanelShellSessionHandoffPackageMountRenderState(
|
||||
handoffPackageMountDisplayViewModel,
|
||||
);
|
||||
const handoffMountDomContract = createIniPanelShellSessionHandoffMountDomContract();
|
||||
|
||||
assert.deepEqual(schema, {
|
||||
apiName: "ini-panel-shell-integration",
|
||||
@@ -148,7 +151,7 @@ assert.deepEqual(readiness, {
|
||||
counts: {
|
||||
pages: 2,
|
||||
launcherLinks: 2,
|
||||
launchMethods: 27,
|
||||
launchMethods: 29,
|
||||
controlPageMethods: 11,
|
||||
persistenceCapabilities: 3,
|
||||
},
|
||||
@@ -210,7 +213,7 @@ assert.deepEqual(handoffSummary, {
|
||||
counts: {
|
||||
pages: 2,
|
||||
launcherLinks: 2,
|
||||
launchMethods: 27,
|
||||
launchMethods: 29,
|
||||
controlPageMethods: 11,
|
||||
persistenceCapabilities: 3,
|
||||
},
|
||||
@@ -666,6 +669,38 @@ assert.deepEqual(handoffPackageMountRenderState, {
|
||||
handoffScope: "mount",
|
||||
},
|
||||
});
|
||||
assert.deepEqual(handoffMountDomContract, {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-dom-contract",
|
||||
contractVersion: 1,
|
||||
requiredNodeIds: ["mount", "status", "rows"],
|
||||
selectors: {
|
||||
mount: "[data-handoff-mount]",
|
||||
status: "[data-handoff-mount-status]",
|
||||
rows: "[data-handoff-mount-rows]",
|
||||
},
|
||||
mountDatasetKeys: ["handoffPhase", "handoffReady", "handoffScope"],
|
||||
rowDatasetPrefix: "handoffMount",
|
||||
rowDatasetKeys: {
|
||||
term: ["handoffMountRow", "handoffMountStatus"],
|
||||
detail: ["handoffMountValue", "handoffMountStatus"],
|
||||
},
|
||||
renderResultFields: ["rendered", "statusLine", "rowCount", "rowIds", "dataset"],
|
||||
});
|
||||
assert.deepEqual(createIniPanelShellSessionHandoffMountDomReadiness({ documentRef: null }), {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-dom-readiness",
|
||||
readinessVersion: 1,
|
||||
phase: "blocked",
|
||||
ready: false,
|
||||
missing: ["document", "mount", "status", "rows"],
|
||||
checks: {
|
||||
document: false,
|
||||
mount: false,
|
||||
status: false,
|
||||
rows: false,
|
||||
rowDatasetPrefix: true,
|
||||
},
|
||||
contract: handoffMountDomContract,
|
||||
});
|
||||
assert.deepEqual(
|
||||
createIniPanelShellSessionHandoffPackageMountState({
|
||||
handoffPackage,
|
||||
@@ -1077,7 +1112,7 @@ assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
|
||||
counts: {
|
||||
pages: 2,
|
||||
launcherLinks: 2,
|
||||
launchMethods: 27,
|
||||
launchMethods: 29,
|
||||
controlPageMethods: 11,
|
||||
persistenceCapabilities: 3,
|
||||
},
|
||||
@@ -1246,6 +1281,8 @@ assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPack
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageMountDisplayViewModel\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageMountRenderState\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageMountState\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffMountDomContract\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffMountDomReadiness\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageReport\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageRenderState\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageSchema\b/);
|
||||
@@ -1271,6 +1308,8 @@ assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageDisplayViewMode
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageMountDisplayViewModel\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageMountRenderState\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageMountState\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffMountDomContract\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffMountDomReadiness\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageReport\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageRenderState\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageSchema\b/);
|
||||
|
||||
@@ -23,6 +23,8 @@ import {
|
||||
createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
|
||||
createIniPanelShellSessionHandoffPackageMountRenderState,
|
||||
createIniPanelShellSessionHandoffPackageMountState,
|
||||
createIniPanelShellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
@@ -94,6 +96,8 @@ assert.equal(typeof createIniPanelShellSessionHandoffPackageDisplayViewModel, "f
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffPackageMountDisplayViewModel, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffPackageMountRenderState, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffPackageMountState, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffMountDomContract, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffMountDomReadiness, "function");
|
||||
assert.equal(typeof renderIniPanelShellSessionHandoffMountState, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffPackageReport, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffPackageRenderState, "function");
|
||||
@@ -247,6 +251,10 @@ assert.deepEqual(
|
||||
shellViewModel.shellSessionHandoffPackageMountDisplayViewModel,
|
||||
),
|
||||
);
|
||||
assert.deepEqual(
|
||||
shellViewModel.shellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomContract(),
|
||||
);
|
||||
assert.equal(isSupportedIniPanelShellSessionHandoffPackage(shellViewModel.shellSessionHandoffPackage), true);
|
||||
assert.deepEqual(shellViewModel.shellSessionHandoffDisplayViewModel, {
|
||||
phase: "ready",
|
||||
@@ -566,6 +574,23 @@ assert.deepEqual(shellViewModel.shellSessionHandoffPackageMountRenderState, {
|
||||
handoffScope: "mount",
|
||||
},
|
||||
});
|
||||
assert.deepEqual(shellViewModel.shellSessionHandoffMountDomContract, {
|
||||
apiName: "ini-panel-shell-session-handoff-mount-dom-contract",
|
||||
contractVersion: 1,
|
||||
requiredNodeIds: ["mount", "status", "rows"],
|
||||
selectors: {
|
||||
mount: "[data-handoff-mount]",
|
||||
status: "[data-handoff-mount-status]",
|
||||
rows: "[data-handoff-mount-rows]",
|
||||
},
|
||||
mountDatasetKeys: ["handoffPhase", "handoffReady", "handoffScope"],
|
||||
rowDatasetPrefix: "handoffMount",
|
||||
rowDatasetKeys: {
|
||||
term: ["handoffMountRow", "handoffMountStatus"],
|
||||
detail: ["handoffMountValue", "handoffMountStatus"],
|
||||
},
|
||||
renderResultFields: ["rendered", "statusLine", "rowCount", "rowIds", "dataset"],
|
||||
});
|
||||
assert.equal(
|
||||
createIniPanelShellSessionHandoffPackageMountState({
|
||||
handoffPackage: shellViewModel.shellSessionHandoffPackage,
|
||||
@@ -662,6 +687,14 @@ assert.equal(
|
||||
shellViewModel.createShellSessionHandoffPackageMountRenderState,
|
||||
createIniPanelShellSessionHandoffPackageMountRenderState,
|
||||
);
|
||||
assert.equal(
|
||||
shellViewModel.createShellSessionHandoffMountDomContract,
|
||||
createIniPanelShellSessionHandoffMountDomContract,
|
||||
);
|
||||
assert.equal(
|
||||
shellViewModel.createShellSessionHandoffMountDomReadiness,
|
||||
createIniPanelShellSessionHandoffMountDomReadiness,
|
||||
);
|
||||
assert.equal(
|
||||
shellViewModel.renderShellSessionHandoffMountState,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
@@ -735,6 +768,33 @@ const mountStatusNode = { textContent: "" };
|
||||
const mountDocument = {
|
||||
createElement: (tagName) => ({ tagName, dataset: {}, textContent: "" }),
|
||||
};
|
||||
assert.deepEqual(
|
||||
createIniPanelShellSessionHandoffMountDomReadiness({
|
||||
documentRef: mountDocument,
|
||||
mountNode,
|
||||
statusNode: mountStatusNode,
|
||||
rowsNode: mountRowsNode,
|
||||
}),
|
||||
{
|
||||
apiName: "ini-panel-shell-session-handoff-mount-dom-readiness",
|
||||
readinessVersion: 1,
|
||||
phase: "ready",
|
||||
ready: true,
|
||||
missing: [],
|
||||
checks: {
|
||||
document: true,
|
||||
mount: true,
|
||||
status: true,
|
||||
rows: true,
|
||||
rowDatasetPrefix: true,
|
||||
},
|
||||
contract: createIniPanelShellSessionHandoffMountDomContract(),
|
||||
},
|
||||
);
|
||||
assert.deepEqual(
|
||||
createIniPanelShellSessionHandoffMountDomReadiness({ documentRef: mountDocument }).missing,
|
||||
["mount", "status", "rows"],
|
||||
);
|
||||
assert.deepEqual(
|
||||
renderIniPanelShellSessionHandoffMountState(shellViewModel.shellSessionHandoffPackageMountRenderState, {
|
||||
documentRef: mountDocument,
|
||||
@@ -762,6 +822,15 @@ assert.deepEqual(
|
||||
);
|
||||
assert.equal(mountRowsNode.children[7].dataset.handoffMountValue, "session-load-state");
|
||||
assert.equal(mountRowsNode.children[7].dataset.handoffMountStatus, "blocked");
|
||||
const externalContract = createIniPanelShellSessionHandoffMountDomContract({
|
||||
rowDatasetPrefix: "externalMount",
|
||||
selectors: {
|
||||
mount: "[data-external-shell-mount]",
|
||||
status: "[data-external-shell-mount-status]",
|
||||
rows: "[data-external-shell-mount-rows]",
|
||||
},
|
||||
});
|
||||
assert.equal(externalContract.rowDatasetKeys.detail[0], "externalMountValue");
|
||||
|
||||
assert.deepEqual(controller.render(), { rendered: true });
|
||||
assert.equal(statusNode.textContent, "run-gcode | ok | -");
|
||||
|
||||
Reference in New Issue
Block a user