fix(send): Apply sends in one click and identical nodes always ask

Preview is now optional. Apply is enabled once a window and node are selected
and fetches its own ticket. It stays closed after a send, so a double click sends
once. A linked field or a workflow changed since discovery still refuses, and a
host refusal no longer reads as "may have applied". Two or more eligible nodes
are never selected for the user, and every node option reads "#<id> <title>".
This commit is contained in:
Vito Sansevero
2026-10-30 13:31:54 -07:00
parent 54f571ca96
commit 695edd670b
19 changed files with 201 additions and 50 deletions
+1 -1
View File
@@ -415,7 +415,7 @@ test('full inspector preserves long role text and exact sends',async({page,reque
await fullFixture(page,request);const panel=inspector(page);const positive=panel.locator('.prompt-section.positive .prompt-text');await expect(positive).toContainText('猫 😀');const text=await positive.textContent();expect(text.length).toBeGreaterThan(1000);
await panel.locator('.detail-footer button.send').click();const sender=page.getByRole('dialog',{name:'Send to ComfyUI',exact:true});
await expect(sender.getByRole('combobox',{name:'ComfyUI window',exact:true}).locator('option')).toContainText(['Exact host']);
await sender.getByRole('combobox',{name:'ComfyUI window',exact:true}).selectOption({label:'Exact host'});await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'Exact pair'});
await sender.getByRole('combobox',{name:'ComfyUI window',exact:true}).selectOption({label:'Exact host'});await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#pair Exact pair'});
await sender.getByRole('button',{name:'Preview changes',exact:true}).click();await sender.getByRole('button',{name:'Apply to ComfyUI',exact:true}).click();await expect(sender).toContainText('Sent to ComfyUI.');
expect(await host.evaluate(()=>window.sent)).toEqual([{positive:text,negative:'blurred edges, watermark'}]);
} finally {await host.evaluate(()=>window.bridge.dispose());await host.close();}
@@ -107,7 +107,7 @@ export async function exerciseCurrentPairSend(page, roles) {
const send = viewer.getByRole('button', { name: /^Send prompt pair to ComfyUI: / });await send.click();
const sender = page.getByRole('dialog', { name: 'Send to ComfyUI', exact: true });await expect(sender).toBeVisible();
await sender.getByRole('combobox', { name: 'ComfyUI window', exact: true }).selectOption({ label: 'Canonical ComfyUI' });
await sender.getByRole('combobox', { name: 'Destination node', exact: true }).selectOption({ label: 'Canonical destination' });
await sender.getByRole('combobox', { name: 'Destination node', exact: true }).selectOption({ label: '#canonical-pair Canonical destination' });
await sender.getByRole('button', { name: 'Preview changes', exact: true }).click();
await expect(sender).toContainText(roles.positive);await expect(sender).toContainText(roles.negative);
await sender.getByRole('button', { name: 'Apply to ComfyUI', exact: true }).click();await expect(sender).toContainText('Sent to ComfyUI.');
+1 -1
View File
@@ -194,7 +194,7 @@ function productionSent(host) {
return async page=>{
const sender=page.getByRole('dialog',{name:'Send to ComfyUI',exact:true});
await sender.getByRole('combobox',{name:'ComfyUI window',exact:true}).selectOption({label:'Concept ComfyUI'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'Concept destination'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#pair-1 Concept destination'});
await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
await expect.poll(()=>host.evaluate(()=>window.previewed.length)).toBe(1);
const roles=await host.evaluate(()=>window.previewed.pop());
+1 -1
View File
@@ -259,7 +259,7 @@ async function productionSendOf(page,context) {
const sender=page.getByRole('dialog',{name:'Send to ComfyUI',exact:true});await expect(sender).toBeVisible();
const windows=sender.getByRole('combobox',{name:'ComfyUI window',exact:true});
await expect(windows.locator('option')).toContainText(['Test ComfyUI']);await windows.selectOption({label:'Test ComfyUI'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'My prompt pair'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#pair-1 My prompt pair'});
await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
await sender.getByRole('button',{name:'Apply to ComfyUI',exact:true}).click();
await expect(sender).toContainText('Sent to ComfyUI.');
+1 -1
View File
@@ -233,7 +233,7 @@ function productionSent(host) {
return async page=>{
const sender=page.getByRole('dialog',{name:'Send to ComfyUI',exact:true});
await sender.getByRole('combobox',{name:'ComfyUI window',exact:true}).selectOption({label:'Concept ComfyUI'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'Concept destination'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#pair-1 Concept destination'});
await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
await expect.poll(()=>host.evaluate(()=>window.previewed.length)).toBe(1);
const roles=await host.evaluate(()=>window.previewed.pop());
+3 -2
View File
@@ -33,7 +33,7 @@ async function chooseDestination(page) {
const host=sender.getByRole('combobox',{name:'ComfyUI window',exact:true});
await expect(host.locator('option')).toContainText(['Test ComfyUI']);
await host.selectOption({label:'Test ComfyUI'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'My prompt pair'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#pair-1 My prompt pair'});
return sender;
}
@@ -165,7 +165,8 @@ test('host apply rejection retains the current text and requires a new preview',
await page.goto(workspace);await select(page,'0:shared/same.png');await details(page).getByRole('button',{name:/^Send positive prompt to ComfyUI: /}).click();
const sender=await chooseDestination(page);await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
await sender.getByRole('button',{name:'Apply to ComfyUI',exact:true}).click();await expect(sender).toContainText(/Workflow changed/);
await expect(sender.getByRole('button',{name:'Apply to ComfyUI',exact:true})).toBeDisabled();
// D175: a refusal wrote nothing, so Apply may try again.
await expect(sender.getByRole('button',{name:'Apply to ComfyUI',exact:true})).toBeEnabled();
expect(await host.evaluate(()=>window.hostValues.positive)).toBe('Existing positive');
} finally {await host.evaluate(()=>window.fixtureHost.dispose());await host.close();}
});
@@ -88,7 +88,7 @@ function measureIntegrations(mainSelector) {
};
}
const SEND_REASON = 'Sending asks when there is more than one ComfyUI window or node and always previews, so “Ask each time” is the only option.';
const SEND_REASON = 'Sending asks when there is more than one ComfyUI window or node, so “Ask each time” is the only option.';
const RENDERER_REASON = 'Prompt Manager nodes always follow ComfyUI’s own renderer setting.';
const RENDERER_NONE = 'No ComfyUI window is open in this browser, so its renderer is not known.';
const RETURN_REASON = 'Not available: sending applies the text in ComfyUI and keeps this page open.';
+1 -1
View File
@@ -468,7 +468,7 @@ test('frozen Effective pair uses the shared acknowledged sender and Escape close
const positive=await exact(dialog(page).getByRole('region',{name:'Positive prompt',exact:true}).locator('p.prompt-text'));
const send=dialog(page).getByRole('button',{name:'Send prompt pair',exact:true});await send.click();
const sender=page.getByRole('dialog',{name:'Send to ComfyUI',exact:true});await sender.getByRole('combobox',{name:'ComfyUI window',exact:true}).selectOption({label:'History ComfyUI'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'History destination'});await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#history-pair History destination'});await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
await expect(sender.getByRole('button',{name:'Apply to ComfyUI',exact:true})).toBeEnabled();await sender.getByRole('button',{name:'Apply to ComfyUI',exact:true}).click();await expect(sender).toContainText('Sent to ComfyUI.');
expect(await host.evaluate(()=>window.historyApplied)).toEqual([{positive,negative:' \n\t '}]);
await page.keyboard.press('Escape');await expect(sender).toHaveCount(0);await expect(dialog(page)).toBeVisible();await expect(send).toBeFocused();
+1 -1
View File
@@ -975,7 +975,7 @@ async function sendPair(page) {
await rail(page).getByRole('button', { name: /^Send prompt pair to ComfyUI: / }).click();
const sender = page.getByRole('dialog', { name: 'Send to ComfyUI', exact: true });
await sender.getByRole('combobox', { name: 'ComfyUI window', exact: true }).selectOption({ label: 'Inspect ComfyUI' });
await sender.getByRole('combobox', { name: 'Destination node', exact: true }).selectOption({ label: 'Inspect destination' });
await sender.getByRole('combobox', { name: 'Destination node', exact: true }).selectOption({ label: '#pair-1 Inspect destination' });
await sender.getByRole('button', { name: 'Preview changes', exact: true }).click();
await sender.getByRole('button', { name: 'Apply to ComfyUI', exact: true }).click();
await expect(sender).toContainText('Sent to ComfyUI.');
+2 -2
View File
@@ -364,7 +364,7 @@ test('history shares real image metadata, vendored Viewer and the acknowledged p
const sender=page.getByRole('dialog',{name:'Send to ComfyUI',exact:true});
const hosts=sender.getByRole('combobox',{name:'ComfyUI window',exact:true});
await expect(hosts.locator('option')).toHaveCount(2);await hosts.selectOption({label:'Library ComfyUI'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'Library destination'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#pair-1 Library destination'});
await sender.getByRole('button',{name:'Preview changes',exact:true}).click();await expect(sender).toContainText(chosenNegative||'(empty)');
await sender.getByRole('button',{name:'Apply to ComfyUI',exact:true}).click();await expect(sender).toContainText('Sent to ComfyUI.');
expect(await host.evaluate(()=>window.libraryApplied)).toEqual([{positive:'Cat portrait',negative:chosenNegative}]);
@@ -716,7 +716,7 @@ test('long prompt is clamped to two lines while copy sends the full text',async(
await card.locator('.card-footer .row-actions > button.send').click();
const sender=page.getByRole('dialog',{name:'Send to ComfyUI',exact:true});
await sender.getByRole('combobox',{name:'ComfyUI window',exact:true}).selectOption({label:'Card ComfyUI'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'Card destination'});
await sender.getByRole('combobox',{name:'Destination node',exact:true}).selectOption({label:'#positive-1 Card destination'});
await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
await sender.getByRole('button',{name:'Apply to ComfyUI',exact:true}).click();await expect(sender).toContainText('Sent to ComfyUI.');
expect(await host.evaluate(()=>window.cardApplied)).toEqual([{positive:longPrompt}]);
@@ -99,7 +99,7 @@ test('send destination offers Ask each time; unsupported options disabled with t
.toEqual([['Ask each time', false], ['Selected Prompt Manager node', true], ['Create a Prompt Manager (+/-) node', true]]);
await expect(send.locator('select')).toHaveValue('Ask each time');
await expect(send.locator('p.small')).toHaveText(
'Sending asks when there is more than one ComfyUI window or node and always previews, so “Ask each time” is the only option.');
'Sending asks when there is more than one ComfyUI window or node, so “Ask each time” is the only option.');
const renderer = settingOf(page, 'Host compatibility');
expect(await renderer.locator('option').evaluateAll(options => options.map(option => [option.textContent, option.disabled])))
.toEqual([['Follow host renderer', false], ['Classic', true], ['Nodes 2.0', true]]);
+46 -1
View File
@@ -74,7 +74,8 @@ test('native image inspector previews and sends a pair into real visible widgets
expect(tabTitle).not.toContain('PromptManager');
await expect(hosts).not.toHaveValue('');
await expect(sender.getByRole('combobox',{name:'Destination node',exact:true})).not.toHaveValue('');
await expect(sender.getByRole('status')).toContainText(`in ${tabTitle}. Preview changes before applying.`);
await expect(sender.getByRole('status')).toContainText(`in ${tabTitle}. Apply to send it, or preview the changes first.`);
await expect(sender.getByRole('combobox',{name:'Destination node',exact:true}).locator('option').nth(1)).toHaveText(new RegExp(`^#${id} `));
await sender.getByRole('button',{name:'Preview changes',exact:true}).click();
for(const text of ['Before positive','Before negative',positive,negative,`LoRA trigger ${positive} fine detail`])await expect(sender).toContainText(text);
await expect(nodeRoot.getByRole('textbox',{name:'Positive prompt',exact:true})).toHaveValue('Before positive');
@@ -91,6 +92,50 @@ test('native image inspector previews and sends a pair into real visible widgets
for(const name of ['inputs','serialized'])expect(state[name]).toMatchObject({text:positive,negative_text:negative,prepend_text:'LoRA trigger',append_text:'fine detail'});
expect(state.effects).toEqual({queue:0,load:0});expect(errors).toEqual([]);
await workspace.screenshot({path:testInfo.outputPath('full-inspector-host-send.png')});
// #535 D175: Apply without Preview, one click, and a double click sends once.
const apply=sender.getByRole('button',{name:'Apply to ComfyUI',exact:true});
const find0=sender.getByRole('button',{name:'Find ComfyUI windows',exact:true});
const positiveBox=nodeRoot.getByRole('textbox',{name:'Positive prompt',exact:true});
await positiveBox.fill('Typed before one click');
await find0.click();
await expect(apply).toBeEnabled();
await apply.dblclick();
await expect(sender).toContainText('Sent to ComfyUI.');
await expect(positiveBox).toHaveValue(positive);
await expect(apply).toBeDisabled();
// Edited in ComfyUI after the send: a stray second send would overwrite this.
await positiveBox.fill('Typed after the send');
await expect(positiveBox).toHaveValue('Typed after the send');
// A changed workflow since discovery refuses through one-click Apply, and writes nothing.
await find0.click();
await expect(apply).toBeEnabled();
await page.evaluate(async()=>{const {app}=await import('/scripts/app.js');await app.loadGraphData(app.graph.serialize());});
await apply.click();
await expect(sender.getByRole('alert')).toContainText(/workflow changed/i);
await expect(positiveBox).toHaveValue('Typed after the send');
// A field linked after discovery refuses the same way.
await find0.click();
await expect(apply).toBeEnabled();
await page.evaluate(async id=>{
const {app}=await import('/scripts/app.js');const {convertToInput}=await import('/extensions/core/widgetInputs.js');
const node=app.graph.getNodeById(id);const widget=node.widgets.find(widget=>widget.name==='negative_text');
if(!node.inputs.some(input=>input.name==='negative_text'))convertToInput(node,widget);
const source=LiteGraph.createNode('PrimitiveString');app.graph.add(source);
source.connect(0,node,node.inputs.findIndex(input=>input.name==='negative_text'));
},id);
await apply.click();
await expect(sender.getByRole('alert')).toContainText(/connected/i);
await expect(positiveBox).toHaveValue('Typed after the send');
await page.evaluate(async id=>{const {app}=await import('/scripts/app.js');const node=app.graph.getNodeById(id);node.disconnectInput(node.inputs.findIndex(input=>input.name==='negative_text'));},id);
// Two identical nodes are never selected for you, and read "#<id> <title>".
const twinId=await page.evaluate(async()=>{const {app}=await import('/scripts/app.js');const node=LiteGraph.createNode('PromptManagerPair');app.graph.add(node);return node.id;});
await find0.click();
const targets=sender.getByRole('combobox',{name:'Destination node',exact:true});
await expect(targets.locator('option')).toHaveCount(3);
await expect(targets).toHaveValue('');
await expect(apply).toBeDisabled();
await expect(targets.locator('option').nth(2)).toHaveText(new RegExp(`^#${twinId} `));
await page.evaluate(async twinId=>{const {app}=await import('/scripts/app.js');app.graph.remove(app.graph.getNodeById(twinId));},twinId);
// #535: the status line says why a window cannot receive.
const find=sender.getByRole('button',{name:'Find ComfyUI windows',exact:true});
const preview=sender.getByRole('button',{name:'Preview changes',exact:true});
+11
View File
@@ -159,3 +159,14 @@ test('listTargets reports which roles are linked to an upstream node',async()=>{
const [pair,plain]=createPromptAdapter(app,{runtime:{}}).listTargets();
assert.deepEqual(pair.linkedRoles,['negative']);assert.deepEqual(plain.linkedRoles,[]);
});
test('the revision moves when the graph is edited and when a load replaces the node, even at the same version',async()=>{
const {createPromptAdapter}=await import('../../web/js/prompt-bridge-adapter.js');
const node=()=>({id:1,type:'PromptManager',widgets:[{name:'text',value:''}],inputs:[]});
const app={graph:{_version:9,_nodes:[node()]}};
const adapter=createPromptAdapter(app,{runtime:{}});
const first=adapter.listTargets()[0].revision;
assert.equal(adapter.preview('1',{positive:'x'}).preview.revision,first);
app.graph._version=10;const edited=adapter.listTargets()[0].revision;assert.notEqual(edited,first);
app.graph={_version:10,_nodes:[node()]};assert.notEqual(adapter.listTargets()[0].revision,edited);
});
+55 -4
View File
@@ -14,7 +14,6 @@ test('sender requires explicit compatible host and target, preview, then acknowl
await s.session.discover(); assert.equal(s.session.state.hostId,'host');assert.equal(s.session.state.targetId,'');
await s.session.preview(); assert.equal(s.calls.length,0);
s.session.selectTarget('one');
await s.session.apply();assert.equal(s.calls.length,0);
await s.session.preview();assert.equal(s.session.state.phase,'ready');assert.equal(s.session.state.preview.composition.after,'prefix new');
await s.session.apply();assert.equal(s.session.state.phase,'success');assert.equal(s.calls.filter(call=>call[0]==='apply').length,1);
await s.session.apply();assert.equal(s.calls.filter(call=>call[0]==='apply').length,1); s.session.dispose();
@@ -66,7 +65,7 @@ async function discovered(createSendSession,found,roles={positive:'new'}) {
test('one window with one eligible node is selected so Preview is available at once',async()=>{
const {createSendSession}=await source;const s=await discovered(createSendSession,[window1([pm('1')])]);
assert.equal(s.session.state.hostId,'a');assert.equal(s.session.state.targetId,'1');
assert.match(s.session.state.message,/Node 1 in Flow - ComfyUI.*Preview changes/);
assert.match(s.session.state.message,/#1 Node 1 in Flow - ComfyUI.*Apply/);
await s.session.preview();assert.equal(s.session.state.phase,'ready');s.session.dispose();
});
test('several windows are left to choose, and choosing one with a single node selects that node',async()=>{
@@ -101,17 +100,69 @@ test('an auto-selected destination says how many other nodes cannot receive, and
assert.equal(s.session.state.targetId,'2');assert.match(s.session.state.message,/1 other Prompt Manager node cannot receive/);
await s.session.preview();s.session.dispose();
const named=setup(createSendSession,{discover:async()=>[window1([pm('one')])],preview:async(_,id)=>({ticket:'t',target:{id,label:'Live title'},fields:[{role:'positive',before:'',after:'new'}]})});
await named.session.discover();await named.session.preview();assert.match(named.session.state.message,/Sending to Live title in Flow - ComfyUI/);named.session.dispose();
await named.session.discover();await named.session.preview();assert.match(named.session.state.message,/Sending to #one Live title in Flow - ComfyUI/);named.session.dispose();
});
test('window order and numbering do not depend on which tab answered first',async()=>{
const {createSendSession}=await source;const s=await discovered(createSendSession,[window1([pm('1')],'T','b'),window1([pm('2')],'T','a')]);
assert.deepEqual(s.session.state.hosts.map(host=>[host.hostId,host.label]),[['a','T'],['b','T (window 2)']]);s.session.dispose();
});
const applied=calls=>calls.filter(call=>call[0]==='apply').length;
test('Apply without Preview fetches the ticket and applies in one click',async()=>{
const {createSendSession}=await source;const s=setup(createSendSession,{discover:async()=>[window1([pm('one')])]});
await s.session.discover();await s.session.apply();
assert.equal(s.session.state.phase,'success');assert.deepEqual(s.calls.map(call=>call[0]),['preview','apply']);s.session.dispose();
});
test('a double click applies once, during the send and after it',async()=>{
const {createSendSession}=await source;const s=setup(createSendSession,{discover:async()=>[window1([pm('one')])]});
await s.session.discover();const first=s.session.apply();const second=s.session.apply();await Promise.all([first,second]);
assert.equal(applied(s.calls),1);await s.session.apply();assert.equal(applied(s.calls),1);s.session.dispose();
});
test('Apply after a preview uses its ticket and does not preview again',async()=>{
const {createSendSession}=await source;const s=setup(createSendSession,{discover:async()=>[window1([pm('one')])]});
await s.session.discover();await s.session.preview();await s.session.apply();
assert.deepEqual(s.calls.map(call=>call[0]),['preview','apply']);assert.equal(s.session.state.phase,'success');s.session.dispose();
});
test('Apply needs a destination',async()=>{
const {createSendSession}=await source;const s=setup(createSendSession);
await s.session.discover();await s.session.apply();assert.equal(s.calls.length,0);s.session.dispose();
});
test('a refusal at the fetched preview says so plainly and writes nothing; Apply can try again',async()=>{
const {createSendSession}=await source;let refuse=true;
const s=setup(createSendSession,{discover:async()=>[window1([pm('one')])],preview:async(_,id)=>{if(refuse)throw Error('positive is connected to an upstream input.');return{ticket:'t',target:{id},fields:[{role:'positive',before:'',after:'new'}]};}});
await s.session.discover();await s.session.apply();
assert.equal(s.session.state.phase,'error');assert.match(s.session.state.message,/connected/);assert.doesNotMatch(s.session.state.message,/may have applied/);
refuse=false;await s.session.apply();assert.equal(s.session.state.phase,'success');s.session.dispose();
});
test('a host refusal at apply is a refusal; only a lost reply is an unknown outcome',async()=>{
const {createSendSession}=await source;
const s=setup(createSendSession,{discover:async()=>[window1([pm('one')])],apply:async()=>{throw Error('Workflow or prompt changed. Preview again.');}});
await s.session.discover();await s.session.apply();assert.match(s.session.state.message,/Workflow or prompt changed/);assert.doesNotMatch(s.session.state.message,/may have applied/);s.session.dispose();
const lost=setup(createSendSession,{discover:async()=>[window1([pm('one')])],apply:async()=>{throw Error('Bridge request timed out');}});
await lost.session.discover();await lost.session.apply();assert.match(lost.session.state.message,/may have applied/);
await lost.session.apply();assert.equal(lost.calls.filter(call=>call[0]==='preview').length,1);
lost.session.selectTarget('one');await lost.session.apply();assert.equal(lost.calls.filter(call=>call[0]==='preview').length,2);lost.session.dispose();
});
test('a workflow changed since discovery refuses before anything is written',async()=>{
const {createSendSession}=await source;
for(const op of ['apply','preview']){
const s=setup(createSendSession,{discover:async()=>[window1([pm('one',['positive'],{revision:'1:4'})])],preview:async(_,id)=>({ticket:'t',revision:'1:5',target:{id},fields:[{role:'positive',before:'',after:'new'}]})});
await s.session.discover();await s.session[op]();
assert.equal(s.session.state.phase,'error');assert.match(s.session.state.message,/workflow changed/i);assert.equal(applied(s.calls),0);s.session.dispose();
}
const stale=setup(createSendSession,{discover:async()=>[window1([pm('one')])]});await stale.session.discover();await stale.session.apply();assert.equal(stale.session.state.phase,'success');stale.session.dispose();
});
test('two or more eligible nodes are never auto-selected, and each option shows id and title',async()=>{
const {createSendSession}=await source;const twin=id=>({id,label:'Prompt Manager (+/-)',roles:['positive']});
const s=await discovered(createSendSession,[window1([twin('72'),twin('73')])]);
assert.equal(s.session.state.targetId,'');assert.deepEqual(s.session.state.hosts[0].targets.map(target=>target.label),['#72 Prompt Manager (+/-)','#73 Prompt Manager (+/-)']);
await s.session.apply();assert.equal(s.calls.length,0);s.session.dispose();
const one=await discovered(createSendSession,[window1([twin('72')])]);assert.equal(one.session.state.hosts[0].targets[0].label,'#72 Prompt Manager (+/-)');assert.equal(one.session.state.targetId,'72');one.session.dispose();
});
test('same-named windows and nodes stay distinguishable',async()=>{
const {createSendSession}=await source;const twin=id=>({id,label:'Same',roles:['positive']});
const s=await discovered(createSendSession,[window1([twin('7'),twin('8')],'T','a'),window1([pm('1')],'T','b')]);
assert.deepEqual(s.session.state.hosts.map(host=>host.label),['T','T (window 2)']);
assert.deepEqual(s.session.state.hosts[0].targets.map(target=>target.label),['Same #7','Same #8']);s.session.dispose();
assert.deepEqual(s.session.state.hosts[0].targets.map(target=>target.label),['#7 Same','#8 Same']);s.session.dispose();
});
function fakeDOM() {
class Node extends EventTarget {