Skip to content

Commit

Permalink
FIO-9086: autotests
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria.Golomb committed Oct 2, 2024
1 parent 98680ce commit 77da922
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/unit/Time.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,32 @@ describe('Time Component', () => {
}).catch(done);
});

it('Should return error if data in multiple time component is not valid', (done) => {
const formElement = document.createElement('div');
const form = new Webform(formElement);
form.setForm(timeForm2).then(() => {
const component = form.components[1];
Harness.setInputValue(component, 'data[multipleTime]', ['89:19']);
setTimeout(() => {
assert.equal(component.errors[0].message, 'Invalid time', 'Should have an error');
done();
}, 650);
}).catch(done);
});

it('Should not return error if data in multiple time component is not valid', (done) => {
const formElement = document.createElement('div');
const form = new Webform(formElement);
form.setForm(timeForm2).then(() => {
const component = form.components[1];
Harness.setInputValue(component, 'data[multipleTime]', ['10:00:00']);
setTimeout(() => {
assert.equal(component.errors.length, 0, 'Should not have an error');
done();
}, 650);
}).catch(done);
});

it('Should build a time component', (done) => {
Harness.testCreate(TimeComponent, comp3).then((time) => {
assert.deepEqual(time.dataValue, ['10:00:00', '11:00:00'], 'Should be set to default value');
Expand Down
9 changes: 9 additions & 0 deletions test/unit/fixtures/time/timeForm2.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export default {
'input': true,
'inputMask': '99:99'
},
{
'label': 'Multiple Time',
'inputType': 'text',
'tableView': true,
'key': 'multipleTime',
'type': 'time',
'input': true,
'inputMask': '99:99'
},
{
'label': 'Submit',
'showValidations': false,
Expand Down

0 comments on commit 77da922

Please sign in to comment.