推进 INI 面板 launch persistence capabilities manifest
This commit is contained in:
@@ -89,6 +89,21 @@
|
||||
"./control-page.html",
|
||||
"launch API manifest control target",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.persistenceCapabilities.length,
|
||||
3,
|
||||
"launch API manifest persistence capability count",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.persistenceCapabilities.map((capability) => capability.id).join(","),
|
||||
"machine-files,session-snapshot,readonly-status",
|
||||
"launch API manifest persistence capability ids",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.persistenceCapabilities[2].scope,
|
||||
"control-page",
|
||||
"launch API manifest readonly status scope",
|
||||
);
|
||||
assertEqual(
|
||||
launchDoc.querySelector('a[href="./index.html"]').textContent,
|
||||
"Open edit and run panel",
|
||||
|
||||
@@ -145,6 +145,10 @@ assert.match(docText, /\blinuxCncIniPanelControlPageApi\.readControlPageStatus\b
|
||||
assert.match(docText, /\bcreateIniPanelLaunchApiManifest\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiManifest\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
|
||||
assert.match(docText, /\bOPFS\/session persistence capabilities\b/);
|
||||
assert.match(docText, /\bmachine files\b/);
|
||||
assert.match(docText, /\bsession snapshots\b/);
|
||||
assert.match(docText, /\bread-only status\b/);
|
||||
|
||||
for (const entry of INI_PANEL_ENTRIES) {
|
||||
const escapedHref = entry.href.replace(".", "\\.");
|
||||
|
||||
@@ -48,6 +48,23 @@ assert.deepEqual(manifest, {
|
||||
},
|
||||
],
|
||||
controlPageApiMethods: createControlPageBrowserApiMethods(),
|
||||
persistenceCapabilities: [
|
||||
{
|
||||
id: "machine-files",
|
||||
label: "Machine text files",
|
||||
scope: "opfs",
|
||||
},
|
||||
{
|
||||
id: "session-snapshot",
|
||||
label: "Machine session snapshot",
|
||||
scope: "opfs",
|
||||
},
|
||||
{
|
||||
id: "readonly-status",
|
||||
label: "Read-only machine session status",
|
||||
scope: "control-page",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, manifest);
|
||||
@@ -56,9 +73,11 @@ assert.deepEqual(getVisibleIniPanelEntries(), INI_PANEL_ENTRIES);
|
||||
manifest.visibleEntries[0].title = "changed";
|
||||
manifest.targetPages[0].href = "./changed.html";
|
||||
manifest.controlPageApiMethods.push("changedMethod");
|
||||
manifest.persistenceCapabilities[0].label = "changed";
|
||||
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
|
||||
assert.equal(createIniPanelLaunchApiManifest().targetPages[0].href, "./index.html");
|
||||
assert.deepEqual(createIniPanelLaunchApiManifest().controlPageApiMethods, createControlPageBrowserApiMethods());
|
||||
assert.equal(createIniPanelLaunchApiManifest().persistenceCapabilities[0].label, "Machine text files");
|
||||
|
||||
const customManifest = createIniPanelLaunchApiManifest([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user