Release Healer Man 0.1.44
This commit is contained in:
1 parent
ccc01396cd
commit
756ee4f64a
24 files changed
+575
-46
No files matched your search
@@ -1,12 +1,27 @@
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
SpellbookPanel,
|
||||
spellbookAbilitiesForDisplay,
|
||||
type SpellbookAbilityView,
|
||||
} from "./SpellbookPanel";
|
||||
|
||||
const barState = vi.hoisted(() => ({ pcIds: [] as (string | null)[], controllerIds: [] as string[], wowBars: true }));
|
||||
vi.mock("../game/uiLayoutStore", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../game/uiLayoutStore")>();
|
||||
const { normalizeUiPreferences } = await import("../game/uiLayout");
|
||||
return { ...actual, currentUiDevice: () => "pc", useUiLayoutStore: () => {
|
||||
const preferences = normalizeUiPreferences(null);
|
||||
preferences.current.pc.wowBars = barState.wowBars;
|
||||
preferences.current.pc.bars[0].slots.forEach((slot, index) => { slot.abilityId = barState.pcIds[index] ?? null; });
|
||||
return { preferences, draft: null };
|
||||
} };
|
||||
});
|
||||
vi.mock("../game/combatStore", () => ({ useCombatStore: (selector: (state: unknown) => unknown) => selector({
|
||||
actionBindings: Object.fromEntries(barState.controllerIds.map((id, index) => [`layer:${index}`, id])),
|
||||
}) }));
|
||||
|
||||
const abilities: readonly SpellbookAbilityView[] = [
|
||||
{
|
||||
id: "known-one",
|
||||
@@ -47,6 +62,29 @@ const abilities: readonly SpellbookAbilityView[] = [
|
||||
];
|
||||
|
||||
describe("spellbook ability progression", () => {
|
||||
it("highlights only usable spells missing from the active layout and updates after assignment", () => {
|
||||
barState.wowBars = true;
|
||||
barState.pcIds = [null, null, null, null, "known-one"];
|
||||
barState.controllerIds = ["known-two"];
|
||||
try {
|
||||
const render = () => renderToStaticMarkup(createElement(SpellbookPanel, {
|
||||
abilities: [...abilities, { ...abilities[1], id: "passive", passive: true }],
|
||||
playerLevel: 1, onActivate: () => undefined, open: true, onClose: () => undefined,
|
||||
}));
|
||||
let markup = render();
|
||||
expect(markup).toContain("Known Two, unlocked, missing from action bars");
|
||||
expect(markup).not.toContain("Known One, unlocked, missing from action bars");
|
||||
expect(markup.match(/is-missing-from-bars/g)).toHaveLength(1);
|
||||
barState.pcIds[11] = "known-two";
|
||||
markup = render();
|
||||
expect(markup).not.toContain("is-missing-from-bars");
|
||||
barState.wowBars = false;
|
||||
markup = render();
|
||||
expect(markup).toContain("Known One, unlocked, missing from action bars");
|
||||
expect(markup).not.toContain("Known Two, unlocked, missing from action bars");
|
||||
expect(markup.match(/is-missing-from-bars/g)).toHaveLength(1);
|
||||
} finally { barState.pcIds = []; barState.controllerIds = []; barState.wowBars = true; }
|
||||
});
|
||||
it("renders future abilities as inspectable locked buttons with level requirements", () => {
|
||||
const markup = renderToStaticMarkup(createElement(SpellbookPanel, {
|
||||
abilities,
|
||||
|
||||
Reference in new issue
Block a user