Skip to content

Commit

Permalink
Missing tooltips for versions link on package page. (dart-lang#7346)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Jan 18, 2024
1 parent e588d98 commit 9995601
Show file tree
Hide file tree
Showing 27 changed files with 74 additions and 57 deletions.
17 changes: 13 additions & 4 deletions app/lib/frontend/templates/views/pkg/header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,24 @@ List<d.Node> _releases(String package, LatestReleases releases) {
child: d.a(
href: urls.pkgPageUrl(package),
text: releases.stable.version,
title: 'View the latest version of $package',
),
),
if (releases.showPreview)
..._versionLink(
package: package,
version: releases.preview!.version,
label: 'Preview',
title: 'Preview is a stable version that depends on a prerelease SDK.',
spanTitle:
'Preview is a stable version that depends on a prerelease SDK.',
linkTitle: 'Visit $package ${releases.preview!.version} page',
),
if (releases.showPrerelease)
..._versionLink(
package: package,
version: releases.prerelease!.version,
label: 'Prerelease',
linkTitle: 'Visit $package ${releases.prerelease!.version} page',
),
];
}
Expand All @@ -76,15 +80,20 @@ List<d.Node> _versionLink({
required String package,
required String version,
required String label,
String? title,
String? spanTitle,
required String linkTitle,
}) {
return [
d.text(' / '),
d.span(
attributes: title != null ? {'title': title} : null,
attributes: spanTitle != null ? {'title': spanTitle} : null,
children: [
d.text('$label: '),
d.a(href: urls.pkgPageUrl(package, version: version), text: version),
d.a(
href: urls.pkgPageUrl(package, version: version),
text: version,
title: linkTitle,
),
],
),
];
Expand Down
1 change: 1 addition & 0 deletions app/lib/frontend/templates/views/pkg/package_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ d.Node _packageItem(
version: isLatest ? null : release.version,
),
text: release.version,
title: 'Visit ${view.name} ${release.version} page',
),
d.text(' ('),
d.xAgoTimestamp(release.published),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ d.Node versionRowNode(
child: d.a(
href: urls.pkgPageUrl(package, version: version.version),
text: version.version,
title: 'Visit $package ${version.version} page',
),
),
d.td(
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 @@ -222,11 +222,11 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="Visit oxygen 1.2.0 page">1.2.0</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
) /
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down Expand Up @@ -298,7 +298,7 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/neon">1.0.0</a>
<a href="/packages/neon" title="Visit neon 1.0.0 page">1.0.0</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_activity_log_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_admin_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_changelog_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_example_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/pkg_index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,11 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="Visit oxygen 1.2.0 page">1.2.0</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
) /
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down Expand Up @@ -548,7 +548,7 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/flutter_titanium">1.10.0</a>
<a href="/packages/flutter_titanium" title="Visit flutter_titanium 1.10.0 page">1.10.0</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_install_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_score_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_show_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
2 changes: 1 addition & 1 deletion app/test/frontend/golden/pkg_show_page_retracted.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/pkg">2.0.0</a>
<a href="/packages/pkg" title="View the latest version of pkg">2.0.0</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/pkg_show_version_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down
10 changes: 5 additions & 5 deletions app/test/frontend/golden/pkg_versions_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ <h1 class="title">
</span>
• Latest:
<span>
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="View the latest version of oxygen">1.2.0</a>
</span>
/
<span>
Prerelease:
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</span>
</div>
<div class="detail-tags-and-like">
Expand Down Expand Up @@ -237,7 +237,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
<tbody>
<tr data-version="1.2.0">
<td class="version">
<a href="/packages/oxygen/versions/1.2.0">1.2.0</a>
<a href="/packages/oxygen/versions/1.2.0" title="Visit oxygen 1.2.0 page">1.2.0</a>
</td>
<td class="badge">
<span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
Expand All @@ -259,7 +259,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
</tr>
<tr data-version="1.0.0">
<td class="version">
<a href="/packages/oxygen/versions/1.0.0">1.0.0</a>
<a href="/packages/oxygen/versions/1.0.0" title="Visit oxygen 1.0.0 page">1.0.0</a>
</td>
<td class="badge">
<span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
Expand Down Expand Up @@ -300,7 +300,7 @@ <h2 id="prerelease">Prerelease versions of oxygen</h2>
<tbody>
<tr data-version="2.0.0-dev">
<td class="version">
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
</td>
<td class="badge">
<span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
Expand Down
4 changes: 2 additions & 2 deletions app/test/frontend/golden/publisher_packages_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/neon">1.0.0</a>
<a href="/packages/neon" title="Visit neon 1.0.0 page">1.0.0</a>
(
<a class="-x-ago" href="" title="%%neon-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down Expand Up @@ -298,7 +298,7 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/flutter_titanium">1.10.0</a>
<a href="/packages/flutter_titanium" title="Visit flutter_titanium 1.10.0 page">1.10.0</a>
(
<a class="-x-ago" href="" title="%%neon-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/neon">1.0.0</a>
<a href="/packages/neon" title="Visit neon 1.0.0 page">1.0.0</a>
(
<a class="-x-ago" href="" title="%%neon-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down Expand Up @@ -304,7 +304,7 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/flutter_titanium">1.10.0</a>
<a href="/packages/flutter_titanium" title="Visit flutter_titanium 1.10.0 page">1.10.0</a>
(
<a class="-x-ago" href="" title="%%neon-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down
6 changes: 3 additions & 3 deletions app/test/frontend/golden/search_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/oxygen">1.2.0</a>
<a href="/packages/oxygen" title="Visit oxygen 1.2.0 page">1.2.0</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
) /
<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>
<a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down Expand Up @@ -541,7 +541,7 @@ <h3 class="packages-title">
<p class="packages-metadata">
<span class="packages-metadata-block">
v
<a href="/packages/flutter_titanium">1.10.0</a>
<a href="/packages/flutter_titanium" title="Visit flutter_titanium 1.10.0 page">1.10.0</a>
(
<a class="-x-ago" href="" title="%%oxygen-created-date%%" aria-label="%%x-ago%%" aria-role="button" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
)
Expand Down
20 changes: 12 additions & 8 deletions app/test/frontend/handlers/package_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ void main() {
await issueGet('/packages/oxygen'),
present: [
'oxygen 1.2.0',
'<a href="/packages/oxygen">1.2.0</a>',
'<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>',
RegExp(r'<a href="/packages/oxygen" title=".*">1.2.0</a>'),
RegExp(
r'<a href="/packages/oxygen/versions/2.0.0-dev" title=".*">2.0.0-dev</a>'),
],
absent: [
'data-name="-admin-tab-"',
Expand Down Expand Up @@ -50,8 +51,9 @@ void main() {
await issueGet('/packages/oxygen/versions'),
present: [
'oxygen 1.2.0',
'<a href="/packages/oxygen">1.2.0</a>',
'<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>',
RegExp(r'<a href="/packages/oxygen" title=".*">1.2.0</a>'),
RegExp(
r'<a href="/packages/oxygen/versions/2.0.0-dev" title=".*">2.0.0-dev</a>'),
],
);
});
Expand All @@ -69,8 +71,9 @@ void main() {
await issueGet('/packages/oxygen/versions/1.0.0'),
present: [
'oxygen 1.0.0',
'<a href="/packages/oxygen">1.2.0</a>',
'<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>',
RegExp(r'<a href="/packages/oxygen" title=".*">1.2.0</a>'),
RegExp(
r'<a href="/packages/oxygen/versions/2.0.0-dev" title=".*">2.0.0-dev</a>'),
],
);
});
Expand All @@ -81,8 +84,9 @@ void main() {
await issueGet('/packages/oxygen/versions/2.0.0%2Ddev'),
present: [
'oxygen 2.0.0-dev',
'<a href="/packages/oxygen">1.2.0</a>',
'<a href="/packages/oxygen/versions/2.0.0-dev">2.0.0-dev</a>',
RegExp(r'<a href="/packages/oxygen" title=".*">1.2.0</a>'),
RegExp(
r'<a href="/packages/oxygen/versions/2.0.0-dev" title=".*">2.0.0-dev</a>'),
],
);
});
Expand Down
Loading

0 comments on commit 9995601

Please sign in to comment.