test(editor): cover the Rearrange code row in the Actions on Save layout test (#7992)

#7934 added Rearrange code to Settings > Actions on Save, so the table has five rows, but actionsOnSaveLayout.spec.ts still expected four and failed on main. The test now expects the new row, includes it in the alignment checks and asserts its trigger cell stays empty while the action is off.

Co-authored-by: Greenker <[email protected]>
Цей коміт міститься в:
Mollo-i authored and GitHub committed 2026-12-04 16:58:45 +08:00
1 джерело b640078b11
коміт 70a4fbec3a
1 file changed
+4 -2
+4 -2
Переглянути файл
@@ -20,13 +20,15 @@ test("Actions on Save aligns each enabled action with its trigger in wide and na
const heading = table.getByRole("columnheader", { name: "Activated on", exact: true });
const format = table.getByRole("row", { name: /Reformat code/ });
const imports = table.getByRole("row", { name: /Optimize imports/ });
const rearrange = table.getByRole("row", { name: /Rearrange code/ });
const cleanup = table.getByRole("row", { name: /Run code cleanup/ });
const trigger = (action: typeof format) => action.getByRole("cell").nth(1);
await expect(table.getByRole("row")).toHaveCount(4);
await expect(table.getByRole("row")).toHaveCount(5);
await format.getByRole("checkbox").check();
await imports.getByRole("checkbox").press("Space");
await expect(trigger(format)).toHaveText("Save or Save All");
await expect(trigger(imports)).toHaveText("Save or Save All");
await expect(trigger(rearrange)).toBeEmpty();
await expect(trigger(cleanup)).toBeEmpty();
for (const width of [1120, 520]) {
@@ -42,7 +44,7 @@ test("Actions on Save aligns each enabled action with its trigger in wide and na
return range.getClientRects().length;
}),
).toBe(1);
for (const row of [format, imports, cleanup]) {
for (const row of [format, imports, rearrange, cleanup]) {
const cell = (await trigger(row).boundingBox())!;
expect(Math.abs(column.x - cell.x)).toBeLessThan(1);
expect(Math.abs(column.width - cell.width)).toBeLessThan(1);