fix to make test-utils work without h1 in dom

Co-authored-by: Camila Belo <camilaibs@gmail.com>
Co-authored-by: Eric Peterson <iamEAP@users.noreply.github.com>
Signed-off-by: Anders Näsman <andersn@spotify.com>
This commit is contained in:
Anders Näsman
2022-04-25 15:53:19 +02:00
parent a68de3c984
commit 3a790faa02
@@ -48,8 +48,9 @@ export const addGitFeedbackLink = (
}
// topmost h1 only contains title for whole page
const title = (dom.querySelector('article>h1') as HTMLElement).childNodes[0]
.textContent;
const title =
(dom.querySelector('article>h1') as HTMLElement)?.childNodes[0]
.textContent || '';
const issueTitle = encodeURIComponent(`Documentation Feedback: ${title}`);
const issueDesc = encodeURIComponent(
`Page source:\n${sourceAnchor.href}\n\nFeedback:`,