summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-09-13 14:36:46 +0900
committertanaka takashi <isazaka@gmail.com>2026-09-13 14:36:46 +0900
commitb24aa19ad22f59556fc7bbb63c58836799239588 (patch)
tree0a5cee4357f864fc73cba37d7cd2eb23d5266385 /tests
parentf2d24cb7d437ad099291262d7c1b021809cd66ae (diff)
fix(ui): スマホでセッションを削除できるようにする
セッション削除ボタンが通常時はdisplay:noneで、li:hover時だけ表示されていたため、持続的なhoverを持たないスマートフォンでは安定して操作できなかった。モバイル幅、hover非対応、coarse pointer環境ではボタンを常時表示し、44x44pxのタップ領域とtouch-actionを設定する。 表示修正後もタップ後の処理がネイティブwindow.confirmと複数のclickリスナーに依存していたため、削除とセッション選択をsession-list上の単一イベント委譲へ統合する。削除ボタンを先に判定して行選択とサイドバー閉鎖へ伝播しないようにした。 ネイティブ確認ダイアログを既存modalスタイルに沿ったアプリ内確認ダイアログへ置き換える。キャンセル、背景タップ、Escape、フォーカス復帰に対応し、DELETE実行中の二重送信を防止する。通信失敗はネイティブalertではなくダイアログ内のaria-live領域へ表示する。 削除ボタンへbutton typeとaria-labelを明示し、確認ダイアログへdialog semanticsと日英のキャンセル文言を追加する。CHANGELOGと、タッチ向けCSSのカスケード順・サイズ・ネイティブconfirm非依存を確認する回帰テストも更新する。 Validation: 150 tests passed; ruff check passed; node --check src/ollama_web/static/app.js passed; git diff --check passed.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_security.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_security.py b/tests/test_security.py
index dea165b..7ac59fd 100644
--- a/tests/test_security.py
+++ b/tests/test_security.py
@@ -113,6 +113,35 @@ def test_katex_local_font_assets_are_present() -> None:
assert not [path for path in font_paths if not (vendor_dir / path).exists()]
+def test_session_delete_action_is_visible_and_touch_sized_on_mobile() -> None:
+ css_path = Path(__file__).parents[1] / "src" / "ollama_web" / "static" / "style.css"
+ css = css_path.read_text(encoding="utf-8")
+ base_rule = css.index("#session-list li .delete {")
+ touch_rule = css.index("@media (max-width: 768px), (hover: none), (pointer: coarse)")
+ touch_block = css[touch_rule : css.index("#session-list li.empty", touch_rule)]
+
+ # The touch override must follow the default display:none rule so it wins
+ # in the cascade without changing hover-capable desktop behavior.
+ assert touch_rule > base_rule
+ assert "display: inline-flex" in touch_block
+ assert "min-width: 44px" in touch_block
+ assert "min-height: 44px" in touch_block
+
+
+def test_session_delete_uses_in_app_dialog_instead_of_native_confirm() -> None:
+ root = Path(__file__).parents[1] / "src" / "ollama_web"
+ template = (root / "templates" / "index.html").read_text(encoding="utf-8")
+ script = (root / "static" / "app.js").read_text(encoding="utf-8")
+
+ assert 'id="delete-session-modal"' in template
+ assert 'role="dialog"' in template
+ assert 'id="delete-session-cancel"' in template
+ assert 'id="delete-session-confirm"' in template
+ assert "confirm(" not in script
+ assert 'sessionListEl.addEventListener("click"' in script
+ assert "openDeleteSessionDialog(li.dataset.id, deleteButton)" in script
+
+
def test_authenticated_audio_content_supports_range_requests(
workspace_tmp: Path, monkeypatch
) -> None: