mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
fix(templates): keep postfix descriptions inside their rows (#2116)
This commit is contained in:
1 parent
63304ec9fe
commit
558ee395dc
4 files changed
+36
-2
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("postfix template descriptions remain inside their rows", async ({ workbench: page }) => {
|
||||
await page.keyboard.press("Meta+,");
|
||||
await expect(page.getByRole("dialog", { name: "Settings", exact: true })).toBeVisible();
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/features/settings/model/staging.ts";
|
||||
(await import(/* @vite-ignore */ path)).selectPage("editor.general.postfixCompletion");
|
||||
});
|
||||
const rows = page.getByRole("list", { name: "Postfix templates" }).getByRole("listitem");
|
||||
await expect(rows.first()).toBeVisible();
|
||||
for (const language of ["JavaScript / TypeScript", "Rust", "Python", "Go", "Java", "Kotlin"]) {
|
||||
await page.getByRole("tab", { name: language, exact: true }).click();
|
||||
for (const width of [1000, 640, 520]) {
|
||||
await page.setViewportSize({ width, height: 760 });
|
||||
const fits = await rows.evaluateAll((rows) =>
|
||||
rows.every((row) => {
|
||||
const bounds = row.getBoundingClientRect();
|
||||
const detail = row.lastElementChild!;
|
||||
const range = document.createRange();
|
||||
range.selectNodeContents(detail);
|
||||
return [...range.getClientRects()].every((r) => r.top >= bounds.top - 1 && r.bottom <= bounds.bottom + 1);
|
||||
}),
|
||||
);
|
||||
expect(fits).toBe(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -112,7 +112,9 @@ export function LiveTemplatesPage() {
|
||||
<span className={clsx(styles.itemLabel, isModifiedBuiltin(t.id) && styles.modified)}>
|
||||
{t.abbrev}
|
||||
</span>
|
||||
<span className={styles.itemDetail}>{t.description}</span>
|
||||
<span className={styles.itemDetail} title={t.description}>
|
||||
{t.description}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -63,7 +63,9 @@ export function PostfixPage() {
|
||||
aria-label={tx`Enable .${t.key}`}
|
||||
/>
|
||||
<span className={styles.mono}>.{t.key}</span>
|
||||
<span className={styles.itemDetail}>{t.description}</span>
|
||||
<span className={styles.itemDetail} title={t.description}>
|
||||
{t.description}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
color: var(--fg-emphasis);
|
||||
}
|
||||
.itemDetail {
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
color: var(--fg-subtle);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
Reference in new issue
Block a user