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