forked from phenom/healer-man
Release Healer Man 0.1.37
This commit is contained in:
1 parent
03a4e3f51c
commit
361734bc41
41 files changed
+1714
-110
No files matched your search
@@ -1,10 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
actionKeyForEvent, bindDesktopSlot, defaultUiLayout, desktopSlotForKey,
|
||||
exportUiPreferences, importUiPreferences, normalizeActionKey, normalizeUiPreferences,
|
||||
exportUiPreferences, importUiPreferences, normalizeActionKey, normalizeUiPreferences, resolveDpsMeterDisplay,
|
||||
} from "./uiLayout";
|
||||
|
||||
describe("personal UI layouts", () => {
|
||||
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 });
|
||||
expect(resolveDpsMeterDisplay(ui.current.pc, false)).toBe("main");
|
||||
expect(resolveDpsMeterDisplay(ui.current.mobile, true)).toBe("companion");
|
||||
expect(resolveDpsMeterDisplay(ui.current.pc, true)).toBe("companion");
|
||||
ui.current.mobile.dpsMeterDisplay = "main";
|
||||
ui.current.mobile.elements.dps = { visible: false, position: { x: .6, y: .7 }, width: 300 };
|
||||
expect(importUiPreferences(exportUiPreferences(ui))).toEqual(ui);
|
||||
expect(resolveDpsMeterDisplay(ui.current.mobile, true)).toBe("main");
|
||||
});
|
||||
it("imports older UI templates without a DPS meter", () => {
|
||||
const exported = JSON.parse(exportUiPreferences(normalizeUiPreferences(null)));
|
||||
for (const device of ["pc", "mobile"]) {
|
||||
delete exported.current[device].elements.dps;
|
||||
delete exported.current[device].dpsMeterDisplay;
|
||||
}
|
||||
expect(importUiPreferences(JSON.stringify(exported)).current.pc.elements.dps.visible).toBe(true);
|
||||
exported.current.pc.dpsMeterDisplay = "invalid";
|
||||
expect(() => importUiPreferences(JSON.stringify(exported))).toThrow("DPS meter display");
|
||||
});
|
||||
it("migrates old accounts to independent Mobile and PC layouts with exactly six empty slots", () => {
|
||||
const ui = normalizeUiPreferences(undefined);
|
||||
expect(ui.slots.mobile).toEqual([null, null, null]);
|
||||
|
||||
Reference in new issue
Block a user