Fix import queue UI controls #31
This commit is contained in:
@@ -95,6 +95,20 @@ def test_queue_item_run_now_imports_only_selected_item(tmp_path, monkeypatch):
|
||||
assert rows["Waiting.mkv"]["state"] == "manual_batch"
|
||||
|
||||
|
||||
def test_current_job_status_includes_progress(tmp_path, monkeypatch):
|
||||
main, _download, _movies, _tv = configure_main(tmp_path, monkeypatch)
|
||||
monkeypatch.setattr(main.time, "time", lambda: 110.0)
|
||||
|
||||
main.set_current_job("Movie.mkv", bytes_copied=50, total_bytes=200, started_at=100.0)
|
||||
|
||||
current = main.control_status()["current"]
|
||||
assert current["file"] == "Movie.mkv"
|
||||
assert current["bytes_copied"] == 50
|
||||
assert current["total_bytes"] == 200
|
||||
assert current["percent"] == 25
|
||||
assert current["elapsed_seconds"] == 10
|
||||
|
||||
|
||||
def test_cancel_current_stops_before_next_manual_item(tmp_path, monkeypatch):
|
||||
main, download, movies, tv = configure_main(tmp_path, monkeypatch)
|
||||
batch = download / "Release"
|
||||
|
||||
@@ -56,15 +56,32 @@ def test_index_packs_secondary_controls_into_menu(tmp_path, monkeypatch):
|
||||
|
||||
assert response.status_code == 200
|
||||
assert 'class="menu"' in response.text
|
||||
assert 'data-dialog="service-info-dialog"' in response.text
|
||||
assert 'data-dialog="queue-controls-dialog"' in response.text
|
||||
assert 'data-dialog="manual-batches-dialog"' in response.text
|
||||
assert "Service info and build details" in response.text
|
||||
assert "Queue and history" in response.text
|
||||
assert "Current import" in response.text
|
||||
assert "current-progress" in response.text
|
||||
assert "theme-toggle" in response.text
|
||||
assert "setInterval(refresh, 2000)" in response.text
|
||||
assert "details.menu[open]" in response.text
|
||||
assert "e.target===e.currentTarget" in response.text
|
||||
assert "function readiness" in response.text
|
||||
assert 'title="${esc(j.reason||j.state)}"' in response.text
|
||||
|
||||
|
||||
def test_stylesheet_includes_theme_and_progress_rules():
|
||||
from pathlib import Path
|
||||
|
||||
css = Path("importarr/static/importarr.css").read_text()
|
||||
|
||||
assert 'html[data-theme="light"]' in css
|
||||
assert 'html[data-theme="dark"]' in css
|
||||
assert ".current-panel progress" in css
|
||||
assert ".top-controls>button,.menu summary" in css
|
||||
|
||||
|
||||
def test_index_renders_settings_dialog(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "state.db"))
|
||||
import importarr.main as main
|
||||
|
||||
Reference in New Issue
Block a user