Skip to content

Commit

Permalink
Revert "FIO-8797: set empty day component value to the empty string"
Browse files Browse the repository at this point in the history
This reverts commit 65a1cfa.
  • Loading branch information
lane-formio committed Sep 12, 2024
1 parent 5511439 commit 8784871
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/WebformBuilder.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('WebformBuilder tests', function() {
done();
}, 200);
}, 200);
}, 300);
}, 150);
}).catch(done);
});

Expand Down
7 changes: 4 additions & 3 deletions src/components/day/Day.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ export default class DayComponent extends Field {

/**
* The empty value for day component.
* @returns {''} - The empty value of the day component.
*
* @return {'00/00/0000'}
*/
get emptyValue() {
return '';
return '00/00/0000';
}

get valueMask() {
Expand Down Expand Up @@ -414,7 +415,7 @@ export default class DayComponent extends Field {
setValueAt(index, value) {
// temporary solution to avoid input reset
// on invalid date.
if (value === 'Invalid date') {
if (!value || value === 'Invalid date') {
return null;
}
const parts = value.split('/');
Expand Down
11 changes: 0 additions & 11 deletions src/components/day/Day.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ describe('Day Component', () => {
});
});

it('Should handle blank data correctly', (done) => {
Harness.testCreate(DayComponent, comp1).then((component) => {
component.setValue();
assert.equal(component.getValue(), '');
component.checkValidity();
assert.equal(component.errors.length, 0, 'Component should be valid with blank data');

done();
});
});

it('Should change the max day when the month changes', (done) => {
Harness.testCreate(DayComponent, comp1).then((component) => {
Harness.testElements(component, 'option', 13);
Expand Down
2 changes: 1 addition & 1 deletion test/renders/component-bootstrap-day-html-value0.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<label ref="label" class="col-form-label " for="day-day" id="l-day-day">
Day
</label>
<div ref="value">-</div>
<div ref="value">00/00/0000</div>
<div ref="messageContainer" class="formio-errors invalid-feedback"></div>
</div>

0 comments on commit 8784871

Please sign in to comment.