Skip to content

Commit

Permalink
Verify in tests that alt="" does not contain element type. (#7300)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Dec 13, 2023
1 parent 296ddb9 commit df074fb
Show file tree
Hide file tree
Showing 51 changed files with 178 additions and 175 deletions.
2 changes: 2 additions & 0 deletions app/lib/frontend/dom/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ class Image {

Image({
required this.src,

/// Note: the `alt` text of elements should not include the element type (e.g. `icon`).
required this.alt,
required this.width,
required this.height,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/frontend/templates/views/pkg/score_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ d.Node _section(ReportSection section) {
image: d.Image(
src: staticUrls
.getAssetUrl('/static/img/report-foldable-icon.svg'),
alt: 'icon to trigger folding of the section',
alt: 'trigger folding of the section',
width: 13,
height: 6,
),
Expand Down
4 changes: 2 additions & 2 deletions app/lib/frontend/templates/views/shared/search_banner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ d.Node searchBannerNode({
image: d.Image(
src: staticUrls
.getAssetUrl('/static/img/search-filters-inactive.svg'),
alt: 'icon to toggle the display of search filters (inactive)',
alt: 'toggle the display of search filters (inactive)',
width: 42,
height: 42,
),
Expand All @@ -53,7 +53,7 @@ d.Node searchBannerNode({
image: d.Image(
src: staticUrls
.getAssetUrl('/static/img/search-filters-active.svg'),
alt: 'icon to toggle the display of search filters (active)',
alt: 'toggle the display of search filters (active)',
width: 42,
height: 42,
),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/frontend/templates/views/shared/site_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ d.Node _foldableMobileLinks(String label, Iterable<d.Node> children) {
image: d.Image(
src: staticUrls
.getAssetUrl('/static/img/nav-mobile-foldable-icon.svg'),
alt: 'icon to toggle folding of the section',
alt: 'toggle folding of the section',
width: 13,
height: 6,
),
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/authorized_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -84,7 +84,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -95,7 +95,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/consent_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -84,7 +84,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -95,7 +95,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/create_publisher_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -83,7 +83,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -94,7 +94,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/error_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -78,7 +78,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -89,7 +89,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/help_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -84,7 +84,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -95,7 +95,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/landing_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -78,7 +78,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -89,7 +89,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/my_activity_log_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -93,7 +93,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -104,7 +104,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/my_liked_packages.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -94,7 +94,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -105,7 +105,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/my_packages.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h3>Dart</h3>
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Pub.dev
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a>
Expand All @@ -93,7 +93,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Flutter
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a>
Expand All @@ -104,7 +104,7 @@ <h3 class="foldable-button">
<div class="nav-container nav-help-container-mobile foldable">
<h3 class="foldable-button">
Dart
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="icon to toggle folding of the section" width="13" height="6"/>
<img class="foldable-icon" src="/static/hash-%%etag%%/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/>
</h3>
<div class="foldable-content">
<a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a>
Expand Down
Loading

0 comments on commit df074fb

Please sign in to comment.