Merge lavoro/daitarn-trafilo-ritaglio

This commit is contained in:
2026-10-07 12:33:02 +02:00
4 changed files with 380 additions and 0 deletions
@@ -295,3 +295,30 @@ class TestTaskEditorVisionUi:
assert "visionRecipe(" in html
assert "vision_output" in html
assert "js/vision_recipe.js" in html
class TestImageCropInclusion:
"""#56: i due editor includono image-crop.js e agganciano il ritaglio all'upload."""
def test_task_editor_includes_crop(self, logged_in_client, mock_api_client):
from tests.conftest import api_get_router
mock_api_client.get.side_effect = api_get_router({
"/api/recipes/3": {"id": 3, "code": "R", "name": "R"},
"/api/recipes/3/tasks": [{
"id": 11, "title": "T", "task_type": "measure", "subtasks": [],
"file_path": None, "order_index": 1,
}],
})
html = logged_in_client.get("/maker/recipes/3/tasks").get_data(as_text=True)
assert "js/image-crop.js" in html
assert "tmfCropBeforeUpload(file)" in html
def test_recipe_editor_includes_crop(self, logged_in_client, mock_api_client):
mock_api_client.get.side_effect = [
{"id": 1, "code": "REC-001", "name": "Recipe A"},
[{"version_number": 1, "is_current": True}],
]
html = logged_in_client.get("/maker/recipes/1/edit").get_data(as_text=True)
assert "js/image-crop.js" in html
assert "tmfCropBeforeUpload(file)" in html