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

Version Path
clapton-0.0.17 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.16 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.15 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.14 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.13 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.12 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.11 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.10 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.9 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.8 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.7 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.6 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.5 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.4 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.3 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.2 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.1 lib/clapton/javascripts/src/components/box.spec.ts