diff --git a/blocks/form/components/repeat/repeat.js b/blocks/form/components/repeat/repeat.js index 1898618352..b18e5460b0 100644 --- a/blocks/form/components/repeat/repeat.js +++ b/blocks/form/components/repeat/repeat.js @@ -95,7 +95,7 @@ export default function transferRepeatableDOM(form) { const wrapper = document.createElement('div'); wrapper.dataset.min = el.dataset.min || 0; wrapper.dataset.max = el.dataset.max; - wrapper.dataset.variant = el.dataset.variant || 'includeButtons'; + wrapper.dataset.variant = el.dataset.variant || 'addRemoveAll'; el.insertAdjacentElement('beforebegin', wrapper); wrapper.append(...instances); const addLabel = el.dataset?.repeatAddButtonLabel || 'Add'; diff --git a/blocks/form/form.js b/blocks/form/form.js index b17b928f9b..decd16754f 100644 --- a/blocks/form/form.js +++ b/blocks/form/form.js @@ -160,11 +160,13 @@ function createFieldSet(fd) { setConstraints(wrapper, fd); wrapper.dataset.repeatable = true; wrapper.dataset.index = fd.index || 0; - Object.keys(fd?.properties)?.forEach((key) => { - if (!key.startsWith('fd:')) { - wrapper.dataset[key] = fd.properties[key]; - } - }); + if (fd.properties) { + Object.keys(fd.properties).forEach((key) => { + if (!key.startsWith('fd:')) { + wrapper.dataset[key] = fd.properties[key]; + } + }); + } } return wrapper; } diff --git a/test/unit/fixtures/components/panel/doc-based-repeatable-min.html b/test/unit/fixtures/components/panel/doc-based-repeatable-min.html index 1a31a3530d..b2c40d6882 100644 --- a/test/unit/fixtures/components/panel/doc-based-repeatable-min.html +++ b/test/unit/fixtures/components/panel/doc-based-repeatable-min.html @@ -1,4 +1,4 @@ -
+
Traveler Info @@ -19,5 +19,7 @@ data-required="false">
- +
+ +
diff --git a/test/unit/fixtures/components/panel/repeatable-panel-minItems.html b/test/unit/fixtures/components/panel/repeatable-panel-minItems.html index 38f6c4673f..f817864089 100644 --- a/test/unit/fixtures/components/panel/repeatable-panel-minItems.html +++ b/test/unit/fixtures/components/panel/repeatable-panel-minItems.html @@ -1,5 +1,5 @@
-
+
- +
+ +
\ No newline at end of file diff --git a/test/unit/fixtures/doc-based-submit/successful-submit-repeatable-checkbox.js b/test/unit/fixtures/doc-based-submit/successful-submit-repeatable-checkbox.js index 2a6039ea6a..841c38cfd4 100644 --- a/test/unit/fixtures/doc-based-submit/successful-submit-repeatable-checkbox.js +++ b/test/unit/fixtures/doc-based-submit/successful-submit-repeatable-checkbox.js @@ -64,7 +64,7 @@ export function op(block) { global.window = Object.create(window); // repeat panel - const btn = block.querySelector('.repeat-wrapper > .item-add'); + const btn = block.querySelector('.repeat-wrapper > .repeat-actions > .item-add'); btn.click(); const f1Repeat = block.querySelectorAll('input[name="f1"]'); f1Repeat[0].value = '10'; diff --git a/test/unit/fixtures/doc-based-submit/successful-submit-repeatable.js b/test/unit/fixtures/doc-based-submit/successful-submit-repeatable.js index 79a936933a..6fbf4645e1 100644 --- a/test/unit/fixtures/doc-based-submit/successful-submit-repeatable.js +++ b/test/unit/fixtures/doc-based-submit/successful-submit-repeatable.js @@ -78,7 +78,7 @@ export function op(block) { f4.click(); // repeat panel - const btn = block.querySelector('.repeat-wrapper > .item-add'); + const btn = block.querySelector('.repeat-wrapper > .repeat-actions > .item-add'); btn.click(); const f1Repeat = block.querySelectorAll('input[name="f1"]'); f1Repeat[0].value = '10'; diff --git a/test/unit/fixtures/dynamic/repeat-add-doc-based.js b/test/unit/fixtures/dynamic/repeat-add-doc-based.js index d62f508906..b4936db568 100644 --- a/test/unit/fixtures/dynamic/repeat-add-doc-based.js +++ b/test/unit/fixtures/dynamic/repeat-add-doc-based.js @@ -5,7 +5,7 @@ import { fieldDef } from '../form/enquire.js'; export const sample = fieldDef; export function op(block) { - const btn = block.querySelector('.repeat-wrapper > .item-add'); + const btn = block.querySelector('.repeat-wrapper > .repeat-actions > .item-add'); btn.click(); } diff --git a/test/unit/fixtures/form/doc-fieldset.html b/test/unit/fixtures/form/doc-fieldset.html index 1fda1c65e4..1e849b23da 100644 --- a/test/unit/fixtures/form/doc-fieldset.html +++ b/test/unit/fixtures/form/doc-fieldset.html @@ -1,12 +1,15 @@
-
+
-
+ +
+ +
diff --git a/test/unit/fixtures/form/enquire.html b/test/unit/fixtures/form/enquire.html index dad8c8cde7..a48c5b5937 100644 --- a/test/unit/fixtures/form/enquire.html +++ b/test/unit/fixtures/form/enquire.html @@ -671,7 +671,7 @@ data-required-error-message="Please fill in this field." data-required="false">
-
+
Traveler Info @@ -681,7 +681,10 @@
-
+ +
+ +
\ No newline at end of file