mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-22 19:49:35 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f658a1da99 |
No files matched your search
+60
-75
@@ -85,6 +85,66 @@ test("⌘K commits the checked changes with the typed message", async ({ workben
|
||||
await expect(changes.getByRole("checkbox", { name: "Include build.gradle.kts in commit" })).toBeHidden();
|
||||
});
|
||||
|
||||
test("commit options align author fields and keep the date editable in a narrow dialog", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await stubRepository(page);
|
||||
await page.setViewportSize({ width: 1040, height: 700 });
|
||||
await page.keyboard.press("Meta+k");
|
||||
const panel = page.getByRole("region", { name: "Commit", exact: true });
|
||||
await panel.getByRole("button", { name: "Commit Options", exact: true }).click();
|
||||
const popup = page.getByRole("dialog", { name: "Commit Options", exact: true });
|
||||
const author = popup.getByRole("textbox", { name: "Author", exact: true });
|
||||
const date = popup.getByLabel("Author date", { exact: true });
|
||||
const clear = popup.getByRole("button", { name: "Clear author date", exact: true });
|
||||
const name = "Regional Ledger Review <[email protected]>";
|
||||
const time = "2024-06-04T13:20:21";
|
||||
await author.fill(name);
|
||||
await date.fill(time);
|
||||
const authorBox = (await author.boundingBox())!;
|
||||
const dateBox = (await date.boundingBox())!;
|
||||
const dateLabel = (await popup.getByText("Author date", { exact: true }).boundingBox())!;
|
||||
const clearBox = (await clear.boundingBox())!;
|
||||
expect(authorBox.x).toBeCloseTo(dateBox.x, 0);
|
||||
expect(dateLabel.y).toBeGreaterThanOrEqual(dateBox.y);
|
||||
expect(dateLabel.y).toBeLessThan(dateBox.y + dateBox.height);
|
||||
expect(clearBox.x + clearBox.width).toBeCloseTo(authorBox.x + authorBox.width, 0);
|
||||
await expect(clear).toBeInViewport({ ratio: 1 });
|
||||
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(popup).toBeHidden();
|
||||
await page.evaluate(async () => {
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const { settings } = useProject.getState();
|
||||
useProject.setState({
|
||||
settings: { ...settings, vcs: { ...settings?.vcs, commit: { ...settings?.vcs?.commit, nonModal: false } } },
|
||||
});
|
||||
});
|
||||
await page.setViewportSize({ width: 650, height: 650 });
|
||||
await page.keyboard.press("Meta+k");
|
||||
const dialog = page.getByRole("dialog", { name: "Commit Changes", exact: true });
|
||||
const options = dialog.getByRole("group", { name: "Commit Options", exact: true });
|
||||
const compactAuthor = options.getByRole("textbox", { name: "Author", exact: true });
|
||||
const compactDate = options.getByLabel("Author date", { exact: true });
|
||||
const compactClear = options.getByRole("button", { name: "Clear author date", exact: true });
|
||||
await expect(compactAuthor).toHaveValue(name);
|
||||
await expect(compactDate).toHaveValue(time);
|
||||
const labelBox = (await options.getByText("Author:", { exact: true }).boundingBox())!;
|
||||
const inputBox = (await compactAuthor.boundingBox())!;
|
||||
expect(inputBox.x).toBeCloseTo(labelBox.x, 0);
|
||||
expect(inputBox.y).toBeGreaterThanOrEqual(labelBox.y + labelBox.height);
|
||||
const box = (await compactDate.boundingBox())!;
|
||||
const buttonBox = (await compactClear.boundingBox())!;
|
||||
expect(box.width).toBeCloseTo(inputBox.width, 0);
|
||||
expect(buttonBox.y).toBeGreaterThanOrEqual(box.y + box.height);
|
||||
expect(await options.evaluate((node) => node.scrollWidth - node.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await compactClear.click();
|
||||
await expect(compactDate).toHaveValue("");
|
||||
await expect(compactClear).toBeHidden();
|
||||
await expect(compactAuthor).toHaveValue(name);
|
||||
});
|
||||
|
||||
test("the Commit window gives its message preferred focus", async ({ workbench: page }) => {
|
||||
await stubRepository(page);
|
||||
const stripe = page.locator('[data-stripe-button="commit"]');
|
||||
@@ -720,81 +780,6 @@ test("Commit Options applies a named TODO filter independently of the TODO windo
|
||||
expect(await ipcCalls(page, "vcs_commit")).toEqual([]);
|
||||
});
|
||||
|
||||
test("commit check text scrolls independently of its status icon and retry action", async ({ workbench: page }) => {
|
||||
await stubRepository(page);
|
||||
await page.setViewportSize({ width: 850, height: 650 });
|
||||
await page.evaluate(async () => {
|
||||
const registryPath = "/src/features/vcs/commitCheckRegistry.ts";
|
||||
const layoutPath = "/src/workbench/toolwindows/store.ts";
|
||||
const { registerCommitCheck } = await import(/* @vite-ignore */ registryPath);
|
||||
const layout = await import(/* @vite-ignore */ layoutPath);
|
||||
layout.moveToolWindow("commit", "left");
|
||||
layout.setToolWindowSize("left", 238);
|
||||
for (let index = 0; index < 6; index++) {
|
||||
registerCommitCheck({
|
||||
id: `test.commitLayout.${index}`,
|
||||
order: index - 1000,
|
||||
title: `Ledger check ${index + 1}`,
|
||||
run: () => {
|
||||
if (index === 0) document.body.dataset.checkRuns = String(Number(document.body.dataset.checkRuns ?? 0) + 1);
|
||||
return {
|
||||
severity: "error",
|
||||
text: "The regional settlement totals differ from the monthly inventory audit and need a second review.",
|
||||
fix:
|
||||
index === 5
|
||||
? {
|
||||
label: "Review final check",
|
||||
run: () => {
|
||||
document.body.dataset.commitCheckReviewed = "yes";
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
await page.keyboard.press("Meta+k");
|
||||
const commit = page.getByRole("region", { name: "Commit", exact: true });
|
||||
await commit.getByRole("textbox", { name: "Commit message" }).fill("Review the settlement totals");
|
||||
await commit.getByRole("button", { name: "Commit Options", exact: true }).click();
|
||||
const options = page.getByRole("dialog", { name: "Commit Options", exact: true });
|
||||
await options.getByRole("button", { name: "Run Commit Checks", exact: true }).click();
|
||||
|
||||
const feedback = commit.getByRole("alert").filter({ hasText: "Ledger check 1" });
|
||||
const first = feedback.getByText("Ledger check 1", { exact: true });
|
||||
const second = feedback.getByText("Ledger check 2", { exact: true });
|
||||
const results = first.locator("../..");
|
||||
const icon = feedback.locator("svg").first();
|
||||
const retry = commit.getByRole("button", { name: "Rerun Commit Checks", exact: true });
|
||||
const commitAnyway = commit.getByRole("button", { name: "Commit Anyway", exact: true });
|
||||
await expect(commitAnyway).toBeInViewport({ ratio: 1 });
|
||||
await expect(first).toHaveCSS("font-size", "13px");
|
||||
const firstRow = (await first.locator("..").boundingBox())!;
|
||||
const secondRow = (await second.locator("..").boundingBox())!;
|
||||
expect(secondRow.y - (firstRow.y + firstRow.height)).toBeCloseTo(4, 0);
|
||||
expect(await results.evaluate((node) => node.scrollHeight > node.clientHeight)).toBe(true);
|
||||
const statusTop = (await icon.boundingBox())!.y;
|
||||
const retryTop = (await retry.boundingBox())!.y;
|
||||
await results.evaluate((node) => {
|
||||
node.scrollTop = node.scrollHeight;
|
||||
});
|
||||
expect(await results.evaluate((node) => node.scrollTop)).toBeGreaterThan(0);
|
||||
expect((await icon.boundingBox())!.y).toBeCloseTo(statusTop, 0);
|
||||
expect((await retry.boundingBox())!.y).toBeCloseTo(retryTop, 0);
|
||||
const details = feedback.getByRole("button", { name: "Review final check", exact: true });
|
||||
await expect(details).toBeInViewport({ ratio: 1 });
|
||||
await expect(icon).toBeInViewport({ ratio: 1 });
|
||||
await expect(retry).toBeInViewport({ ratio: 1 });
|
||||
await expect(commitAnyway).toBeInViewport({ ratio: 1 });
|
||||
await details.click();
|
||||
await expect(page.locator("body")).toHaveAttribute("data-commit-check-reviewed", "yes");
|
||||
await retry.click();
|
||||
await expect(page.locator("body")).toHaveAttribute("data-check-runs", "2");
|
||||
await expect(first).toBeVisible();
|
||||
expect(await ipcCalls(page, "vcs_commit")).toEqual([]);
|
||||
});
|
||||
|
||||
test("the TODO check reports unreadable files and can retry after they become available", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
|
||||
@@ -33,15 +33,17 @@ export function CommitAuthorFields({
|
||||
focusAuthor?: boolean;
|
||||
onChange: (update: Partial<CommitAuthor>) => void;
|
||||
}) {
|
||||
const authorId = useId();
|
||||
const authorDateId = useId();
|
||||
const date = authorDate ? new Date(authorDate) : null;
|
||||
return (
|
||||
<>
|
||||
<label className={styles.optField}>
|
||||
<span>
|
||||
<div className={styles.optIdentity}>
|
||||
<div className={styles.optIdentityFields}>
|
||||
<label htmlFor={authorId}>
|
||||
<T>Author:</T>
|
||||
</span>
|
||||
</label>
|
||||
<Input
|
||||
id={authorId}
|
||||
value={author}
|
||||
title={tx(
|
||||
preserveOriginal
|
||||
@@ -53,8 +55,6 @@ export function CommitAuthorFields({
|
||||
autoSelect={focusAuthor}
|
||||
onChange={(e) => onChange({ author: e.target.value })}
|
||||
/>
|
||||
</label>
|
||||
<div className={styles.optDate}>
|
||||
<label htmlFor={authorDateId}>
|
||||
<T>Author date</T>
|
||||
</label>
|
||||
@@ -81,6 +81,6 @@ export function CommitAuthorFields({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -309,7 +309,7 @@
|
||||
}
|
||||
/* Commit Options popup (gear next to Commit). */
|
||||
.options {
|
||||
width: 340px;
|
||||
width: 384px;
|
||||
max-height: min(560px, 80vh);
|
||||
overflow: auto;
|
||||
padding: 4px 16px 12px;
|
||||
@@ -350,29 +350,35 @@
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.optField {
|
||||
display: flex;
|
||||
.optIdentity {
|
||||
container-type: inline-size;
|
||||
}
|
||||
.optIdentityFields {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
gap: var(--space-1) var(--space-2);
|
||||
color: var(--fg);
|
||||
font-size: var(--fs-ui);
|
||||
}
|
||||
.optField > :last-child {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
.optIdentityFields > label {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.optDate {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1);
|
||||
color: var(--fg);
|
||||
@container (min-width: 328px) {
|
||||
.optIdentityFields {
|
||||
grid-template-columns: fit-content(32%) minmax(0, 1fr);
|
||||
row-gap: var(--space-1-5);
|
||||
}
|
||||
}
|
||||
.optDateInput {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
.optDateInput input {
|
||||
flex: 1;
|
||||
flex: 1 1 min(100%, 212px);
|
||||
min-width: 0;
|
||||
}
|
||||
.optLink {
|
||||
@@ -403,28 +409,24 @@
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-1);
|
||||
min-height: var(--h-control-small);
|
||||
}
|
||||
.checkFeedback > .checkProblems {
|
||||
align-self: stretch;
|
||||
flex: 1;
|
||||
}
|
||||
.checkFeedback .checkProblemsList {
|
||||
align-self: stretch;
|
||||
}
|
||||
.checkFeedback > button {
|
||||
flex: none;
|
||||
}
|
||||
.checkProblems {
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-1-5);
|
||||
min-width: 0;
|
||||
padding: var(--space-1) 10px 0;
|
||||
max-height: 120px;
|
||||
overflow: auto;
|
||||
padding: 4px 10px 0;
|
||||
color: var(--fg-secondary);
|
||||
overflow-wrap: anywhere;
|
||||
font-size: var(--fs-ui);
|
||||
font-size: var(--fs-small);
|
||||
line-height: 1.4;
|
||||
}
|
||||
.checkProblemsIcon {
|
||||
@@ -438,21 +440,13 @@
|
||||
color: var(--success);
|
||||
}
|
||||
.checkProblemsList {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-1);
|
||||
min-width: 0;
|
||||
max-height: 150px;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
.checkProblemTitle {
|
||||
color: var(--fg);
|
||||
}
|
||||
.checkProblemLink {
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
text-align: start;
|
||||
border: 0;
|
||||
background: none;
|
||||
color: var(--accent);
|
||||
|
||||
Reference in new issue
Block a user