推进 INI 面板 shell handoff mount DOM contract helper
This commit is contained in:
@@ -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