From 1a1d2da400112aa08064e62f63711c091aea3230 Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 14 Feb 2026 08:32:06 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20issue=20#11:=20=E7=BF=92=E6=85=A3?= =?UTF-8?q?=E3=82=BF=E3=82=B9=E3=82=AF=E5=AE=9F=E7=B8=BE=E3=82=92=E3=82=AB?= =?UTF-8?q?=E3=83=AC=E3=83=B3=E3=83=80=E3=83=BC=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Web/tests/test_habit_task_log_calendar.py | 24 ++++++++ src/templates/pages/habit/detail.html | 58 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/UseCases/Web/tests/test_habit_task_log_calendar.py diff --git a/src/UseCases/Web/tests/test_habit_task_log_calendar.py b/src/UseCases/Web/tests/test_habit_task_log_calendar.py new file mode 100644 index 0000000..3f3cd2f --- /dev/null +++ b/src/UseCases/Web/tests/test_habit_task_log_calendar.py @@ -0,0 +1,24 @@ +import pytest +from flask import Flask +from src.routes.web.habit import views_blueprint + +@pytest.fixture +def app(): + app = Flask(__name__) + app.secret_key = 'test' + app.register_blueprint(views_blueprint) + return app + +def test_habit_task_log_calendar_toggle(client, app): + # Simulate login and minimal session + with app.test_client() as client: + with client.session_transaction() as sess: + sess['login_name'] = 'testuser' + sess['login_email'] = 'test@example.com' + sess['user_id'] = 'dummyid' + # Assume a dummy task_id exists, or mock the repository if needed + response = client.get('/habit/dummyid') + html = response.get_data(as_text=True) + assert 'toggle-view-btn' in html + assert 'calendar-view' in html + assert 'カレンダー表示に切替' in html diff --git a/src/templates/pages/habit/detail.html b/src/templates/pages/habit/detail.html index 9a455af..3baf380 100644 --- a/src/templates/pages/habit/detail.html +++ b/src/templates/pages/habit/detail.html @@ -18,6 +18,12 @@

習慣タスク実績

一覧へ戻る +
+
+ +
+
+
@@ -45,6 +51,58 @@

習慣タスク実績

{% endfor %} {% if page_contents.data.logs|length == 0 %} 実績はまだありません。 + + {% endif %}