From fbb8774bb8f6156e29961173c784ce1cee96dc6e Mon Sep 17 00:00:00 2001 From: Valentin Serra Date: Tue, 16 Apr 2024 18:18:51 +0200 Subject: [PATCH] chore: fix field instance tests Related to #1147 --- .../form-js-viewer/test/spec/Form.spec.js | 10 +-- .../spec/render/components/FormField.spec.js | 10 +-- .../components/form-fields/Checkbox.spec.js | 3 +- .../components/form-fields/Checklist.spec.js | 21 +++---- .../components/form-fields/Datetime.spec.js | 39 ++++-------- .../form-fields/Dynamiclist.spec.js | 1 - .../components/form-fields/Number.spec.js | 63 +++++++------------ .../components/form-fields/Radio.spec.js | 12 ++-- .../components/form-fields/Select.spec.js | 24 +++---- .../components/form-fields/Taglist.spec.js | 15 ++--- .../components/form-fields/Textarea.spec.js | 6 +- .../components/form-fields/Textfield.spec.js | 6 +- .../hooks/useCleanupMultiSelectValues.spec.js | 6 +- .../hooks/useCleanupSingleSelectValue.spec.js | 6 +- 14 files changed, 77 insertions(+), 145 deletions(-) diff --git a/packages/form-js-viewer/test/spec/Form.spec.js b/packages/form-js-viewer/test/spec/Form.spec.js index 83f59516c..07e5b6262 100644 --- a/packages/form-js-viewer/test/spec/Form.spec.js +++ b/packages/form-js-viewer/test/spec/Form.spec.js @@ -1152,7 +1152,7 @@ describe('Form', function () { // update programmatically form._update({ - field, + fieldInstance: { id: field.id, valuePath: ['creditor'] }, value: 'Jane Doe Company', }); @@ -1182,17 +1182,17 @@ describe('Form', function () { // update programmatically form._update({ - field: getFormField(form, 'creditor'), + fieldInstance: { id: getFormField(form, 'creditor').id, valuePath: ['creditor'] }, value: 'Jane Doe Company', }); form._update({ - field: getFormField(form, 'amount'), + fieldInstance: { id: getFormField(form, 'amount').id, valuePath: ['amount'] }, value: '123', }); form._update({ - field: getFormField(form, 'approved'), + fieldInstance: { id: getFormField(form, 'approved').id, valuePath: ['approved'] }, value: true, }); @@ -1264,7 +1264,7 @@ describe('Form', function () { const field = getFormField(form, 'creditor'); form._update({ - field, + fieldInstance: { id: field.id, valuePath: ['creditor'] }, value: 'Jane Doe Company', }); diff --git a/packages/form-js-viewer/test/spec/render/components/FormField.spec.js b/packages/form-js-viewer/test/spec/render/components/FormField.spec.js index fc15e4b1a..e9bbb0986 100644 --- a/packages/form-js-viewer/test/spec/render/components/FormField.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/FormField.spec.js @@ -6,7 +6,7 @@ import { FormField } from 'src/render/components/FormField'; import { Textfield } from 'src/render/components/form-fields/Textfield'; -import { UpdateFieldValidationHandler } from 'src/features/viewerCommands/cmd/UpdateFieldValidationHandler'; +import { UpdateFieldInstanceValidationHandler } from 'src/features/viewerCommands/cmd/UpdateFieldInstanceValidationHandler'; import { MockFormContext } from './helper'; @@ -518,10 +518,10 @@ function createFormField(options = {}) { }; const validatorMock = { - validateField: (field, value) => validationErrors, + validateFieldInstance: (fieldInstance, value) => validationErrors, }; - const updateFieldValidationHandler = new UpdateFieldValidationHandler(formMock, validatorMock); + const updateFieldInstanceValidationHandler = new UpdateFieldInstanceValidationHandler(formMock, validatorMock); const conditionCheckerMock = checkCondition !== false @@ -567,8 +567,8 @@ function createFormField(options = {}) { templating: templatingMock, validator: validatorMock, viewerCommands: { - updateFieldValidation(field, value) { - return updateFieldValidationHandler.execute({ field, value }); + updateFieldInstanceValidation(fieldInstance, value) { + return updateFieldInstanceValidationHandler.execute({ fieldInstance, value }); }, }, pathRegistry: { diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Checkbox.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Checkbox.spec.js index 3b999e1f8..b15c11281 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Checkbox.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Checkbox.spec.js @@ -144,8 +144,7 @@ describe('Checkbox', function () { fireEvent.change(input, { target: { checked: false } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: false, }); }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Checklist.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Checklist.spec.js index d6ad3a8e8..c53dea889 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Checklist.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Checklist.spec.js @@ -248,8 +248,7 @@ describe('Checklist', function () { fireEvent.click(input); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['approver', 'manager'], }); }); @@ -269,8 +268,7 @@ describe('Checklist', function () { fireEvent.click(input, { target: { checked: false } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: [], }); }); @@ -294,8 +292,7 @@ describe('Checklist', function () { fireEvent.click(input); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['dynamicValue1', 'dynamicValue2'], }); }); @@ -317,8 +314,7 @@ describe('Checklist', function () { fireEvent.click(input); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['dynamicValue1', 'dynamicValue2'], }); }); @@ -346,8 +342,7 @@ describe('Checklist', function () { fireEvent.click(input); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: [ { id: 'user3', @@ -380,8 +375,7 @@ describe('Checklist', function () { fireEvent.click(input, { target: { checked: false } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: [], }); }); @@ -409,8 +403,7 @@ describe('Checklist', function () { fireEvent.click(input, { target: { checked: false } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: [], }); }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js index f8c0109d6..e88f4722c 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Datetime.spec.js @@ -129,8 +129,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dateField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '2000-01-01', }); }); @@ -152,8 +151,7 @@ describe('Datetime', function () { fireEvent.click(firstDayNode); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dateField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '1996-10-27', }); }); @@ -174,8 +172,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dateField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -202,8 +199,7 @@ describe('Datetime', function () { fireEvent.click(firstDayNode); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dateField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '1996-12-01', }); }); @@ -228,8 +224,7 @@ describe('Datetime', function () { fireEvent.click(firstDayNode); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dateField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '1996-09-29', }); }); @@ -254,8 +249,7 @@ describe('Datetime', function () { fireEvent.click(firstDayNode); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dateField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '1995-12-31', }); }); @@ -582,8 +576,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: timeField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '13:00', }); }); @@ -605,8 +598,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: timeField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '13:00', }); }); @@ -628,8 +620,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: timeField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -818,8 +809,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: datetimeField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '2000-01-01T11:00', }); }); @@ -841,8 +831,7 @@ describe('Datetime', function () { fireEvent.blur(timeInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: { ...datetimeField, use24h: true }, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '1996-11-13T12:00', }); }); @@ -864,8 +853,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: datetimeField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -887,8 +875,7 @@ describe('Datetime', function () { fireEvent.blur(dateInput); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: datetimeField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Dynamiclist.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Dynamiclist.spec.js index 1a28e2ea3..ada0e073b 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Dynamiclist.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Dynamiclist.spec.js @@ -137,7 +137,6 @@ describe('Dynamic List', () => { // then expect(onChangeSpy).to.have.been.calledWithMatch({ - field, value: [ { creditor: 'John Doe', diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Number.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Number.spec.js index ab97ee419..58bba5716 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Number.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Number.spec.js @@ -228,8 +228,7 @@ describe('Number', function () { fireEvent.input(input, { target: { value: '124' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 124, }); }); @@ -267,8 +266,7 @@ describe('Number', function () { fireEvent.input(input, { target: { value: '' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -290,8 +288,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 124, }); }); @@ -311,8 +308,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: decimalField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 123.001, }); }); @@ -332,8 +328,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stepField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 123.25, }); }); @@ -353,8 +348,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stepField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 123, }); }); @@ -374,8 +368,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stepField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: -0.75, }); }); @@ -396,8 +389,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 122, }); }); @@ -417,8 +409,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: decimalField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 122.999, }); }); @@ -438,8 +429,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stepField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 122.75, }); }); @@ -459,8 +449,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stepField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 122.75, }); }); @@ -480,8 +469,7 @@ describe('Number', function () { fireEvent.click(incrementButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stepField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: -1.25, }); }); @@ -504,8 +492,7 @@ describe('Number', function () { fireEvent.input(input, { target: { value: '124' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 124, }); }); @@ -526,8 +513,7 @@ describe('Number', function () { fireEvent.input(input, { target: { value: 124 } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stringField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '124', }); }); @@ -548,8 +534,7 @@ describe('Number', function () { fireEvent.input(input, { target: { value: '125' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stringField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '125', }); }); @@ -573,8 +558,7 @@ describe('Number', function () { fireEvent.input(input, { target: { value: highPrecisionStringNumber } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: stringField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: highPrecisionStringNumber, }); }); @@ -596,8 +580,7 @@ describe('Number', function () { // then expect(input.value).to.equal('NaN'); - expect(onChangeSpy).to.have.been.calledWith({ - field: stringField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -700,8 +683,7 @@ describe('Number', function () { fireEvent.keyDown(input, { key: 'Backspace', code: 'Backspace' }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -724,8 +706,7 @@ describe('Number', function () { fireEvent.keyDown(input, { key: 'Delete', code: 'Delete' }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -748,8 +729,7 @@ describe('Number', function () { fireEvent.keyDown(input, { key: 'ArrowUp', code: 'ArrowUp' }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 1, }); }); @@ -772,8 +752,7 @@ describe('Number', function () { fireEvent.keyDown(input, { key: 'ArrowDown', code: 'ArrowDown' }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: -1, }); }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Radio.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Radio.spec.js index fd06ac5e5..913791c0d 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Radio.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Radio.spec.js @@ -198,8 +198,7 @@ describe('Radio', function () { fireEvent.click(input); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'dynamicValue2', }); }); @@ -221,8 +220,7 @@ describe('Radio', function () { fireEvent.click(input, { target: { checked: false } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'dynamicValue1', }); }); @@ -244,8 +242,7 @@ describe('Radio', function () { fireEvent.click(input); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'camunda-cloud', }); }); @@ -265,8 +262,7 @@ describe('Radio', function () { fireEvent.click(input, { target: { checked: false } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'camunda-platform', }); }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Select.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Select.spec.js index ad6795515..e044b0da4 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Select.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Select.spec.js @@ -288,8 +288,7 @@ describe('Select', function () { fireEvent.mouseDown(germanSelector); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'german', }); }); @@ -310,8 +309,7 @@ describe('Select', function () { // then const dropdown = container.querySelector('.fjs-dropdownlist'); expect(dropdown).to.not.exist; - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -339,8 +337,7 @@ describe('Select', function () { fireEvent.mouseDown(germanSelector); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'dynamicValue1', }); }); @@ -361,8 +358,7 @@ describe('Select', function () { fireEvent.mouseDown(cross); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -398,8 +394,7 @@ describe('Select', function () { fireEvent.mouseDown(germanSelector); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: expressionField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'value1', }); }); @@ -588,8 +583,7 @@ describe('Select', function () { fireEvent.mouseDown(cross); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: expressionField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -823,8 +817,7 @@ describe('Select', function () { fireEvent.mouseDown(germanSelector); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: { ...defaultField, searchable: true }, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'german', }); }); @@ -867,8 +860,7 @@ describe('Select', function () { fireEvent.mouseDown(cross); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: { ...defaultField, searchable: true }, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Taglist.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Taglist.spec.js index 2f8ae0f34..2e46996a4 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Taglist.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Taglist.spec.js @@ -311,8 +311,7 @@ describe('Taglist', function () { fireEvent.click(removeButton); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['tag1', 'tag3'], }); }); @@ -331,8 +330,7 @@ describe('Taglist', function () { fireEvent.keyDown(filterInput, { key: 'Backspace', code: 'Backspace' }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['tag1', 'tag2'], }); }); @@ -353,8 +351,7 @@ describe('Taglist', function () { fireEvent.keyDown(filterInput, { key: 'Backspace', code: 'Backspace' }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: dynamicField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['dynamicValue1'], }); }); @@ -654,8 +651,7 @@ describe('Taglist', function () { fireEvent.mouseDown(focusedItem); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['tag1', 'tag2', 'tag3', 'tag4'], }); }); @@ -675,8 +671,7 @@ describe('Taglist', function () { fireEvent.keyDown(filterInput, { key: 'Enter', code: 'Enter' }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['tag1', 'tag2', 'tag3', 'tag4'], }); }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Textarea.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Textarea.spec.js index 0339344fa..48b01e979 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Textarea.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Textarea.spec.js @@ -155,8 +155,7 @@ describe('Textarea', function () { fireEvent.input(textarea, { target: { value: 'A different text area value' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'A different text area value', }); }); @@ -199,8 +198,7 @@ describe('Textarea', function () { fireEvent.input(textarea, { target: { value: '' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '', }); }); diff --git a/packages/form-js-viewer/test/spec/render/components/form-fields/Textfield.spec.js b/packages/form-js-viewer/test/spec/render/components/form-fields/Textfield.spec.js index b37f365a8..857d15769 100644 --- a/packages/form-js-viewer/test/spec/render/components/form-fields/Textfield.spec.js +++ b/packages/form-js-viewer/test/spec/render/components/form-fields/Textfield.spec.js @@ -227,8 +227,7 @@ describe('Textfield', function () { fireEvent.input(input, { target: { value: 'Jane Doe Company' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: 'Jane Doe Company', }); }); @@ -248,8 +247,7 @@ describe('Textfield', function () { fireEvent.input(input, { target: { value: '' } }); // then - expect(onChangeSpy).to.have.been.calledWith({ - field: defaultField, + expect(onChangeSpy).to.have.been.calledWithMatch({ value: '', }); }); diff --git a/packages/form-js-viewer/test/spec/render/hooks/useCleanupMultiSelectValues.spec.js b/packages/form-js-viewer/test/spec/render/hooks/useCleanupMultiSelectValues.spec.js index cb454a2b1..6a3096149 100644 --- a/packages/form-js-viewer/test/spec/render/hooks/useCleanupMultiSelectValues.spec.js +++ b/packages/form-js-viewer/test/spec/render/hooks/useCleanupMultiSelectValues.spec.js @@ -26,8 +26,7 @@ describe('useCleanupMultiSelectValue', function () { // then expect(onChangeSpy).to.have.been.calledOnce; - expect(onChangeSpy).to.have.been.calledWith({ - field: 'foo', + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['camunda-cloud'], }); }); @@ -70,8 +69,7 @@ describe('useCleanupMultiSelectValue', function () { // then expect(onChangeSpy).to.have.been.calledOnce; - expect(onChangeSpy).to.have.been.calledWith({ - field: 'foo', + expect(onChangeSpy).to.have.been.calledWithMatch({ value: ['camunda-cloud'], }); }); diff --git a/packages/form-js-viewer/test/spec/render/hooks/useCleanupSingleSelectValue.spec.js b/packages/form-js-viewer/test/spec/render/hooks/useCleanupSingleSelectValue.spec.js index f11c1c702..73fc96b7c 100644 --- a/packages/form-js-viewer/test/spec/render/hooks/useCleanupSingleSelectValue.spec.js +++ b/packages/form-js-viewer/test/spec/render/hooks/useCleanupSingleSelectValue.spec.js @@ -26,8 +26,7 @@ describe('useCleanupSingleSelectValue', function () { // then expect(onChangeSpy).to.have.been.calledOnce; - expect(onChangeSpy).to.have.been.calledWith({ - field: 'foo', + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); }); @@ -70,8 +69,7 @@ describe('useCleanupSingleSelectValue', function () { // then expect(onChangeSpy).to.have.been.calledOnce; - expect(onChangeSpy).to.have.been.calledWith({ - field: 'foo', + expect(onChangeSpy).to.have.been.calledWithMatch({ value: null, }); });