Sha256: c3265861d302583afaeb30849944899e3adb9f0c02159eac00e2a542bfe145db

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

import { describe, it, expect } from "vitest"
import { Heading } from "./heading"
import { Text } from "./text"

describe("Heading", () => {
  it("returns empty string if no params", () => {
    expect(new Heading(1).render).toBe("<h1 ></h1>")
  })

  it("returns attributes and data attributes", () => {
    expect(new Heading(1, { id: "1", "data-foo": "bar" }).render).toBe(`<h1 id='1' data-foo='bar'></h1>`)
  })

  it("returns attributes and data attributes with custom data attributes", () => {
    expect(new Heading(1, { id: "1", data: { foo: "bar" } }).render).toBe(`<h1 id='1' data-foo='bar'></h1>`)
    expect(new Heading(1, { id: "1", data: { foo: "bar", baz: "qux" } }).render).toBe(`<h1 id='1' data-foo='bar' data-baz='qux'></h1>`)
    expect(new Heading(1, { id: "1", data: { foo: { baz: "qux", quux: "corge" } } }).render).toBe(`<h1 id='1' data-foo-baz='qux' data-foo-quux='corge'></h1>`)
  })

  it("adds children", () => {
    expect(new Heading(1).add(new Text("Hello")).render).toBe(`<h1 >Hello</h1>`)
  })
})

Version data entries

17 entries across 17 versions & 1 rubygems

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