summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_transfers.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-09 14:24:59 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-09 14:24:59 +0200
commite6f895c473a0b19e7b186889c1836d3945bc880b (patch)
tree05689049fd48f01ebbdb9995d5189cba15cee052 /packages/meshbay-hub/tests/test_transfers.py
parentb472b4d43149ed12a7f64c94f34c34f436bef492 (diff)
downloadmeshbay-e6f895c473a0b19e7b186889c1836d3945bc880b.tar.gz
fix(spa): say why a download cannot be paused
Reported from Chrome, with a screenshot: four downloads with no pause button and an upload beside them with one, and nothing anywhere saying why. The reason is real. Without a granted download folder the browser writes through the service worker — a download it already owns, which cannot be paused without stalling it somewhere we can neither see nor resume. An upload writes to the node, which keeps the position, so it is always pausable. But that was stated only in a Settings line nobody reads on the way to a download, and a gap where the row above has a button is not an explanation. So a download that cannot be paused now shows a dimmed pause icon where the button would be, carrying the reason and the remedy in its tooltip. Not a button: there is nothing to click, and a disabled one invites the click anyway. And only where the advice can be taken. Firefox and Safari have no folder to choose — the streamed path is the only target they have, which is what §6.5 of ~/next/improve-downloads.md costs out — so telling someone there to choose one would be advice they cannot follow. Nothing is drawn. Hub suite 866 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCGdheDLxGReuKHga3BtST
Diffstat (limited to 'packages/meshbay-hub/tests/test_transfers.py')
-rw-r--r--packages/meshbay-hub/tests/test_transfers.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_transfers.py b/packages/meshbay-hub/tests/test_transfers.py
index d19a458..d93cf80 100644
--- a/packages/meshbay-hub/tests/test_transfers.py
+++ b/packages/meshbay-hub/tests/test_transfers.py
@@ -879,3 +879,38 @@ console.log(JSON.stringify({ active }));
proc = subprocess.run(["node", str(script)], capture_output=True, text=True)
assert proc.returncode == 0, proc.stderr
assert json.loads(proc.stdout)["active"] == 1
+
+
+def test_a_row_that_cannot_pause_says_so_where_the_button_would_be():
+ """Reported from Chrome: four downloads with no pause button and an upload
+ with one, and no way to tell why.
+
+ The reason is real — without a granted folder the browser writes through the
+ service worker, a download it already owns and cannot pause — but it was
+ stated only in a Settings line nobody reads on the way to a download. A gap
+ where the row above has a button is not an explanation.
+
+ Shown only where a folder can actually be chosen: Firefox and Safari have
+ none to choose, and "choose a folder" would be advice that cannot be taken.
+ """
+ src = (STATIC / "app.js").read_text()
+ row = src[src.index("function TransferRow"):]
+ row = row[:row.index("\n}\n")]
+
+ hint = row[row.index("!it.pausable"):]
+ hint = hint[:hint.index("`}")]
+ assert "downloads.SUPPORTED" in hint, (
+ "the hint would tell a Firefox user to choose a folder it cannot offer")
+ assert "it.kind === 'download'" in hint, (
+ "an upload is always pausable; this is about download targets")
+ assert "transfers.not_pausable" in hint, "the reason is not stated"
+ # Not a button. There is nothing to click, and a disabled one invites the
+ # click anyway.
+ assert "<button" not in hint
+
+
+def test_the_reason_is_translated_everywhere():
+ """`t()` falls back to the key, so a missing catalogue entry shows
+ `transfers.not_pausable` in a tooltip rather than a sentence."""
+ for path in sorted((STATIC / "locales").glob("*.js")):
+ assert "'transfers.not_pausable'" in path.read_text(), path.name