Sha256: 3c3c75624517fd9da01ac0c8ff518b99d3288057b2833e7aa9265ac9a66ffc69
Contents?: true
Size: 1.08 KB
Versions: 9
Compression:
Stored size: 1.08 KB
Contents
import { describe, it, expect } from "vitest" import { Text } from "./text" import { Span } from "./span" describe("Span", () => { it("returns empty string if no params", () => { expect(new Span().renderWrapper).toBe("<span ></span>") }) it("returns attributes and data attributes", () => { expect(new Span({ id: "1", "data-foo": "bar" }).renderWrapper).toBe(`<span id='1' data-foo='bar'></span>`) }) it("returns attributes and data attributes with custom data attributes", () => { expect(new Span({ id: "1", data: { foo: "bar" } }).renderWrapper).toBe(`<span id='1' data-foo='bar'></span>`) expect(new Span({ id: "1", data: { foo: "bar", baz: "qux" } }).renderWrapper).toBe(`<span id='1' data-foo='bar' data-baz='qux'></span>`) expect(new Span({ id: "1", data: { foo: { baz: "qux", quux: "corge" } } }).renderWrapper).toBe(`<span id='1' data-foo-baz='qux' data-foo-quux='corge'></span>`) }) it("adds children", () => { const text = new Text("Hello") const span = new Span() span.add(text) expect(span.renderWrapper).toBe(`<span >Hello</span>`) }) })
Version data entries
9 entries across 9 versions & 1 rubygems