Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
timreichen committed Aug 15, 2024
1 parent 9f9ace1 commit 1bba4a7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/units/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ Deno.test("Document.title adds missing title element", () => {
assertEquals(doc.title, "foo");
assertEquals(doc.querySelector("title")?.textContent, "foo");
});

Deno.test("Document.title does not add title missing head element", () => {
const doc = new DOMParser().parseFromString(
`<!DOCTYPE html><html><head></head><body></body></html>`,
"text/html",
);
doc.head.remove();
assertEquals(doc.title, "");
doc.title = "foo";
assertEquals(doc.title, "");
assertEquals(doc.querySelector("title"), null);
});

0 comments on commit 1bba4a7

Please sign in to comment.