Sha256: f42cb533427c2360f74288f74ad15e3cf2eaa1e3048becdbeb88981dc6dd35c0

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

import { describe, it, expect } from "vitest"
import { Text } from "./text"
import { Quote } from "./quote"

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

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

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

  it("adds children", () => {
    const text = new Text("Hello")
    const quote = new Quote()
    quote.add(text)
    expect(quote.render).toBe(`<q >Hello</q>`)
  })
})

Version data entries

17 entries across 17 versions & 1 rubygems

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