Sha256: ec0d84c94b0c95e172a510f0277bb4058b87efa88f8f619e539c229253135ba5
Contents?: true
Size: 932 Bytes
Versions: 17
Compression:
Stored size: 932 Bytes
Contents
import { describe, it, expect } from "vitest" import { DateTimeField } from "./datetime-field" describe("DateTimeField", () => { it("returns empty string if no params", () => { expect(new DateTimeField({}, "foo").render).toBe("<input type='datetime-local' data-attribute='foo' value=''/>") }) it("returns attributes and data attributes", () => { expect(new DateTimeField({ foo: new Date("2024-10-12T12:00") }, "foo", { id: "1", "data-foo": "bar" }).render).toMatch(/<input type='datetime-local' id='1' data-foo='bar' data-attribute='foo' value='.+'\/>/) }) it("returns attributes and data attributes with custom data attributes", () => { expect(new DateTimeField({ foo: new Date("2024-10-12T12:00") }, "foo", { id: "1", data: { foo: { baz: "qux", quux: "corge" } } }).render).toMatch(/<input type='datetime-local' id='1' data-attribute='foo' data-foo-baz='qux' data-foo-quux='corge' value='.+'\/>/) }) })
Version data entries
17 entries across 17 versions & 1 rubygems