Skip to content

Commit

Permalink
[72] PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig authored and sergei-maertens committed Mar 29, 2024
1 parent 44e563b commit a68c8fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/openforms/formio/tests/validation/test_checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_checkbox_field_required_validation(self):
({}, "required"),
({"foo": ""}, "invalid"),
({"foo": None}, "null"),
({"foo": False}, "invalid"),
]

for data, error_code in invalid_values:
Expand Down
28 changes: 21 additions & 7 deletions src/openforms/tests/e2e/test_input_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,7 @@ def test_max_date_fixed_value(self):
class SingleCheckboxTests(ValidationsTestCase):

async def apply_ui_input(self, page: Page, label: str, ui_input: str | int | float):
await expect(
page.get_by_role("checkbox", name="Required checkbox")
).not_to_be_checked()
await expect(page.get_by_role("checkbox", name=label)).not_to_be_checked()

def test_required_field(self):
component: Component = {
Expand Down Expand Up @@ -388,8 +386,8 @@ def test_max_value(self):

class SingleMapTests(ValidationsTestCase):
async def apply_ui_input(self, page: Page, label: str, ui_input: str | int | float):
page.wait_for_selector(
".openforms-leaflet-map, [aria-label='Required map']", state="visible"
await page.wait_for_selector(
f".openforms-leaflet-map, [aria-label='{label}']", state="visible"
)

def test_required_field(self):
Expand Down Expand Up @@ -426,7 +424,7 @@ def test_required_field(self):
class SingleSignatureTests(ValidationsTestCase):

async def apply_ui_input(self, page: Page, label: str, ui_input: str | int | float):
page.wait_for_selector("[aria-label='Required signature']", state="visible")
page.wait_for_selector(f"[aria-label='{label}']", state="visible")

def test_required_field(self):
component: Component = {
Expand Down Expand Up @@ -470,7 +468,6 @@ def test_max_length(self):
self.assertValidationIsAligned(
component,
ui_input=invalid_sample,
api_value=invalid_sample,
expected_ui_error="Er zijn teveel karakters opgegeven.",
)

Expand Down Expand Up @@ -523,3 +520,20 @@ def test_max_value(self):
ui_input="12:10",
expected_ui_error="Alleen tijden tussen 10:00 en 12:00 zijn toegestaan.",
)

def test_min_max_special_logic(self):
component: Component = {
"type": "time",
"key": "requiredTime",
"label": "Required time",
"validate": {
"minTime": "20:00",
"maxTime": "04:00",
},
}

self.assertValidationIsAligned(
component,
ui_input="15:00",
expected_ui_error="Alleen tijden tussen 20:00 en 04:00 zijn toegestaan.",
)

0 comments on commit a68c8fd

Please sign in to comment.