aboutsummaryrefslogtreecommitdiff
path: root/tests/views/test_sources.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-18 17:41:44 +0100
committerDennis Fink2026-11-18 17:41:44 +0100
commite3e195ea07fd57288d32c842689ebed7fba636f0 (patch)
treeda4358930bfc6bd7c855a77de2898c19e7043a84 /tests/views/test_sources.py
parent44ece87ed14c5d19bd6ceabfd023e45561b08ef3 (diff)
downloadwebmentions-ssg-e3e195ea07fd57288d32c842689ebed7fba636f0.tar.gz
webmentions-ssg-e3e195ea07fd57288d32c842689ebed7fba636f0.zip
style(core): improve mobile table layouts
Hide secondary received and sent table columns below the `md` breakpoint while keeping status, primary identifiers, details, and actions accessible. Add responsive wrappers, mobile received timestamps, and wrapping for long paths and URLs to improve small-screen readability.
Diffstat (limited to '')
-rw-r--r--tests/views/test_sources.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/views/test_sources.py b/tests/views/test_sources.py
index 012347e..673fc9f 100644
--- a/tests/views/test_sources.py
+++ b/tests/views/test_sources.py
@@ -9,6 +9,7 @@ from types import ModuleType
from unittest.mock import Mock
import pytest
+from bs4 import BeautifulSoup
from flask import Flask
from flask.testing import FlaskClient
@@ -56,6 +57,29 @@ def test_sent_lists_sources(app: Flask, client: FlaskClient) -> None:
assert f"/sources/{identifier}" in html
+def test_sent_sources_table_hides_secondary_columns_on_mobile(
+ app: Flask, client: FlaskClient
+) -> None:
+ log_in(app, client)
+ create_sent_source(app)
+
+ response = client.get("/sources")
+
+ assert response.status_code == HTTPStatus.OK
+ html = BeautifulSoup(response.get_data(as_text=True), "html.parser")
+ table = html.select_one(".table-responsive > table")
+ assert table is not None
+ headers = table.select("thead th")
+ cells = table.select("tbody tr:first-child td")
+ assert len(headers) == len(cells) == 7
+ for index in (1, 3, 4, 5): # URL, revision, created, last seen
+ for cell in (headers[index], cells[index]):
+ assert {"d-none", "d-md-table-cell"} <= set(cell.get("class", []))
+ for index in (0, 2, 6): # Path, count, status stay visible
+ assert "d-none" not in cells[index].get("class", [])
+ assert "text-break" in cells[0].get("class", [])
+
+
def test_sent_source_lists_webmentions(app: Flask, client: FlaskClient) -> None:
log_in(app, client)
identifier = create_sent_source(app)
@@ -80,6 +104,29 @@ def test_sent_source_lists_webmentions(app: Flask, client: FlaskClient) -> None:
assert "https://example.com/webmention" in html
+def test_sent_webmentions_table_keeps_status_and_actions_on_mobile(
+ app: Flask, client: FlaskClient
+) -> None:
+ log_in(app, client)
+ identifier = create_sent_source(app)
+
+ response = client.get(f"/sources/{identifier}")
+
+ assert response.status_code == HTTPStatus.OK
+ html = BeautifulSoup(response.get_data(as_text=True), "html.parser")
+ table = html.select_one(".table-responsive > table")
+ assert table is not None
+ headers = table.select("thead th")
+ cells = table.select("tbody tr:first-child td")
+ assert len(headers) == len(cells) == 7
+ for index in (2, 3, 4, 5): # Active, revisions, delivery, activity
+ for cell in (headers[index], cells[index]):
+ assert {"d-none", "d-md-table-cell"} <= set(cell.get("class", []))
+ for index in (0, 1, 6): # Target, status, resend action stay visible
+ assert "d-none" not in cells[index].get("class", [])
+ assert cells[6].select_one("button[data-action]") is not None
+
+
def test_sent_source_returns_404_for_unknown_source(
app: Flask, client: FlaskClient
) -> None: