Skip to content

Commit d1e05d3

Browse files
committed
Fix closing Full Screen visualization with Esc key. (#12811)
Fixes #12796 This is just a workaround. The proper fix is meant to be implemented in #10414 Bumped priority on that one, as this is a second time we have problem with fighting bindings.
1 parent e7df00b commit d1e05d3

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

app/gui/integration-test/project-view/fullscreenVisualisation.spec.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ test('Load Fullscreen Visualisation', async ({ page }) => {
1515
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
1616
await aggregatedNode.click()
1717
await page.keyboard.press('Space')
18-
await page.waitForTimeout(1000)
19-
const fullscreenButton = locate.enterFullscreenButton(aggregatedNode)
20-
await fullscreenButton.click()
2118
const vis = locate.jsonVisualization(page)
2219
await expect(vis).toExist()
20+
const initialBBox = await vis.boundingBox()
21+
assert(initialBBox != null)
22+
const fullscreenButton = locate.enterFullscreenButton(aggregatedNode)
23+
await expect(fullscreenButton).toBeVisible()
24+
await fullscreenButton.click()
25+
2326
await expect(locate.exitFullscreenButton(page)).toExist()
2427
// Wait for entering-fullscreen animation.
25-
await vis.elementHandle().then((el) => el!.waitForElementState('stable'))
26-
const visBoundingBox = await vis.boundingBox()
27-
expect(visBoundingBox?.height).toBeGreaterThan(600)
28-
expect(visBoundingBox?.width).toBe(1920)
28+
await expect.poll(async () => (await vis.boundingBox())?.width).toBe(1920)
29+
await expect.poll(async () => (await vis.boundingBox())?.height).toBeGreaterThan(600)
2930
const element = await vis.elementHandle()
3031
assert(element != null)
3132
const textContent = await computedContent(element)
@@ -63,4 +64,9 @@ test('Load Fullscreen Visualisation', async ({ page }) => {
6364
},
6465
],
6566
})
67+
68+
// We may leave fulscreen by pressing Escape
69+
await page.keyboard.press('Escape')
70+
await expect.poll(async () => (await vis.boundingBox())?.width).toBeCloseTo(initialBBox.width)
71+
await expect.poll(async () => (await vis.boundingBox())?.height).toBeCloseTo(initialBBox.height)
6672
})

app/gui/src/project-view/components/GraphEditor/GraphVisualization.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ const keydownHandler = visualizationBindings.handler({
110110
},
111111
})
112112
113-
useEvent(window, 'keydown', keydownHandler)
113+
// TODO[ao]: we use `document` to make sure it takes precedence before GraphEditor handlers
114+
// (deselectAllNodes in particular). But this is quick workaroung, the proper soloution
115+
// should be soon delivered as part of https://github.com/enso-org/enso/issues/10414
116+
useEvent(document, 'keydown', keydownHandler)
114117
115118
function onWheel(event: WheelEvent) {
116119
if (

0 commit comments

Comments
 (0)