Compare commits

...
Author SHA1 Message Date
l0ng-ai 5ce76a970c fix(debugger): group line breakpoint actions 2026-11-22 12:22:45 +08:00
3 changed files with 70 additions and 35 deletions

No files matched your search

+12 -3
View File
@@ -18,18 +18,27 @@ test("keeps breakpoint details editable when the dialog gets narrow", async ({ w
const list = dialog.getByRole("listbox", { name: "All breakpoints" });
const condition = dialog.locator('input[aria-label="Condition"]');
await expect(condition).toHaveValue("amount > 100");
const actions = dialog.getByRole("group", { name: "Actions", exact: true });
await expect(actions).toBeVisible();
await expect(dialog.getByText("Condition", { exact: true })).toHaveCSS("font-size", "13px");
await expect(dialog.getByText("Hit count", { exact: true })).toHaveCSS("font-size", "13px");
await expect.poll(async () => (await condition.boundingBox())?.width ?? 0).toBeGreaterThanOrEqual(240);
await expect(dialog.getByRole("button", { name: "Done", exact: true })).toBeInViewport({ ratio: 1 });
await condition.fill("amount > 250");
await dialog.getByRole("checkbox", { name: "Evaluate and log", exact: true }).check();
await dialog.getByRole("textbox", { name: "Evaluate and log", exact: true }).fill("total: {amount}");
await actions.getByRole("checkbox", { name: '"Breakpoint hit" message', exact: true }).check();
await actions.getByRole("checkbox", { name: "Evaluate and log", exact: true }).check();
const log = actions.getByRole("textbox", { name: "Evaluate and log", exact: true });
await log.fill("total: {amount}");
const temporary = actions.getByRole("checkbox", { name: "Remove once hit", exact: true });
await temporary.check();
const first = list.getByRole("option", { name: /CheckInternationalSettlementBeforeDispatch\.java:8/ });
await expect(first.getByText(":8", { exact: true })).toBeInViewport({ ratio: 1 });
await list.getByRole("option", { name: /Receipt\.java:5/ }).click();
await expect(condition).toHaveValue("");
await first.click();
await expect(condition).toHaveValue("amount > 250");
await expect(dialog.getByRole("textbox", { name: "Evaluate and log", exact: true })).toHaveValue("total: {amount}");
await expect(log).toHaveValue("total: {amount}");
await expect(temporary).toBeChecked();
await page.setViewportSize({ width: 1080, height: 760 });
const divider = dialog.locator('[data-separator][aria-orientation="vertical"]');
+18 -1
View File
@@ -29,6 +29,23 @@
gap: var(--space-2);
}
.bpActions {
display: flex;
flex-direction: column;
gap: var(--space-2);
min-width: 0;
margin: 0;
padding: var(--space-2) var(--space-3);
border: 1px solid var(--border);
border-radius: var(--radius-small);
}
.bpActions > legend {
padding-inline: var(--space-1);
color: var(--fg-muted);
font-size: var(--fs-ui);
}
.bpTitle {
display: flex;
align-items: center;
@@ -212,7 +229,7 @@
font-family: var(--font-ui);
}
.detail .label {
:is(.detail, .bpEditor) .label {
font-size: var(--fs-ui);
}
+40 -31
View File
@@ -192,12 +192,14 @@ function BreakpointFields({
focus,
onEnter,
commitRef,
showRemoveOnceHit = false,
}: {
path: string;
bp: BreakpointEntry;
focus?: "condition" | "log";
onEnter?: () => void;
commitRef?: MutableRefObject<(() => void) | null>;
showRemoveOnceHit?: boolean;
}) {
const [condition, setCondition] = useState(bp.condition ?? "");
const [hitCondition, setHitCondition] = useState(bp.hitCondition ?? "");
@@ -288,32 +290,44 @@ function BreakpointFields({
aria-label="Hit count condition"
/>
</label>
<Checkbox
checked={!!bp.logHit}
onChange={(on) => updateBreakpoint(path, bp.id, { logHit: on || undefined })}
label={'"Breakpoint hit" message'}
/>
<Checkbox
checked={logEval}
onChange={(on) => {
setLogEval(on);
draft.current = { ...draft.current, logEval: on };
commitText();
}}
label="Evaluate and log"
/>
{logEval && (
<Input
mono
value={logMessage}
onChange={(e) => setLogMessage(e.target.value)}
onBlur={commitText}
onKeyDown={onKey}
placeholder="Value: {expression}"
data-autofocus={focus === "log" ? "" : undefined}
aria-label="Evaluate and log"
<fieldset className={styles.bpActions}>
<legend>
<T>Actions</T>
</legend>
<Checkbox
checked={!!bp.logHit}
onChange={(on) => updateBreakpoint(path, bp.id, { logHit: on || undefined })}
label={'"Breakpoint hit" message'}
/>
)}
<Checkbox
checked={logEval}
onChange={(on) => {
setLogEval(on);
draft.current = { ...draft.current, logEval: on };
commitText();
}}
label="Evaluate and log"
/>
{logEval && (
<Input
mono
value={logMessage}
onChange={(e) => setLogMessage(e.target.value)}
onBlur={commitText}
onKeyDown={onKey}
placeholder="Value: {expression}"
data-autofocus={focus === "log" ? "" : undefined}
aria-label="Evaluate and log"
/>
)}
{showRemoveOnceHit && (
<Checkbox
checked={!!bp.temporary}
onChange={(temporary) => updateBreakpoint(path, bp.id, { temporary })}
label="Remove once hit"
/>
)}
</fieldset>
</>
);
}
@@ -751,12 +765,7 @@ function BreakpointDetail({
</Button>
</div>
{st && <div className={styles.statusLine}>{st.verified ? tx("Verified") : (st.message ?? "Not verified")}</div>}
<BreakpointFields path={path} bp={bp} commitRef={commitRef} />
<Checkbox
checked={!!bp.temporary}
onChange={(temporary) => updateBreakpoint(path, bp.id, { temporary })}
label="Remove once hit"
/>
<BreakpointFields path={path} bp={bp} commitRef={commitRef} showRemoveOnceHit />
</div>
);
}