feat(editor): the three-dot button in the simulation too
A tap on a device in the simulation now also chooses it, so its three-dot button shows as in the design, wherever the simulation's menu offers something (the desktop, each card's data exchange; a switch has none). Java's action of the tap stays (desktop, switch and NAT tables), a tap beside lets go. The device sheet stays closed — the design is locked — and the others see no frame. Java opens that menu only with a right click. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -190,6 +190,50 @@ test("shows a card's frames as Java's data exchange window does, with their deta
|
||||
await expect(window).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('chooses a device with a tap in the simulation, its three-dot button as in the design — only where it has a menu', async ({ page }) => {
|
||||
await openPages(page);
|
||||
await start(page);
|
||||
const button = page.locator('.device-menu-button');
|
||||
const sheet = page.locator('aside[aria-label="Einstellungen"]');
|
||||
// A router: Java's tap does nothing else; the button opens the same menu as the long press.
|
||||
const router = await onDevice(page, await idOf(page, 'Router'));
|
||||
await page.mouse.click(router.x, router.y);
|
||||
await expect(page.locator(`g.device[data-node="${await idOf(page, 'Router')}"]`)).toHaveAttribute('data-selected', 'true');
|
||||
await button.click();
|
||||
await expect(page.getByRole('menuitem')).toHaveText(['Datenaustausch anzeigen (192.168.0.1)', 'Datenaustausch anzeigen (10.0.0.1)']);
|
||||
await page.getByRole('menuitem', { name: 'Datenaustausch anzeigen (10.0.0.1)' }).click();
|
||||
await expect(page.locator('section[data-capture]').getByRole('tab', { selected: true })).toHaveText('Router - 10.0.0.1');
|
||||
await page.locator('section[data-capture] .desktop-close').click();
|
||||
// A computer: the tap still opens its desktop (Java), and chooses it; its settings stay closed, the design is locked.
|
||||
const browser = await idOf(page, 'Browser');
|
||||
const at = await onDevice(page, browser);
|
||||
await page.mouse.click(at.x, at.y);
|
||||
await expect(page.locator(`section[data-desktop="${browser}"]`)).toBeVisible();
|
||||
await expect(button).toBeVisible();
|
||||
await expect(sheet).toHaveCount(0);
|
||||
await page.locator(`section[data-desktop="${browser}"] .desktop-close`).click();
|
||||
await button.click();
|
||||
await expect(page.getByRole('menuitem')).toHaveText(['Desktop anzeigen', 'Datenaustausch anzeigen (192.168.0.10)']);
|
||||
await page.keyboard.press('Escape');
|
||||
// A switch has no menu in the simulation, so no button; a tap beside lets go.
|
||||
const lanSwitch = (await drawing(page)).nodes.find((node) => node.kind === 'networkSwitch')!.id;
|
||||
const hub = await onDevice(page, lanSwitch);
|
||||
await page.mouse.click(hub.x, hub.y);
|
||||
await expect(page.locator(`g.device[data-node="${lanSwitch}"]`)).toHaveAttribute('data-selected', 'true');
|
||||
await expect(button).toHaveCount(0);
|
||||
await page.locator(`section[data-viewer="${lanSwitch}"] .desktop-close`).click();
|
||||
await page.mouse.click(at.x, at.y);
|
||||
await expect(button).toBeVisible();
|
||||
const surface = (await page.locator('svg.filius-canvas').boundingBox())!;
|
||||
await page.mouse.click(surface.x + surface.width - 30, surface.y + surface.height - 80);
|
||||
await expect(button).toHaveCount(0);
|
||||
// Back in the design nothing stays chosen.
|
||||
await page.mouse.click(at.x, at.y);
|
||||
await page.getByRole('button', { name: 'Wechselt in den Entwurfsmodus' }).click();
|
||||
await expect(button).toHaveCount(0);
|
||||
await expect(sheet).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('fills a phone with the data exchange window, its bar in reach', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 360, height: 740 });
|
||||
await openPages(page);
|
||||
|
||||
@@ -130,6 +130,9 @@ test('three people in one project of F: moving, reading only, one simulation for
|
||||
// Both have the notebook's desktop open: each sees the other's dot on it.
|
||||
await expect(desktop(mia, notebook).locator(`[data-watcher="${benUser}"]`)).toBeVisible();
|
||||
await expect(desktop(ben, notebook).locator(`[data-watcher="${miaUser}"]`)).toBeVisible();
|
||||
// Their taps chose the notebook too (its three-dot button), but in the simulation that is no frame for the others —
|
||||
// told in the same message as the open desktop just seen.
|
||||
for (const page of [mia, ben]) await expect(page.locator('rect.chosen-by')).toHaveCount(0);
|
||||
// Rita may look, not type; she sees both on the desktop, and they see her.
|
||||
const ritas = await commandLine(rita, notebook);
|
||||
await expect(desktop(rita, notebook).locator('[data-watcher]')).toHaveCount(2);
|
||||
|
||||
Reference in New Issue
Block a user