Skip to content

Commit

Permalink
[#4061] Use the right attribute for components array
Browse files Browse the repository at this point in the history
Backport-of: #4077
  • Loading branch information
Viicos authored and sergei-maertens committed Mar 28, 2024
1 parent 962cc6d commit 4bf5e2e
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 1 deletion.
117 changes: 117 additions & 0 deletions src/openforms/forms/tests/e2e_tests/test_form_designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,123 @@ def setUpTestData():
)
await expect(warning).to_be_visible()

@tag("gh-3921")
async def test_all_components_are_visible_in_component_select_dropdown(self):
@sync_to_async
def setUpTestData():
# set up a form
form = FormFactory.create(
name="Playwright test",
generate_minimal_setup=True,
formstep__form_definition__name_nl="Playwright test",
formstep__form_definition__configuration={
"components": [
{
"type": "textfield",
"key": "field1",
"label": "Field 1",
},
{
"type": "fieldset",
"key": "fieldset",
"components": [
{
"type": "textfield",
"key": "field2",
"label": "Field 2",
},
],
},
],
},
)
return form

await create_superuser()
form = await setUpTestData()

admin_url = str(
furl(self.live_server_url)
/ reverse("admin:forms_form_change", args=(form.pk,))
)

async with browser_page() as page:
await self._admin_login(page)
await page.goto(str(admin_url))

await page.get_by_role("tab", name="Steps and fields").click()
await open_component_options_modal(page, "Field 2")
await page.get_by_role("tab", name="Location").click()

dropdown = page.get_by_role("combobox", name="Postcode component")
await dropdown.focus()
await page.keyboard.press("ArrowDown")
await expect(page.get_by_text("Field 1 (field1)")).to_be_visible()

@tag("gh-4061")
async def test_column_components_are_visible_in_component_select_dropdown(self):
@sync_to_async
def setUpTestData():
# set up a form
form = FormFactory.create(
name="Playwright test",
generate_minimal_setup=True,
formstep__form_definition__name_nl="Playwright test",
formstep__form_definition__configuration={
"components": [
{
"type": "textfield",
"key": "field1",
"label": "Field 1",
},
{
"type": "columns",
"key": "columns",
"columns": [
{
"size": 6,
"sizeMobile": 4,
"width": 6,
"offset": 0,
"push": 0,
"pull": 0,
"currentWidth": 6,
"components": [
{
"type": "textfield",
"key": "field2",
"label": "Field 2",
},
],
}
],
},
],
},
)
return form

await create_superuser()
form = await setUpTestData()

admin_url = str(
furl(self.live_server_url)
/ reverse("admin:forms_form_change", args=(form.pk,))
)

async with browser_page() as page:
await self._admin_login(page)
await page.goto(str(admin_url))

await page.get_by_role("tab", name="Steps and fields").click()
await open_component_options_modal(page, "Field 1")
await page.get_by_role("tab", name="Location").click()

dropdown = page.get_by_role("combobox", name="Postcode component")
await dropdown.focus()
await page.keyboard.press("ArrowDown")
await expect(page.get_by_text("Field 2 (field2)")).to_be_visible()


class FormDesignerTooltipTests(E2ETestCase):
async def test_tooltip_fields_are_present(self):
Expand Down
3 changes: 2 additions & 1 deletion src/openforms/js/components/formio_builder/WebformBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,15 @@ class WebformBuilder extends WebformBuilderFormio {
// hand contents of modal over to React
(async () => {
const intlProviderProps = await getIntlProviderProps();

root.render(
<IntlProvider {...intlProviderProps}>
<ComponentConfiguration
// Context binding
uniquifyKey={uniquifyKey}
supportedLanguageCodes={LANGUAGES}
richTextColors={RICH_TEXT_COLORS}
getFormComponents={() => this.webform.components}
getFormComponents={() => this.webform.form.components}
getValidatorPlugins={getValidatorPlugins}
getRegistrationAttributes={getRegistrationAttributes}
getPrefillPlugins={getPrefillPlugins}
Expand Down

0 comments on commit 4bf5e2e

Please sign in to comment.