From cc2a4c41f97fab043ca3b52b9c613f1f420ee42e Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Thu, 27 Jul 2017 01:28:11 +0300 Subject: [PATCH] build(aio): fix warning about missing `

` Fixes #17549 --- aio/content/marketing/index.html | 49 ++++++++++--------- .../post-processors/h1-checker.js | 4 +- .../post-processors/h1-checker.spec.js | 12 ++++- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/aio/content/marketing/index.html b/aio/content/marketing/index.html index afd6ef0611..362a272349 100755 --- a/aio/content/marketing/index.html +++ b/aio/content/marketing/index.html @@ -1,10 +1,10 @@ - +
- +
- +
@@ -12,31 +12,33 @@ - +
- -
One framework.
Mobile & desktop.
Get Started -
-
+ +
+ diff --git a/aio/tools/transforms/angular-base-package/post-processors/h1-checker.js b/aio/tools/transforms/angular-base-package/post-processors/h1-checker.js index 7b0200e104..d54c5b4880 100644 --- a/aio/tools/transforms/angular-base-package/post-processors/h1-checker.js +++ b/aio/tools/transforms/angular-base-package/post-processors/h1-checker.js @@ -34,5 +34,5 @@ function getText(h1) { (node.properties.ariaHidden === 'true' || node.properties['aria-hidden'] === 'true') )); - return toString(cleaned); -} \ No newline at end of file + return cleaned ? toString(cleaned) : ''; +} diff --git a/aio/tools/transforms/angular-base-package/post-processors/h1-checker.spec.js b/aio/tools/transforms/angular-base-package/post-processors/h1-checker.spec.js index ff16a4b4ff..22443afcdd 100644 --- a/aio/tools/transforms/angular-base-package/post-processors/h1-checker.spec.js +++ b/aio/tools/transforms/angular-base-package/post-processors/h1-checker.spec.js @@ -69,4 +69,14 @@ describe('h1Checker postprocessor', () => { processor.$process([doc]); expect(doc.vFile.title).toEqual('What is Angular?'); }); -}); \ No newline at end of file + + it('should not break if the h1 is empty (except for an aria-hidden anchor)', () => { + const doc = { + docType: 'a', + renderedContent: ` +

+ ` + }; + expect(() => processor.$process([doc])).not.toThrow(); + }); +});