fix(ui): F8-06 calculator polish — drop delete-class button, reserve lock slot
- Remove the `delete <ship_class_name>` button (and `deleteClass`, `canDelete`, `.delete` CSS, `game.calculator.action.delete` i18n key) from the calculator. Delete-class lives in the ship-classes table — the broader rework will land under #53. - Bombing and cargo-capacity rows now reserve a hidden lock-slot placeholder so their value column lines up vertically with the mass/speed/attack/defence rows (which carry a lock button).
This commit is contained in:
@@ -628,4 +628,40 @@ describe("calculator-tab", () => {
|
||||
expect(ui.getByTestId("calculator-block-drive")).toHaveValue(3);
|
||||
confirm.mockRestore();
|
||||
});
|
||||
|
||||
test("does not render a delete-class button after loading a class", async () => {
|
||||
const ui = mount({
|
||||
report: makeReport({
|
||||
localShipClass: [
|
||||
{
|
||||
name: "Scout",
|
||||
drive: 3,
|
||||
armament: 0,
|
||||
weapons: 0,
|
||||
shields: 2,
|
||||
cargo: 1,
|
||||
},
|
||||
],
|
||||
} as unknown as GameReport),
|
||||
});
|
||||
await fireEvent.input(ui.getByTestId("calculator-name"), {
|
||||
target: { value: "Scout" },
|
||||
inputType: "insertReplacementText",
|
||||
});
|
||||
// The loaded class state used to render a `delete <name>` button;
|
||||
// the calculator no longer owns delete-class — issue #53 will.
|
||||
expect(ui.queryByTestId("calculator-delete")).toBeNull();
|
||||
});
|
||||
|
||||
test("bombing and cargo-capacity rows reserve the lock slot for column alignment", () => {
|
||||
const ui = mount();
|
||||
for (const id of ["calculator-out-bombing", "calculator-out-cargo-capacity"]) {
|
||||
const cell = ui.getByTestId(id).parentElement;
|
||||
expect(cell).not.toBeNull();
|
||||
// A hidden placeholder occupies the same width as the lock button
|
||||
// on the mass/speed/attack/defence rows, so the value column does
|
||||
// not drift right on the rows without a lock.
|
||||
expect(cell!.querySelector(".lock-slot")).not.toBeNull();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user