mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
fix(run): keep the configuration header visible while scrolling (#5175)
Keep the configuration name and project-file checkbox visible above the scrolling options in Run/Debug Configurations. Long forms previously scrolled these controls out of view, so editing the name or changing where a configuration is saved meant returning to the top.
This commit is contained in:
@@ -2,7 +2,7 @@ import type { Locator, Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
for (const height of [990, 700, 560]) {
|
||||
test(`run configurations dialog keeps its toolbar and scrolls only inside the panes at ${height}px`, async ({
|
||||
test(`run configurations dialog keeps its toolbar and name visible while scrolling at ${height}px`, async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 900, height });
|
||||
@@ -62,9 +62,13 @@ async function resize(page: Page, dialog: Locator, dy: number) {
|
||||
async function checkScrolling(page: Page, dialog: Locator) {
|
||||
const body = dialog.locator("[data-dialog-body]");
|
||||
const list = dialog.getByRole("tree", { name: "Run configurations", exact: true });
|
||||
const form = dialog.locator('[class*="_editForm_"]');
|
||||
const form = dialog.locator('[class*="_formSettings_"]');
|
||||
const nameField = dialog.getByRole("textbox", { name: "Name", exact: true });
|
||||
await list.evaluate((el) => (el.scrollTop = 0));
|
||||
await form.evaluate((el) => (el.scrollTop = 0));
|
||||
// Measure once the dialog's opening animation has settled.
|
||||
await dialog.evaluate((el) => Promise.all(el.getAnimations().map((animation) => animation.finished)));
|
||||
const nameTop = (await nameField.boundingBox())!.y;
|
||||
await list.hover();
|
||||
await page.mouse.wheel(0, 200);
|
||||
await expect.poll(() => list.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
|
||||
@@ -74,6 +78,8 @@ async function checkScrolling(page: Page, dialog: Locator) {
|
||||
await page.mouse.wheel(0, 200);
|
||||
await expect.poll(() => form.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
|
||||
expect(await list.evaluate((el) => el.scrollTop)).toBe(listTop);
|
||||
expect((await nameField.boundingBox())!.y).toBeCloseTo(nameTop, 0);
|
||||
await expect(dialog.getByRole("checkbox", { name: /Store as project file/ })).toBeInViewport({ ratio: 1 });
|
||||
const overflow = await body.evaluate((el) => ({
|
||||
scroll: el.scrollHeight,
|
||||
client: el.clientHeight,
|
||||
|
||||
@@ -112,7 +112,7 @@ test("resizing the configuration dialog grows its panes and keeps the footer vis
|
||||
await expect(dialog.getByRole("tree", { name: "Run configurations", exact: true })).toBeVisible();
|
||||
await expect.poll(async () => (await content.boundingBox())!.height).toBeLessThan(initial);
|
||||
await expect
|
||||
.poll(() => dialog.locator("[class*='editForm_']").evaluate((el) => el.scrollHeight - el.clientHeight))
|
||||
.poll(() => dialog.locator("[class*='_formSettings_']").evaluate((el) => el.scrollHeight - el.clientHeight))
|
||||
.toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
@@ -144,7 +144,7 @@ test("Java, npm and Python forms fit narrow and zoomed content panes", async ({
|
||||
for (const width of [1024, 640, 520]) {
|
||||
await page.setViewportSize({ width, height: 820 });
|
||||
await expect
|
||||
.poll(() => dialog.locator("[class*='editForm_']").evaluate((el) => el.scrollWidth - el.clientWidth), {
|
||||
.poll(() => dialog.locator("[class*='_formSettings_']").evaluate((el) => el.scrollWidth - el.clientWidth), {
|
||||
message: `${kind}, ${width}px, ${zoom * 100}%`,
|
||||
})
|
||||
.toBeLessThanOrEqual(1);
|
||||
@@ -204,7 +204,7 @@ for (const locale of ["en", "zh"]) {
|
||||
)
|
||||
.toMatchObject({ overflow: expect.any(Number), footerFits: true, footerVisible: true });
|
||||
await expect
|
||||
.poll(() => dialog.locator("[class*='editForm_']").evaluate((el) => el.scrollWidth - el.clientWidth))
|
||||
.poll(() => dialog.locator("[class*='_formSettings_']").evaluate((el) => el.scrollWidth - el.clientWidth))
|
||||
.toBeLessThanOrEqual(1);
|
||||
const tasks = dialog.getByRole("list");
|
||||
await tasks.scrollIntoViewIfNeeded();
|
||||
|
||||
@@ -507,7 +507,7 @@ export function ConfigForm({ config, all, type, errors, template, onChange, modi
|
||||
{config.kind === "tomcat" ? (
|
||||
<TomcatSettings config={config} onChange={onChange} />
|
||||
) : (
|
||||
<>
|
||||
<div className={styles.formSettings}>
|
||||
{!noProcess && (
|
||||
<Field
|
||||
label="Run on"
|
||||
@@ -860,7 +860,7 @@ export function ConfigForm({ config, all, type, errors, template, onChange, modi
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -665,22 +665,39 @@
|
||||
gap: var(--space-2);
|
||||
}
|
||||
.configFields {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-columns: fit-content(40%) minmax(0, 1fr);
|
||||
grid-template-rows: [notice] auto [header] auto [options] minmax(0, 1fr);
|
||||
column-gap: var(--space-3);
|
||||
row-gap: var(--space-2);
|
||||
align-content: start;
|
||||
min-width: 0;
|
||||
}
|
||||
.configFields > * {
|
||||
.configFields > *,
|
||||
.formSettings > * {
|
||||
grid-column: 1 / -1;
|
||||
min-width: 0;
|
||||
}
|
||||
.configFields:not(.configFieldsTomcat) > .field,
|
||||
.configFields > .notice {
|
||||
grid-row: notice;
|
||||
}
|
||||
.configFields:not(.configFieldsTomcat) > .notice,
|
||||
.configFields:not(.configFieldsTomcat) > .formHeader {
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
.configFields:not(.configFieldsTomcat) > .formHeader,
|
||||
.configFields:not(.configFieldsTomcat) > .formHeader > .field {
|
||||
.configFields:not(.configFieldsTomcat) > .formHeader > .field,
|
||||
.formSettings > .field {
|
||||
grid-template-columns: subgrid;
|
||||
}
|
||||
.formSettings {
|
||||
display: grid;
|
||||
grid-row: options;
|
||||
grid-template-columns: subgrid;
|
||||
row-gap: var(--space-2);
|
||||
align-content: start;
|
||||
overflow: auto;
|
||||
}
|
||||
.formHeader > .field {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
@@ -688,8 +705,6 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
.configFieldsTomcat {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-2);
|
||||
@@ -793,6 +808,7 @@
|
||||
}
|
||||
.formHeader {
|
||||
display: grid;
|
||||
grid-row: header;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: var(--space-4);
|
||||
|
||||
Reference in New Issue
Block a user