Skip to content

Commit

Permalink
FIO-9197: Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekotikov committed Oct 15, 2024
1 parent 02aa543 commit 1cff328
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/unit/Day.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ describe('Day Component', () => {
});
});

it('Should not show error when form loaded with defaultValue = "00/00/0000"', (done) => {
Formio.createForm(document.createElement('div'), comp5, {}).then((form) => {
const dayComponent = form.getComponent('day');
assert.equal(dayComponent.visibleErrors.length, 0);
assert.equal(form.data.day, '');
const buttonComponent = form.getComponent('submit');
buttonComponent.refs.button.click();
setTimeout(()=>{
assert.equal(dayComponent.visibleErrors.length, 1);
assert.equal(dayComponent.visibleErrors[0].message, 'Day is required');
done();
},200);
});
});

it('Should change the max day when the month changes', (done) => {
Harness.testCreate(DayComponent, comp1).then((component) => {
Harness.testElements(component, 'option', 13);
Expand Down
6 changes: 6 additions & 0 deletions test/unit/fixtures/day/comp5.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@ export default {
input: true,
defaultValue: '00/00/0000'
},
{
type: 'button',
action: 'submit',
label: 'Submit',
theme: 'primary'
}
]
};

0 comments on commit 1cff328

Please sign in to comment.