fix: Add "Show more..." link for "Required by"

Fix glitch on the package page:
"Show more..." not displayed for the "Required by" list

Fix test case:
Function name does not start with "test" hence it was never executed during test runs

Issue report: #363

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2022-11-25 12:24:04 +01:00
parent a832b3cddb
commit a08681ba23
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
2 changed files with 8 additions and 6 deletions

View file

@ -62,10 +62,12 @@
<em>{{ dep | dep_extra }}</em>
</li>
{% endfor %}
{% if not all_reqs and (required_by | length) > max_listing %}
<a href="/packages/{{ name }}?{{ q | extend_query(['all_reqs', '1']) | urlencode }}#pkgreqs">
{{ "Show %d more" | tr | format(reqs_count - (required_by | length)) }}...
</a>
{% if not all_reqs and reqs_count > max_listing %}
<li>
<a href="/packages/{{ package.Name }}?{{ q | extend_query(['all_reqs', '1']) | urlencode }}#pkgreqs">
{{ "Show %d more" | tr | format(reqs_count - (required_by | length)) }}...
</a>
</li>
{% endif %}
</ul>
</div>

View file

@ -352,7 +352,7 @@ def test_package_split_description(client: TestClient, user: User):
assert row.text == pkg_b.Description
def paged_depends_required(client: TestClient, package: Package):
def test_paged_depends_required(client: TestClient, package: Package):
maint = package.PackageBase.Maintainer
new_pkgs = []
@ -360,7 +360,7 @@ def paged_depends_required(client: TestClient, package: Package):
# Create 25 new packages that'll be used to depend on our package.
for i in range(26):
base = db.create(PackageBase, Name=f"new_pkg{i}", Maintainer=maint)
new_pkgs.append(db.create(Package, Name=base.Name))
new_pkgs.append(db.create(Package, Name=base.Name, PackageBase=base))
# Create 25 deps.
for i in range(25):