Build CultUI slider anatomy in web reference
This commit is contained in:
parent
1846a1c2be
commit
0fb9660e8f
7 changed files with 714 additions and 126 deletions
42
web/eve-dsl.test.mjs
Normal file
42
web/eve-dsl.test.mjs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import { compileEveDsl } from "./eve-dsl.js";
|
||||
|
||||
test("compiles indentation-authored cards without end blocks", () => {
|
||||
const state = compileEveDsl(readFileSync(new URL("./fixtures/reactive-composition.eve", import.meta.url), "utf8"));
|
||||
|
||||
assert.equal(state.providerId, "gamecult.eve.reactive-demo");
|
||||
assert.equal(state.surface.root.kind, "surface");
|
||||
assert.equal(state.surface.root.children.length, 3);
|
||||
assert.equal(state.surface.root.children[0].children.length, 3);
|
||||
});
|
||||
|
||||
test("lowers fieldRow sugar into explicit label and field partitions", () => {
|
||||
const state = compileEveDsl(readFileSync(new URL("./fixtures/cultui-slider-inspector.eve", import.meta.url), "utf8"));
|
||||
const pane = state.surface.root.children[0].children[0];
|
||||
const fieldList = pane.children[0];
|
||||
const row = fieldList.children[0];
|
||||
|
||||
assert.equal(row.kind, "partition");
|
||||
assert.equal(row.props.role, "inspector.row");
|
||||
assert.equal(row.children[0].props.role, "inspector.label");
|
||||
assert.equal(row.children[1].props.role, "inspector.field");
|
||||
assert.equal(row.children[1].children[0].kind, "control.slider");
|
||||
});
|
||||
|
||||
test("preserves slider skin anatomy as retained control parts", () => {
|
||||
const state = compileEveDsl(readFileSync(new URL("./fixtures/cultui-slider-inspector.eve", import.meta.url), "utf8"));
|
||||
const skin = state.surface.styles.controlSkins["inspector.orangeSlider"];
|
||||
|
||||
assert.equal(skin.target, "slider");
|
||||
assert.deepEqual(skin.children.map(child => child.kind), [
|
||||
"control.box",
|
||||
"control.part",
|
||||
"control.part",
|
||||
"control.part",
|
||||
"control.hitArea",
|
||||
]);
|
||||
assert.equal(skin.children[3].props.name, "thumb");
|
||||
assert.equal(skin.children[3].props.bleed, 3);
|
||||
});
|
||||
Loading…
Reference in a new issue