build(aio): fix warning about missing `<h1>`

Fixes #17549
This commit is contained in:
Georgios Kalpakas 2017-07-27 01:28:11 +03:00 committed by Alex Rickabaugh
parent a11542a375
commit cc2a4c41f9
3 changed files with 38 additions and 27 deletions

View File

@ -1,10 +1,10 @@
<!--FULL HEADER BLOCK--> <!-- FULL HEADER BLOCK -->
<header> <header>
<!--BACKGROUND IMAGE--> <!-- BACKGROUND IMAGE -->
<div class="background-sky hero"></div> <div class="background-sky hero"></div>
<!--INTRO SECTION --> <!-- INTRO SECTION -->
<section id="intro"> <section id="intro">
<!-- LOGO --> <!-- LOGO -->
@ -12,31 +12,33 @@
<img src="assets/images/logos/angular/angular.svg"/> <img src="assets/images/logos/angular/angular.svg"/>
</div> </div>
<!-- CONTAINER --> <!-- CONTAINER -->
<div class="homepage-container"> <div class="homepage-container">
<!-- container content starts -->
<div class="hero-headline no-toc">One framework.<br>Mobile &amp; desktop.</div> <div class="hero-headline no-toc">One framework.<br>Mobile &amp; desktop.</div>
<a class="button hero-cta" href="guide/quickstart">Get Started</a> <a class="button hero-cta" href="guide/quickstart">Get Started</a>
</div><!-- CONTAINER END --> </div>
</section>
</section>
</header> </header>
<!-- MAIN CONTENT -->
<article> <article>
<h1 class="no-toc" style="display: none"></h1>
<div class="home-rows"> <div class="home-rows">
<!--Announcement Bar--> <!-- Announcement Bar -->
<div class="homepage-container"> <div class="homepage-container">
<div class="announcement-bar"> <div class="announcement-bar">
<img src="generated/images/marketing/home/angular-mix.png" height="40" width="151"> <img src="generated/images/marketing/home/angular-mix.png" height="40" width="151">
<p>Join us at our newest event, October 2017</p> <p>Join us at our newest event, October 2017</p>
<a class="button" href="https://angularmix.com/">Learn More</a> <a class="button" href="https://angularmix.com/">Learn More</a>
</div> </div>
</div> </div>
<!-- Group 1--> <!-- Group 1 -->
<div layout="row" layout-xs="column" class="home-row homepage-container"> <div layout="row" layout-xs="column" class="home-row homepage-container">
<div class="promo-img-container promo-1"> <div class="promo-img-container promo-1">
<div> <div>
@ -53,7 +55,8 @@
</div> </div>
</div> </div>
<hr> <hr>
<!-- Group 2-->
<!-- Group 2 -->
<div layout="row" layout-xs="column" class="home-row"> <div layout="row" layout-xs="column" class="home-row">
<div class="text-container"> <div class="text-container">
<div class="text-block"> <div class="text-block">
@ -71,7 +74,7 @@
</div> </div>
<hr> <hr>
<!-- Group 3--> <!-- Group 3 -->
<div layout="row" layout-xs="column" class="home-row"> <div layout="row" layout-xs="column" class="home-row">
<div class="promo-img-container promo-3"> <div class="promo-img-container promo-3">
<div><img src="generated/images/marketing/home/joyful-development.svg" alt="IDE example"></div> <div><img src="generated/images/marketing/home/joyful-development.svg" alt="IDE example"></div>
@ -88,9 +91,8 @@
</div> </div>
<hr> <hr>
<!-- Group 4--> <!-- Group 4 -->
<div layout="row" layout-xs="column" class="home-row"> <div layout="row" layout-xs="column" class="home-row">
<div class="text-container"> <div class="text-container">
<div class="text-block l-pad-top-2"> <div class="text-block l-pad-top-2">
<div class="text-headline">Loved by Millions</div> <div class="text-headline">Loved by Millions</div>
@ -105,20 +107,19 @@
</div> </div>
</div> </div>
<!-- CTA CARDS --> <!-- CTA CARDS -->
<div layout="row" layout-xs="column" class="home-row"> <div layout="row" layout-xs="column" class="home-row">
<a href="guide/quickstart">
<a href="guide/quickstart"> <div class="card">
<div class="card">
<img src="generated/images/marketing/home/code-icon.svg" height="70px"> <img src="generated/images/marketing/home/code-icon.svg" height="70px">
<div class="card-text-container"> <div class="card-text-container">
<div class="text-headline">Get Started</div> <div class="text-headline">Get Started</div>
<p>Start building your Angular application.</p> <p>Start building your Angular application.</p>
</div> </div>
</div> </div>
</a> </a>
</div> </div>
</div> <!-- end of home rows --> </div><!-- end of home rows -->
</article> </article>

View File

@ -34,5 +34,5 @@ function getText(h1) {
(node.properties.ariaHidden === 'true' || node.properties['aria-hidden'] === 'true') (node.properties.ariaHidden === 'true' || node.properties['aria-hidden'] === 'true')
)); ));
return toString(cleaned); return cleaned ? toString(cleaned) : '';
} }

View File

@ -69,4 +69,14 @@ describe('h1Checker postprocessor', () => {
processor.$process([doc]); processor.$process([doc]);
expect(doc.vFile.title).toEqual('What is Angular?'); expect(doc.vFile.title).toEqual('What is Angular?');
}); });
});
it('should not break if the h1 is empty (except for an aria-hidden anchor)', () => {
const doc = {
docType: 'a',
renderedContent: `
<h1><a aria-hidden="true"></a></h1>
`
};
expect(() => processor.$process([doc])).not.toThrow();
});
});