Sha256: f336fe50ac1e7b4e71732256fec340eb2ce3037a7b5d4e8473582919572fad08

Contents?: true

Size: 841 Bytes

Versions: 17

Compression:

Stored size: 841 Bytes

Contents

import { describe, it, expect } from "vitest"
import { RadioButton } from "./radio-button"

describe("RadioButton", () => {
  it("returns empty string if no params", () => {
    expect(new RadioButton({}, "foo").render).toBe("<input type='radio' data-attribute='foo' value=''/>")
  })

  it("returns attributes and data attributes", () => {
    expect(new RadioButton({ foo: "bar" }, "foo", { id: "1", "data-foo": "bar" }).render).toBe(`<input type='radio' id='1' data-foo='bar' data-attribute='foo' value='bar'/>`)
  })

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

Version data entries

17 entries across 17 versions & 1 rubygems

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