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 @@