Skip to content

Commit

Permalink
Add tests for widgets at the side of mark decorations
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Feb 19, 2024
1 parent aedb43c commit 32a6cb0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/webtest-draw-decoration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,18 @@ describe("EditorView decoration", () => {
ist(cm.contentDOM.querySelectorAll(".b").length, 1)
})

it("includes negative-side widgets in marks that end at their position", () => {
let cm = tempView("123", [decos(Decoration.set([w(2, new WordWidget("x"), -1)])),
decos(Decoration.set([d(0, 2, {tagName: "em", inclusive: true})]))])
ist(cm.contentDOM.querySelector("em")!.textContent, "12x")
})

it("includes positive-side widgets in marks that start at their position", () => {
let cm = tempView("123", [decos(Decoration.set([w(1, new WordWidget("x"), 1)])),
decos(Decoration.set([d(1, 3, {tagName: "em", inclusive: true})]))])
ist(cm.contentDOM.querySelector("em")!.textContent, "x23")
})

it("wraps widgets even when the mark starts at the same offset", () => {
let repl = Decoration.replace({widget: new WordWidget("X"),
inclusive: false})
Expand Down

0 comments on commit 32a6cb0

Please sign in to comment.