feat: add support for partial <head> merging (#1863)

This commit is contained in:
Marvin Hagemeister
2023-10-05 12:04:38 +02:00
committed by GitHub
parent fd4a2b99ef
commit b3a3bd1069
8 changed files with 297 additions and 104 deletions
+24
View File
@@ -562,3 +562,27 @@ export function assertNoComments(doc: Document) {
);
}
}
export function assertMetaContent(
doc: Document,
nameOrProperty: string,
expected: string,
) {
let el = doc.querySelector(`meta[name="${nameOrProperty}"]`) as
| HTMLMetaElement
| null;
if (el === null) {
el = doc.querySelector(`meta[property="${nameOrProperty}"]`) as
| HTMLMetaElement
| null;
}
if (el === null) {
console.log(prettyDom(doc));
throw new Error(
`No <meta>-tag found with content "${expected}"`,
);
}
assertEquals(el.content, expected);
}