Sha256: 494aceb469950d121019974fe57cc7c04d6a64eab1c2782b2af03a0809a1c7c0

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

import { describe, it, expect } from "vitest"
import { Paragraph } from "./paragraph"
import { Text } from "./text"

describe("Paragraph", () => {
  it("returns empty string if no params", () => {
    expect(new Paragraph().renderWrapper).toBe("<p ></p>")
  })

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

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

  it("adds children", () => {
    const text = new Text("Hello")
    const paragraph = new Paragraph()
    paragraph.add(text)
    expect(paragraph.renderWrapper).toBe(`<p >Hello</p>`)
  })
})

Version data entries

9 entries across 9 versions & 1 rubygems

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