Sha256: 942d71762d4d90ad510c17de499299d380f516dc597fda1d459268730b1df07e

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

import { describe, it, expect } from "vitest"
import { Select } from "./select"

describe("Select", () => {
  it("returns empty string if no params", () => {
    expect(new Select([], {}, "foo").render).toBe("<select ></select>")
  })

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

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

  it("returns options", () => {
    expect(new Select([{ value: "1", text: "One" }], { foo: "1" }, "foo").render).toBe(`<select ><option value='1' selected>One</option></select>`)
  })
})

Version data entries

17 entries across 17 versions & 1 rubygems

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