Sha256: eb9df68156243d066ab8d291f555633e6d6f61d7d15a13c0218aa5da554fca5a
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 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").renderWrapper).toBe("<select ></select>") }) it("returns attributes and data attributes", () => { expect(new Select([], {}, "foo", { id: "1", "data-foo": "bar" }).renderWrapper).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" } }).renderWrapper).toBe(`<select id='1' data-foo='bar'></select>`) expect(new Select([], {}, "foo", { id: "1", data: { foo: "bar", baz: "qux" } }).renderWrapper).toBe(`<select id='1' data-foo='bar' data-baz='qux'></select>`) expect(new Select([], {}, "foo", { id: "1", data: { foo: { baz: "qux", quux: "corge" } } }).renderWrapper).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").renderWrapper).toBe(`<select ><option value='1' selected>One</option></select>`) }) })
Version data entries
9 entries across 9 versions & 1 rubygems