forked from phenom/healer-man
Release Healer Man 0.1.42
This commit is contained in:
1 parent
c3f8a69b51
commit
c7e8163790
8 files changed
+271
-64
No files matched your search
@@ -1,10 +1,37 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
actionKeyForEvent, bindDesktopSlot, defaultUiLayout, desktopSlotForKey,
|
||||
exportUiPreferences, importUiPreferences, normalizeActionKey, normalizeUiPreferences, resolveDpsMeterDisplay,
|
||||
actionKeyForEvent, assignDesktopAbility, bindDesktopSlot, defaultUiLayout, desktopSlotForKey,
|
||||
exportUiPreferences, importUiPreferences, normalizeActionKey, normalizeUiPreferences, resetDesktopAbilities, resolveDpsMeterDisplay,
|
||||
} from "./uiLayout";
|
||||
|
||||
describe("personal UI layouts", () => {
|
||||
it("saves and clears abilities on inactive WoW bars without changing keys, templates, or mobile controls", () => {
|
||||
const ui = normalizeUiPreferences(null);
|
||||
ui.slots.pc[0] = { name: "Original", layout: ui.current.pc };
|
||||
const original = exportUiPreferences(ui);
|
||||
ui.current.pc = assignDesktopAbility(ui.current.pc, 4, 11, "test-heal");
|
||||
const saved = importUiPreferences(exportUiPreferences(ui));
|
||||
expect(saved.current.pc.bars[4].slots[11]).toEqual({ abilityId: "test-heal", key: null });
|
||||
expect(saved.current.pc.bars[0]).toEqual(JSON.parse(original).current.pc.bars[0]);
|
||||
expect(saved.current.mobile).toEqual(ui.current.mobile);
|
||||
expect(saved.slots.pc[0]?.layout.bars[4].slots[11].abilityId).toBeNull();
|
||||
expect(assignDesktopAbility(saved.current.pc, 4, 11, null).bars[4].slots[11].abilityId).toBeNull();
|
||||
});
|
||||
it("restores one or all WoW ability bars with the correct offset and retains custom keys and geometry", () => {
|
||||
let layout = defaultUiLayout();
|
||||
layout.wowBars = true; layout.barCount = 2; layout.bars[1].columns = 3;
|
||||
layout = bindDesktopSlot(layout, 1, 0, "Ctrl+KeyQ");
|
||||
layout = assignDesktopAbility(assignDesktopAbility(layout, 0, 0, "custom-one"), 1, 0, "custom-two");
|
||||
const defaults = Array.from({ length: 14 }, (_, i) => `spell-${i}`);
|
||||
const bar = resetDesktopAbilities(layout, defaults, 1);
|
||||
expect(bar.bars[0]).toEqual(layout.bars[0]);
|
||||
expect(bar.bars[1].slots[0]).toEqual({ abilityId: "spell-12", key: "Ctrl+KeyQ" });
|
||||
expect(bar.bars[1].slots[2].abilityId).toBeNull();
|
||||
const all = resetDesktopAbilities(bar, defaults);
|
||||
expect(all.bars[0].slots[0]).toEqual({ abilityId: "spell-0", key: "Digit1" });
|
||||
expect(all.bars[1].columns).toBe(3);
|
||||
expect(all.wowBars).toBe(true); expect(all.barCount).toBe(2);
|
||||
});
|
||||
it("defaults DPS to PC lower-left flow and the Thor companion, with saved overrides", () => {
|
||||
const ui = normalizeUiPreferences(null);
|
||||
expect(ui.current.pc.elements.dps).toEqual({ visible: true, position: null, width: null });
|
||||
|
||||
Reference in new issue
Block a user