Skip to content

Commit

Permalink
FIO-9347 fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-formio committed Nov 20, 2024
1 parent 85215d0 commit 7385833
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions test/unit/WebformBuilder.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ describe('Select Component selectData property', () => {

setTimeout(() => {
const defaultValue = builder.editForm.getComponent('defaultValue');
assert.equal(defaultValue.type, 'select');
defaultValue.setValue('value1');
defaultValue.updateItems(null, true);

Expand All @@ -631,16 +632,19 @@ describe('Select Component selectData property', () => {
'Label 1',
);

builder.editComponent(
builder.webform.getComponent('select').schema,
builder.element.querySelector('.builder-components'),
false,
false,
builder.webform.getComponent('select').component,
{ inDataGrid: false }
);
const click = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});

builder.webform.getComponent('select').element
.querySelector('.component-settings-button-edit')
.dispatchEvent(click);

setTimeout(() => {
const defaultValue = builder.editForm.getComponent('defaultValue');
assert.equal(defaultValue.type, 'select');
defaultValue.setValue('value2');
defaultValue.updateItems(null, true);

Expand All @@ -656,8 +660,8 @@ describe('Select Component selectData property', () => {
);
done();
}, 150);
}, 150);
}, 350);
}, 250);
}, 500);
}, 150);
}, 250);
}, 250);
Expand All @@ -682,6 +686,7 @@ describe('Select Component selectData property', () => {

setTimeout(() => {
const defaultValue = builder.editForm.getComponent('defaultValue');
assert.equal(defaultValue.type, 'select');
defaultValue.setValue(['value1', 'value3']);
defaultValue.updateItems(null, true);

Expand All @@ -702,16 +707,19 @@ describe('Select Component selectData property', () => {
['Label 1', 'Label 3'],
);

builder.editComponent(
builder.webform.getComponent('select').schema,
builder.element.querySelector('.builder-components'),
false,
false,
builder.webform.getComponent('select').component,
{ inDataGrid: false }
);
const click = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});

builder.webform.getComponent('select').element
.querySelector('.component-settings-button-edit')
.dispatchEvent(click);

setTimeout(() => {
const defaultValue = builder.editForm.getComponent('defaultValue');
assert.equal(defaultValue.type, 'select');
defaultValue.setValue(['value2', 'value3']);
defaultValue.updateItems(null, true);

Expand All @@ -734,7 +742,7 @@ describe('Select Component selectData property', () => {
done();
}, 150);
}, 250);
}, 350);
}, 500);
}, 150);
}, 250);
}, 250);
Expand Down

0 comments on commit 7385833

Please sign in to comment.