推进 INI 面板 launch API manifest
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
<script type="module">
|
||||
import {
|
||||
createControlPageBrowserApiMethods,
|
||||
createIniPanelLaunchApiManifest,
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createIniPanelShellViewModel,
|
||||
getIniPanelEntryByHref,
|
||||
@@ -51,12 +52,43 @@
|
||||
createControlPageBrowserApiMethods().join(","),
|
||||
"launch shell control-page browser API methods",
|
||||
);
|
||||
assertEqual(
|
||||
createIniPanelShellViewModel().launchApiManifest.apiName,
|
||||
"ini-panel-launch",
|
||||
"launch shell API manifest name",
|
||||
);
|
||||
assertEqual(
|
||||
createIniPanelShellViewModel().launchApiManifest.methods.join(","),
|
||||
createIniPanelLaunchApiManifest().methods.join(","),
|
||||
"launch shell API manifest methods",
|
||||
);
|
||||
|
||||
const launchDoc = await loadLaunchFrame();
|
||||
const launchApi = launchDoc.defaultView.linuxCncIniPanelLaunchApi;
|
||||
if (!launchApi?.getLauncherLinks || !launchApi?.getControlPageApiMethods) {
|
||||
if (!launchApi?.getLaunchApiManifest || !launchApi?.getLauncherLinks || !launchApi?.getControlPageApiMethods) {
|
||||
throw new Error("launch API namespace did not expose shell helpers");
|
||||
}
|
||||
const launchApiManifest = launchApi.getLaunchApiManifest();
|
||||
assertEqual(
|
||||
launchApiManifest.apiName,
|
||||
"ini-panel-launch",
|
||||
"launch API manifest name",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.methods.join(","),
|
||||
"getLaunchApiManifest,getLauncherLinks,getControlPageApiMethods",
|
||||
"launch API manifest methods",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.visibleEntries.length,
|
||||
2,
|
||||
"launch API manifest visible entry count",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.targetPages[1].href,
|
||||
"./control-page.html",
|
||||
"launch API manifest control target",
|
||||
);
|
||||
assertEqual(
|
||||
launchDoc.querySelector('a[href="./index.html"]').textContent,
|
||||
"Open edit and run panel",
|
||||
|
||||
Reference in New Issue
Block a user