Sha256: 32febe336ec5c671e2e2359f5a006154f06bc771d93caea276069db7caf4742e

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

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().renderWrapper).toBe("<div ></div>")
  })

  it("returns attributes and data attributes", () => {
    expect(new Box({ id: "1", "data-foo": "bar" }).renderWrapper).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" } }).renderWrapper).toBe(`<div id='1' data-foo='bar'></div>`)
    expect(new Box({ id: "1", data: { foo: "bar", baz: "qux" } }).renderWrapper).toBe(`<div id='1' data-foo='bar' data-baz='qux'></div>`)
    expect(new Box({ id: "1", data: { foo: { baz: "qux", quux: "corge" } } }).renderWrapper).toBe(`<div id='1' data-foo-baz='qux' data-foo-quux='corge'></div>`)
  })

  it("adds children", () => {
    expect(new Box().add(new Text("Hello, world!")).renderWrapper).toBe(`<div >Hello, world!</div>`)
  })
})

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
clapton-0.0.24 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.23 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.22 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.21 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.20 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.19 lib/clapton/javascripts/src/components/box.spec.ts
clapton-0.0.18 lib/clapton/javascripts/src/components/box.spec.ts