From 3a790faa0207dfd1efa6ec95feb77b9bd61ca7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20N=C3=A4sman?= Date: Mon, 25 Apr 2022 15:53:19 +0200 Subject: [PATCH] fix to make test-utils work without h1 in dom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Camila Belo Co-authored-by: Eric Peterson Signed-off-by: Anders Näsman --- .../techdocs/src/reader/transformers/addGitFeedbackLink.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts index 13befb3309..9c7865936c 100644 --- a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts +++ b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts @@ -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:`,