Support optional workspace chrome queries in native-page test fixture
This commit is contained in:
parent
9b06943194
commit
7d02caaeb6
1 changed files with 1 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import test from 'node:test';import assert from 'node:assert/strict';import {readFileSync} from 'node:fs';import {runInNewContext} from 'node:vm';
|
||||
test('all native workspaces put reload below content and hide routine status after load',async()=>{
|
||||
class Node{constructor(tag,text,cls){this.tag=tag;this.textContent=text;this.className=cls;this.children=[];this.style={};this.contentWindow={postMessage(){}};}append(...nodes){this.children.push(...nodes);}replaceChildren(...nodes){this.children=nodes;}setAttribute(){}remove(){}}
|
||||
class Node{constructor(tag,text,cls){this.tag=tag;this.textContent=text;this.className=cls;this.children=[];this.style={};this.contentWindow={postMessage(){}};}append(...nodes){this.children.push(...nodes);}replaceChildren(...nodes){this.children=nodes;}setAttribute(){}querySelector(){return null;}remove(){}}
|
||||
const host=new Node('div'),window={addEventListener(){},removeEventListener(){}},el=(...args)=>new Node(...args);
|
||||
let source=readFileSync(new URL('../control-panel/public/cp-v2/cp-v2-native-services.mjs',import.meta.url),'utf8').replace(/^import[^\n]*\n/gm,'').replaceAll('export ','');
|
||||
const mount=runInNewContext(source+';mountNativeService',{canSubmitDevRequest:()=>false,createCPV2Page:({tabs})=>{const root=new Node('section');root.append(tabs[0].content);return {root};},el,window,location:{origin:'https://cp.dunerealms.com'},URL,AbortController,setTimeout,clearTimeout});
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff