Sha256: ec58abc471ddf9f9d8a287e27053a02a756a0cdd28082ba9a3d54c706876bdd5
Contents?: true
Size: 1007 Bytes
Versions: 17
Compression:
Stored size: 1007 Bytes
Contents
import { describe, it, expect } from "vitest" import { Box } from "./box" import { Text } from "./text" describe("Box", () => { it("returns empty string if no params", () => { expect(new Box().render).toBe("<div ></div>") }) it("returns attributes and data attributes", () => { expect(new Box({ id: "1", "data-foo": "bar" }).render).toBe(`<div id='1' data-foo='bar'></div>`) }) it("returns attributes and data attributes with custom data attributes", () => { expect(new Box({ id: "1", data: { foo: "bar" } }).render).toBe(`<div id='1' data-foo='bar'></div>`) expect(new Box({ id: "1", data: { foo: "bar", baz: "qux" } }).render).toBe(`<div id='1' data-foo='bar' data-baz='qux'></div>`) expect(new Box({ id: "1", data: { foo: { baz: "qux", quux: "corge" } } }).render).toBe(`<div id='1' data-foo-baz='qux' data-foo-quux='corge'></div>`) }) it("adds children", () => { expect(new Box().add(new Text("Hello, world!")).render).toBe(`<div >Hello, world!</div>`) }) })
Version data entries
17 entries across 17 versions & 1 rubygems