feat(md-deck): add vertical alignment options to layers
Expand align from l/c/r to a 3x3 grid with vertical prefixes: tl/tc/tr/bl/bc/br. Vertical position renders via flex justify-content; compact layers strings and YAML both parse the new values, and the layer editor dropdown gains corner/edge options.
This commit is contained in:
@@ -50,6 +50,25 @@ describe("layersToConfigs", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("parses combined vertical+horizontal align", () => {
|
||||
const layers = layersToConfigs([
|
||||
{ prop: "a", pos: "1,1-2,2", align: "tl" },
|
||||
{ prop: "b", pos: "1,1-2,2", align: "br" },
|
||||
{ prop: "c", pos: "1,1-2,2", align: "tc" },
|
||||
{ prop: "d", pos: "1,1-2,2", align: "bc" },
|
||||
]);
|
||||
expect(layers[0].align).toBe("tl");
|
||||
expect(layers[1].align).toBe("br");
|
||||
expect(layers[2].align).toBe("tc");
|
||||
expect(layers[3].align).toBe("bc");
|
||||
});
|
||||
|
||||
test("parses vertical+horizontal align in compact layers string", () => {
|
||||
const layers = layersToConfigs("title:1,1-4,1tl body:1,2-5,8bc");
|
||||
expect(layers[0].align).toBe("tl");
|
||||
expect(layers[1].align).toBe("bc");
|
||||
});
|
||||
|
||||
test("defaults placement when pos is missing or invalid", () => {
|
||||
const layers = layersToConfigs([{ prop: "x" }, { prop: "y", pos: "bogus" }]);
|
||||
expect(layers[0]).toMatchObject({ x1: 1, y1: 1, x2: 2, y2: 2 });
|
||||
|
||||
Reference in New Issue
Block a user