describe("3x3 GridBox", () => {
const colors = Matrix.from([
["red", "green", "blue" ],
["gray", "orange", "fuchsia"],
["aqua", "maroon", "yellow" ],
])
it("fixed spacers 50px x 50px", async () => {
const s0 = spacer("fixed", "fixed", 50, 50)
const items = colors.apply([
[s0, s0, s0],
[s0, s0, s0],
[s0, s0, s0],
])
const l = grid(items)
await display(l, [300, 300])
})
it("fixed spacers 50px x 50px, spacing 5px", async () => {
const s0 = spacer("fixed", "fixed", 50, 50)
const items = colors.apply([
[s0, s0, s0],
[s0, s0, s0],
[s0, s0, s0],
])
const l = grid(items, {spacing: 5})
await display(l, [300, 300])
})
it("fixed spacers 50px x 50px, hspacing 5px, vspacing 10px", async () => {
const s0 = spacer("fixed", "fixed", 50, 50)
const items = colors.apply([
[s0, s0, s0],
[s0, s0, s0],
[s0, s0, s0],
])
const l = grid(items, {spacing: [5, 10]})
await display(l, [300, 300])
})
it("fixed and 1 x-max spacers, c2 auto", async () => {
const s0 = spacer("fixed", "fixed", 50, 50)
const s1 = spacer("max", "fixed", 50, 50)
const items = colors.apply([
[s0, s0, s1],
[s0, s0, s0],
[s0, s0, s0],
])
const l = grid(items, {cols: {2: {policy: "auto"}}})
await display(l, [300, 300])
})
it("fixed and 2 x-max spacers, c2 auto", async () => {
const s0 = spacer("fixed", "fixed", 50, 50)
const s1 = spacer("max", "fixed", 50, 50)
const items = colors.apply([
[s0, s1, s1],
[s0, s0, s0],
[s0, s0, s0],
])
const l = grid(items, {cols: {2: {policy: "auto"}}})
await display(l, [300, 300])
})
it("fixed and 2 x-max spacers, c2 flex=2", async () => {
const s0 = spacer("fixed", "fixed", 50, 50)
const s1 = spacer("max", "fixed", 50, 50)
const items = colors.apply([
[s0, s1, s1],
[s0, s0, s0],
[s0, s0, s0],
])
const l = grid(items, {cols: {2: {policy: "flex", factor: 2}}})
await display(l, [300, 300])
})
it("fixed and 3 x-max spacers, c2 flex=2", async () => {
const s0 = spacer("fixed", "fixed", 50, 50)
const s1 = spacer("max", "fixed", 50, 50)
const items = colors.apply([
[s1, s1, s1],
[s0, s0, s0],
[s0, s0, s0],
])
const l = grid(items, {cols: {2: {policy: "flex", factor: 2}}})
await display(l, [300, 300])
//.........这里部分代码省略.........
请发表评论