21 lines
571 B
TypeScript
21 lines
571 B
TypeScript
import assert from "node:assert/strict"
|
|
import { describe, it } from "node:test"
|
|
import { isEmptyTipTapDoc } from "./richtext-content.ts"
|
|
|
|
describe("richtext-content", () => {
|
|
it("detects empty TipTap documents", () => {
|
|
assert.equal(isEmptyTipTapDoc(undefined), true)
|
|
assert.equal(
|
|
isEmptyTipTapDoc({ type: "doc", content: [{ type: "paragraph" }] }),
|
|
true
|
|
)
|
|
assert.equal(
|
|
isEmptyTipTapDoc({
|
|
type: "doc",
|
|
content: [{ type: "paragraph", content: [{ type: "text", text: "Hello" }] }],
|
|
}),
|
|
false
|
|
)
|
|
})
|
|
})
|