Release Healer Man 0.1.44

This commit is contained in:
phenom committed 2026-09-14 22:12:49 -04:00
1 parent ccc01396cd
commit 756ee4f64a
24 files changed
+575 -46

No files matched your search

+56
View File
@@ -3,9 +3,64 @@ import {
actionKeyForEvent, assignDesktopAbility, bindDesktopSlot, defaultUiLayout, desktopSlotForKey,
exportUiPreferences, importUiPreferences, normalizeActionKey, normalizeUiPreferences, resetDesktopAbilities, resolveDpsMeterDisplay,
HUD_ELEMENTS, resolveHudScreen,
activateDesktopAbilityLoadout, assignedActionBarAbilityIds,
} from "./uiLayout";
describe("personal UI layouts", () => {
it("populates fresh PC bars without changing shared keys, geometry, templates, or mobile controls", () => {
const ui = normalizeUiPreferences(null);
ui.current.pc.wowBars = true;
ui.current.pc.barCount = 2;
ui.current.pc.bars[1].columns = 3;
ui.current.pc = bindDesktopSlot(ui.current.pc, 1, 0, "Ctrl+KeyQ");
ui.slots.pc[0] = { name: "Raid", layout: ui.current.pc };
const defaults = Array.from({ length: 14 }, (_, i) => `spell-${i}`);
const activated = activateDesktopAbilityLoadout(ui, "new:priest:", defaults, defaults);
expect(activated.current.pc.bars[0].slots[0]).toEqual({ abilityId: "spell-0", key: "Digit1" });
expect(activated.current.pc.bars[1].slots[0]).toEqual({ abilityId: "spell-12", key: "Ctrl+KeyQ" });
expect(activated.current.pc.bars[1].columns).toBe(3);
expect(activated.current.pc.barCount).toBe(2);
expect(activated.current.pc.wowBars).toBe(true);
expect(activated.current.mobile).toEqual(ui.current.mobile);
expect(activated.slots).toEqual(ui.slots);
expect(ui.current.pc.bars[0].slots[0].abilityId).toBeNull();
});
it("restores separate character and ordered-class loadouts, including intentionally empty bars", () => {
let ui = activateDesktopAbilityLoadout(normalizeUiPreferences(null), "one:priest:", ["heal"], ["heal"]);
ui.desktopAbilityLoadouts["one:priest:"] = Array(60).fill(null);
ui = activateDesktopAbilityLoadout(ui, "two:priest:", ["heal"], ["heal"]);
expect(ui.current.pc.bars[0].slots[0].abilityId).toBe("heal");
ui = activateDesktopAbilityLoadout(ui, "one:priest:", ["heal"], ["heal"]);
expect(ui.current.pc.bars.every((bar) => bar.slots.every((slot) => slot.abilityId === null))).toBe(true);
ui = activateDesktopAbilityLoadout(ui, "one:rom-priest:rom-warrior", ["secondary-attack"], ["secondary-attack"]);
expect(ui.current.pc.bars[0].slots[0].abilityId).toBe("secondary-attack");
expect(importUiPreferences(exportUiPreferences(ui))).toEqual(ui);
});
it("adopts compatible legacy assignments once and repairs bars holding only another class's spells", () => {
const ui = normalizeUiPreferences(null);
ui.current.pc = assignDesktopAbility(ui.current.pc, 0, 2, "custom-heal");
const migrated = activateDesktopAbilityLoadout(ui, "one:priest:", ["heal"], ["heal", "custom-heal"]);
expect(migrated.current.pc.bars[0].slots[0].abilityId).toBeNull();
expect(migrated.current.pc.bars[0].slots[2].abilityId).toBe("custom-heal");
const next = activateDesktopAbilityLoadout(migrated, "two:priest:", ["heal"], ["heal", "custom-heal"]);
expect(next.current.pc.bars[0].slots[0].abilityId).toBe("heal");
expect(next.current.pc.bars[0].slots[2].abilityId).toBeNull();
const repaired = activateDesktopAbilityLoadout(ui, "new:mage:", ["fireball"], ["fireball"]);
expect(repaired.current.pc.bars[0].slots[0].abilityId).toBe("fireball");
const oldExport = JSON.parse(exportUiPreferences(ui));
delete oldExport.desktopAbilityLoadouts;
expect(importUiPreferences(JSON.stringify(oldExport)).desktopAbilityLoadouts).toEqual({});
});
it("checks the selected layout across modifier layers and active PC bars", () => {
const layout = defaultUiLayout();
layout.bars[0].slots[0].abilityId = "pc-heal";
layout.bars[1].slots[0].abilityId = "inactive-heal";
const bindings = { "primary:face-bottom": "controller-heal", "tertiary:r2": "modifier-heal" };
expect([...assignedActionBarAbilityIds(layout, bindings, false)]).toEqual(["controller-heal", "modifier-heal"]);
expect([...assignedActionBarAbilityIds(layout, bindings, true)]).toEqual(["pc-heal"]);
layout.barCount = 2;
expect(assignedActionBarAbilityIds(layout, bindings, true).has("inactive-heal")).toBe(true);
});
it("assigns every element one display, saves routing, and keeps single-display widgets available", () => {
const preferences = normalizeUiPreferences(null);
const layout = preferences.current.mobile;
@@ -117,6 +172,7 @@ describe("personal UI layouts", () => {
["invalid keys", (data: any) => { data.current.pc.bars[0].slots[0].key = "NotAKey"; }],
["duplicate chords", (data: any) => { data.current.pc.bars[0].slots[1].key = "Digit1"; }],
["missing buttons", (data: any) => { data.current.pc.bars[0].slots.pop(); }],
["invalid character bars", (data: any) => { data.desktopAbilityLoadouts = { character: ["heal"] }; }],
])("rejects %s without mutating the original preferences", (_, mutate) => {
const ui = normalizeUiPreferences(null);
const original = exportUiPreferences(ui);