fix: handle MIST movie timer actions and verify skipping
This commit is contained in:
1 parent
11f87df712
commit
11d769f466
3 files changed
+25
-2
No files matched your search
@@ -19,12 +19,14 @@ test("MIST's actual movie Skip survives a queued redraw and returns before its t
|
||||
engine.newStore();
|
||||
Object.assign(engine.store, { movielength: 63, movieplaying: "images/animations/movies/Intro_Movie.webm" });
|
||||
const completed = engine.exec({ op: "call_screen", name: "custommoviescreen", args: [], kw: {} });
|
||||
await until(() => root.querySelector(".pg-sadd")?.dataset.seen);
|
||||
const button = [...root.querySelectorAll(".pg-sbtn")].find((element) => element.textContent === "Skip");
|
||||
assert.ok(button);
|
||||
assert.equal(button.classList.contains("pg-sdisabled"), false);
|
||||
engine.screens.refresh();
|
||||
window.dispatchEvent(new window.Event("pointerdown"));
|
||||
await until(() => engine.store.movielength < 63);
|
||||
const remaining = engine.store.movielength;
|
||||
await until(() => engine.store.movielength < remaining);
|
||||
assert.equal(button.isConnected, true);
|
||||
window.dispatchEvent(new window.Event("pointerup"));
|
||||
click(button);
|
||||
|
||||
@@ -55,6 +55,22 @@ const buttons = (root) => [...root.querySelectorAll(".pg-sbtn")];
|
||||
const click = (el) => el.onclick({ stopPropagation() {}, preventDefault() {} });
|
||||
const settle = () => wait(15);
|
||||
|
||||
test("If accepts named true/false actions used by MIST's movie timer", () => {
|
||||
const { manager, store } = setup();
|
||||
try {
|
||||
const { If, SetVariable } = manager.builtins();
|
||||
const yes = SetVariable("branch", "yes"), no = SetVariable("branch", "no");
|
||||
manager.run(If(true, { __kw: { true: yes, false: no } }), null);
|
||||
assert.equal(store.branch, "yes");
|
||||
manager.run(If(false, { __kw: { true: yes, false: no } }), null);
|
||||
assert.equal(store.branch, "no");
|
||||
assert.equal(If(true, yes, no), yes);
|
||||
assert.equal(If(false, yes, no), no);
|
||||
assert.equal(If(true, null, { __kw: { false: no } }), null);
|
||||
assert.equal(If({ __kw: { expression: false, true: yes, false: no } }), no);
|
||||
} finally { manager.destroy(); }
|
||||
});
|
||||
|
||||
test("a screen renders its widgets, conditions, loops and interpolated text", () => {
|
||||
const { manager } = setup();
|
||||
manager.show("hud", [2]);
|
||||
|
||||
Reference in new issue
Block a user