Skip to content

Commit 2bdc6eb

Browse files
authored
Prevent code editor from sizing to content (#12479)
Prevent code editor from sizing to content and stealing width from doc editor; add a test that catches the bug. Fixes #12476.
1 parent 476a8df commit 2bdc6eb

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,33 @@ test('Doc panel focus (regression #10471)', async ({ page }) => {
7373
await expect(locate.rightDock(page)).toContainText('The main TEST method')
7474
})
7575

76+
test('Code editor with wide content does not take space from doc editor (#12476)', async ({
77+
page,
78+
}) => {
79+
await actions.goToGraph(page)
80+
81+
await page.keyboard.press(`${CONTROL_KEY}+D`)
82+
await expect(locate.rightDock(page)).toBeVisible()
83+
await locate
84+
.rightDock(page)
85+
.elementHandle()
86+
.then((el) => el!.waitForElementState('stable'))
87+
const docPosWithoutCodeEditor = (await locate.rightDock(page).boundingBox())!.x
88+
89+
await page.keyboard.press(`${CONTROL_KEY}+\``)
90+
const codeEditor = page.locator('.CodeEditor')
91+
await expect(codeEditor).toBeVisible()
92+
await locate
93+
.rightDock(page)
94+
.elementHandle()
95+
.then((el) => el!.waitForElementState('stable'))
96+
const docPosWithCodeEditor = (await locate.rightDock(page).boundingBox())!.x
97+
98+
// Note that we compare `x` instead of `width`: This will catch either a change in width, or the
99+
// viewport becoming larger than the page (causing a change in *apparent* width).
100+
expect(docPosWithCodeEditor).toBe(docPosWithoutCodeEditor)
101+
})
102+
76103
test('Component help', async ({ page }) => {
77104
await actions.goToGraph(page, false)
78105
await locate.rightDock(page).getByRole('button', { name: 'Help' }).click()

app/gui/src/project-view/ProjectView.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ onDeactivated(() => (visible.value = false))
7272

7373
<style scoped>
7474
.ProjectView {
75+
width: 100%;
7576
flex: 1;
7677
color: var(--color-text);
7778
font-family: var(--font-sans);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ const groupColors = computed(() => {
700700
}
701701
& .vertical {
702702
flex: auto;
703-
min-width: 0;
703+
overflow-x: hidden;
704704
}
705705
}
706706

app/gui/src/project-view/mock/engine.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ main =
9090
aggregated = data.aggregate
9191
autoscoped = data.aggregate [..Group_By]
9292
selected = data.select_columns
93+
94+
# To test for regressions in #12476, this line is really long and we test that the code editor doesn't resize to fit it. This line is really really long. This line is really REALLY long.
9395
`
9496

9597
const fileTree = {

0 commit comments

Comments
 (0)