Add rolemaster situational modifier modal

This commit is contained in:
2026-04-14 23:53:07 +02:00
parent 368a9a4960
commit 3e1d3746dd
12 changed files with 314 additions and 13 deletions

View File

@@ -137,6 +137,59 @@ test("Rolemaster automatic retry badge shows before detail expands", async ({ pa
await expect(detailDice.nth(1)).toHaveAttribute("title", /retry attempt 2/i);
});
test("Rolemaster skill roll modal autofocuses, validates, and closes on escape or backdrop", async ({ page, context }) => {
const username = `rm-modal-${Date.now()}`;
await registerAndLogin(context.request, username, "Rolemaster Modal Smoke");
const campaign = await postJson(context.request, "/api/campaigns", {
name: "Rolemaster Modal Smoke",
rulesetId: "rolemaster"
});
const character = await postJson(context.request, "/api/characters", {
name: "Observer",
campaignId: campaign.id
});
await postJson(context.request, `/api/characters/${character.id}/skills`, {
name: "Observation",
diceRollDefinition: "d100!+50",
wildDice: 0,
allowFumble: false,
fumbleRange: 5,
rolemasterAutoRetry: true
});
await page.goto("/");
await expect(page.getByText("Campaign Log")).toBeVisible();
const rollButton = page.getByRole("button", { name: "Roll Observation" });
const modal = page.getByRole("dialog", { name: "Rolemaster situational modifier" });
const modifierInput = page.locator("#rolemaster-situational-modifier");
await rollButton.click();
await expect(modal).toBeVisible();
await expect(modifierInput).toBeFocused();
await page.keyboard.press("Escape");
await expect(modal).toHaveCount(0);
await rollButton.click();
await expect(modal).toBeVisible();
await page.locator(".modal-overlay").click({ position: { x: 8, y: 8 } });
await expect(modal).toHaveCount(0);
await rollButton.click();
await expect(modal).toBeVisible();
await modifierInput.fill("1001");
await modal.getByRole("button", { name: "Roll" }).click();
await expect(page.getByText("Enter a whole number between -1000 and 1000.")).toBeVisible();
await expect(modal).toBeVisible();
await modifierInput.fill("");
await page.keyboard.press("Enter");
await expect(modal).toHaveCount(0);
await expect(page.locator(".log-panel .log-entry.expanded").first()).toContainText("Observation");
});
test("newly rolled log entry auto-expands", async ({ page, context }) => {
const username = `d6-log-${Date.now()}`;
await registerAndLogin(context.request, username, "D6 Auto Expand");