Skip to content

Commit e16ae3f

Browse files
committed
🚧 [#5139] Replace DataContainer with FormioData instance in is_visible_in_frontend
1 parent 2917cf3 commit e16ae3f

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/openforms/submissions/form_logic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def evaluate_form_logic(
151151
data_diff = FormioData()
152152
for component in config_wrapper:
153153
key = component["key"]
154-
is_visible = config_wrapper.is_visible_in_frontend(key, data_container.data)
154+
# TODO-5139: is_visible_in_frontend must accept a FormioData instance instead
155+
is_visible = config_wrapper.is_visible_in_frontend(key, data_for_evaluation.data)
155156
if is_visible:
156157
continue
157158

src/openforms/submissions/tests/form_logic/test_modify_components.py

+39
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import unittest
2+
13
from django.test import TestCase, tag
24

35
from openforms.forms.constants import LogicActionTypes
@@ -874,6 +876,43 @@ def test_component_visible_in_frontend(self):
874876
"Some data that must not be cleared!", submission_step.data["textField"]
875877
)
876878

879+
# TODO-5139: this is a bug which currently exists on master as well, and is not
880+
# fixed with the data-structure changes, yet.
881+
@unittest.expectedFailure
882+
def test_component_visible_with_date(self):
883+
form = FormFactory.create()
884+
form_step = FormStepFactory.create(
885+
form=form,
886+
form_definition__configuration={
887+
"components": [
888+
{
889+
"key": "date",
890+
"type": "date",
891+
},
892+
{
893+
"type": "textfield",
894+
"key": "textField",
895+
"hidden": True,
896+
"conditional": {"eq": "2025-01-01", "show": True, "when": "date"},
897+
"clearOnHide": True,
898+
},
899+
]
900+
},
901+
)
902+
903+
submission = SubmissionFactory.create(form=form)
904+
submission_step = SubmissionStepFactory.create(
905+
submission=submission,
906+
form_step=form_step,
907+
data={"date": "2025-01-01", "textField": "Some data that must not be cleared!"},
908+
)
909+
910+
evaluate_form_logic(submission, submission_step, submission.data, dirty=True)
911+
912+
self.assertEqual(
913+
"Some data that must not be cleared!", submission_step.data["textField"]
914+
)
915+
877916
@tag("gh-1183")
878917
def test_component_incomplete_frontend_logic(self):
879918
form = FormFactory.create()

0 commit comments

Comments
 (0)