From b9b3432b2db44cc2abeab0ec8c08abc5d7e698a6 Mon Sep 17 00:00:00 2001 From: alexandraRamanenka Date: Mon, 4 Mar 2024 14:40:33 +0200 Subject: [PATCH] Fixed tests --- src/WebformBuilder.unit.js | 5 +++-- test/forms/formWithNumericKeys.js | 30 ++++++++++++++++++++++++++ test/formtest/formWithNumericKeys.json | 30 -------------------------- test/formtest/index.js | 2 -- 4 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 test/forms/formWithNumericKeys.js delete mode 100644 test/formtest/formWithNumericKeys.json diff --git a/src/WebformBuilder.unit.js b/src/WebformBuilder.unit.js index 8556b3d905..ac2bb11a1e 100644 --- a/src/WebformBuilder.unit.js +++ b/src/WebformBuilder.unit.js @@ -2,7 +2,8 @@ import assert from 'power-assert'; import Harness from '../test/harness'; import WebformBuilder from './WebformBuilder'; import Builders from './builders'; -import { uniqueApiKeys, uniqueApiKeysLayout, uniqueApiKeysSameLevel, columnsForm, resourceKeyCamelCas, formWithNumericKeys } from '../test/formtest'; +import { uniqueApiKeys, uniqueApiKeysLayout, uniqueApiKeysSameLevel, columnsForm, resourceKeyCamelCas } from '../test/formtest'; +import formWithNumericKeys from '../test/forms/formWithNumericKeys'; import sameApiKeysLayoutComps from '../test/forms/sameApiKeysLayoutComps'; import testApiKeysUniquifying from '../test/forms/testApiKeysUniquifying'; import formBasedOnWizard from '../test/forms/formBasedOnWizard'; @@ -42,7 +43,7 @@ describe('WebformBuilder tests', function() { }).catch(done); }); - it('Should show API error when componentshave invalid API keys', (done) => { + it('Should show API error when components have invalid API keys', (done) => { const builder = Harness.getBuilder(); builder.webform.setForm(formWithNumericKeys).then(() => { builder.highlightInvalidComponents(); diff --git a/test/forms/formWithNumericKeys.js b/test/forms/formWithNumericKeys.js new file mode 100644 index 0000000000..3e76bea557 --- /dev/null +++ b/test/forms/formWithNumericKeys.js @@ -0,0 +1,30 @@ +export default { + type: 'form', + display: 'form', + components: [ + { + label: 'Text Field', + applyMaskOn: 'change', + tableView: true, + key: 'test', + type: 'textfield', + input: true, + }, + { + label: 'Text Field', + applyMaskOn: 'change', + tableView: true, + key: '1234', + type: 'textfield', + input: true, + }, + { + type: 'button', + label: 'Submit', + key: 'submit', + disableOnInvalid: true, + input: true, + tableView: false, + }, + ], +}; diff --git a/test/formtest/formWithNumericKeys.json b/test/formtest/formWithNumericKeys.json deleted file mode 100644 index 7d4476156b..0000000000 --- a/test/formtest/formWithNumericKeys.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "type": "form", - "display": "form", - "components": [ - { - "label": "Text Field", - "applyMaskOn": "change", - "tableView": true, - "key": "test", - "type": "textfield", - "input": true - }, - { - "label": "Text Field", - "applyMaskOn": "change", - "tableView": true, - "key": "1234", - "type": "textfield", - "input": true - }, - { - "type": "button", - "label": "Submit", - "key": "submit", - "disableOnInvalid": true, - "input": true, - "tableView": false - } - ] -} diff --git a/test/formtest/index.js b/test/formtest/index.js index 6a388d6e78..1592a47297 100644 --- a/test/formtest/index.js +++ b/test/formtest/index.js @@ -42,7 +42,6 @@ const wizardWithTooltip = require('./wizardWithTooltip.json'); const resourceKeyCamelCase = require('./resourceKeyCamelCase.json'); const tooltipActivateCheckbox = require('./tooltipActivateCheckbox.json'); const formWithObjectValueSelect = require('./formWithObjectValueSelect.json'); -const formWithNumericKeys = require('./formWithNumericKeys.json'); module.exports = { advanced, @@ -89,5 +88,4 @@ module.exports = { resourceKeyCamelCase, tooltipActivateCheckbox, formWithObjectValueSelect, - formWithNumericKeys, };