From 9995601b13cac9b3271250e41cff4592afb06f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20So=C3=B3s?= Date: Thu, 18 Jan 2024 11:31:32 +0100 Subject: [PATCH] Missing tooltips for versions link on package page. (#7346) --- .../frontend/templates/views/pkg/header.dart | 17 ++++++++++++---- .../templates/views/pkg/package_list.dart | 1 + .../views/pkg/versions/version_row.dart | 1 + app/test/frontend/golden/my_packages.html | 6 +++--- .../golden/pkg_activity_log_page.html | 4 ++-- app/test/frontend/golden/pkg_admin_page.html | 4 ++-- .../frontend/golden/pkg_changelog_page.html | 4 ++-- .../frontend/golden/pkg_example_page.html | 4 ++-- app/test/frontend/golden/pkg_index_page.html | 6 +++--- .../frontend/golden/pkg_install_page.html | 4 ++-- app/test/frontend/golden/pkg_score_page.html | 4 ++-- app/test/frontend/golden/pkg_show_page.html | 4 ++-- .../golden/pkg_show_page_retracted.html | 2 +- .../golden/pkg_show_version_page.html | 4 ++-- .../frontend/golden/pkg_versions_page.html | 10 +++++----- .../golden/publisher_packages_page.html | 4 ++-- .../publisher_unlisted_packages_page.html | 4 ++-- app/test/frontend/golden/search_page.html | 6 +++--- app/test/frontend/handlers/package_test.dart | 20 +++++++++++-------- .../goldens/packages/oxygen/versions.html | 4 ++-- .../packages/oxygen/versions/1.0.0.html | 2 +- .../oxygen/versions/1.0.0/changelog.html | 2 +- .../oxygen/versions/1.0.0/example.html | 2 +- .../oxygen/versions/1.0.0/install.html | 2 +- .../oxygen/versions/1.0.0/license.html | 2 +- .../packages/oxygen/versions/1.0.0/score.html | 2 +- .../lib/script/dev_version.dart | 6 ++++-- 27 files changed, 74 insertions(+), 57 deletions(-) diff --git a/app/lib/frontend/templates/views/pkg/header.dart b/app/lib/frontend/templates/views/pkg/header.dart index 2cef4ef9c6..d5bc04ffb7 100644 --- a/app/lib/frontend/templates/views/pkg/header.dart +++ b/app/lib/frontend/templates/views/pkg/header.dart @@ -54,6 +54,7 @@ List _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) @@ -61,13 +62,16 @@ List _releases(String package, LatestReleases releases) { 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', ), ]; } @@ -76,15 +80,20 @@ List _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, + ), ], ), ]; diff --git a/app/lib/frontend/templates/views/pkg/package_list.dart b/app/lib/frontend/templates/views/pkg/package_list.dart index 923d5ac8e5..58166d6c02 100644 --- a/app/lib/frontend/templates/views/pkg/package_list.dart +++ b/app/lib/frontend/templates/views/pkg/package_list.dart @@ -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), diff --git a/app/lib/frontend/templates/views/pkg/versions/version_row.dart b/app/lib/frontend/templates/views/pkg/versions/version_row.dart index 89f3cc3c74..ba89ccd3e2 100644 --- a/app/lib/frontend/templates/views/pkg/versions/version_row.dart +++ b/app/lib/frontend/templates/views/pkg/versions/version_row.dart @@ -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( diff --git a/app/test/frontend/golden/my_packages.html b/app/test/frontend/golden/my_packages.html index ebb6abeb9e..048e64b233 100644 --- a/app/test/frontend/golden/my_packages.html +++ b/app/test/frontend/golden/my_packages.html @@ -222,11 +222,11 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev
diff --git a/app/test/frontend/golden/pkg_admin_page.html b/app/test/frontend/golden/pkg_admin_page.html index 665df70fd4..3ac6a5d22f 100644 --- a/app/test/frontend/golden/pkg_admin_page.html +++ b/app/test/frontend/golden/pkg_admin_page.html @@ -156,12 +156,12 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

diff --git a/app/test/frontend/golden/pkg_changelog_page.html b/app/test/frontend/golden/pkg_changelog_page.html index c9fbdc9386..edb516e46d 100644 --- a/app/test/frontend/golden/pkg_changelog_page.html +++ b/app/test/frontend/golden/pkg_changelog_page.html @@ -130,12 +130,12 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

diff --git a/app/test/frontend/golden/pkg_example_page.html b/app/test/frontend/golden/pkg_example_page.html index 6cb4c425db..ef07c31a2a 100644 --- a/app/test/frontend/golden/pkg_example_page.html +++ b/app/test/frontend/golden/pkg_example_page.html @@ -130,12 +130,12 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

diff --git a/app/test/frontend/golden/pkg_index_page.html b/app/test/frontend/golden/pkg_index_page.html index 328a496775..305e9ab3f2 100644 --- a/app/test/frontend/golden/pkg_index_page.html +++ b/app/test/frontend/golden/pkg_index_page.html @@ -472,11 +472,11 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

diff --git a/app/test/frontend/golden/pkg_score_page.html b/app/test/frontend/golden/pkg_score_page.html index 520abd204e..98d827445e 100644 --- a/app/test/frontend/golden/pkg_score_page.html +++ b/app/test/frontend/golden/pkg_score_page.html @@ -130,12 +130,12 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

diff --git a/app/test/frontend/golden/pkg_show_page.html b/app/test/frontend/golden/pkg_show_page.html index 23389bc1d2..1e48c878ed 100644 --- a/app/test/frontend/golden/pkg_show_page.html +++ b/app/test/frontend/golden/pkg_show_page.html @@ -130,12 +130,12 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

diff --git a/app/test/frontend/golden/pkg_show_page_retracted.html b/app/test/frontend/golden/pkg_show_page_retracted.html index f8375201a1..1bcdc0975e 100644 --- a/app/test/frontend/golden/pkg_show_page_retracted.html +++ b/app/test/frontend/golden/pkg_show_page_retracted.html @@ -130,7 +130,7 @@

• Latest: - 2.0.0 + 2.0.0

diff --git a/app/test/frontend/golden/pkg_show_version_page.html b/app/test/frontend/golden/pkg_show_version_page.html index 4880c4da17..a362517943 100644 --- a/app/test/frontend/golden/pkg_show_version_page.html +++ b/app/test/frontend/golden/pkg_show_version_page.html @@ -130,12 +130,12 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

diff --git a/app/test/frontend/golden/pkg_versions_page.html b/app/test/frontend/golden/pkg_versions_page.html index c4a201b2e8..4172b4621e 100644 --- a/app/test/frontend/golden/pkg_versions_page.html +++ b/app/test/frontend/golden/pkg_versions_page.html @@ -130,12 +130,12 @@

• Latest: - 1.2.0 + 1.2.0 / Prerelease: - 2.0.0-dev + 2.0.0-dev

@@ -237,7 +237,7 @@

Stable versions of oxygen

- 1.2.0 + 1.2.0 Null safety @@ -259,7 +259,7 @@

Stable versions of oxygen

- 1.0.0 + 1.0.0 Null safety @@ -300,7 +300,7 @@

Prerelease versions of oxygen

- 2.0.0-dev + 2.0.0-dev Null safety diff --git a/app/test/frontend/golden/publisher_packages_page.html b/app/test/frontend/golden/publisher_packages_page.html index dc3b4942ea..8dbd1d6c66 100644 --- a/app/test/frontend/golden/publisher_packages_page.html +++ b/app/test/frontend/golden/publisher_packages_page.html @@ -224,7 +224,7 @@

Stable versions of oxygen

- 2.0.0 + 2.0.0 Null safety @@ -245,7 +245,7 @@

Stable versions of oxygen

- 1.0.0 + 1.0.0 Null safety diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0.html b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0.html index d14918a15d..f2cd220d9d 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0.html +++ b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0.html @@ -131,7 +131,7 @@

Dart 3 compatible • Latest: - 2.0.0 + 2.0.0

diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/changelog.html b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/changelog.html index e27c3eeeaf..6be0e99575 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/changelog.html +++ b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/changelog.html @@ -131,7 +131,7 @@

Dart 3 compatible • Latest: - 2.0.0 + 2.0.0

diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/example.html b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/example.html index 1568d51d34..2294dc4400 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/example.html +++ b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/example.html @@ -131,7 +131,7 @@

Dart 3 compatible • Latest: - 2.0.0 + 2.0.0

diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/install.html b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/install.html index 0b2390d78d..00b02da1ae 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/install.html +++ b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/install.html @@ -131,7 +131,7 @@

Dart 3 compatible • Latest: - 2.0.0 + 2.0.0

diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/license.html b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/license.html index 667e928dfd..e8d8883e05 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/license.html +++ b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/license.html @@ -131,7 +131,7 @@

Dart 3 compatible • Latest: - 2.0.0 + 2.0.0

diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html index 49c2b328ef..1e31e3983d 100644 --- a/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html +++ b/app/test/task/testdata/goldens/packages/oxygen/versions/1.0.0/score.html @@ -131,7 +131,7 @@

Dart 3 compatible • Latest: - 2.0.0 + 2.0.0

diff --git a/pkg/pub_integration/lib/script/dev_version.dart b/pkg/pub_integration/lib/script/dev_version.dart index b58fcc2bb9..f36ce3964d 100644 --- a/pkg/pub_integration/lib/script/dev_version.dart +++ b/pkg/pub_integration/lib/script/dev_version.dart @@ -175,13 +175,15 @@ class DevVersionScript { void _expectContent(String? content, {List? present, List? absent}) { + // removing title attributes to keep patterns simple + content = content!.replaceAll(RegExp(' title=".*?"'), ''); for (Pattern p in present ?? []) { - if (p.allMatches(content!).isEmpty) { + if (p.allMatches(content).isEmpty) { throw Exception('$p is missing from the content.'); } } for (Pattern p in absent ?? []) { - if (p.allMatches(content!).isNotEmpty) { + if (p.allMatches(content).isNotEmpty) { throw Exception('$p is present in the content.'); } }