fix(field): added Date support to InteractionStateMixin
This commit is contained in:
parent
22bb75a868
commit
cfd78bdccc
2 changed files with 6 additions and 2 deletions
|
|
@ -60,7 +60,7 @@ export const InteractionStateMixin = dedupeMixin(
|
|||
value = modelValue.viewValue;
|
||||
}
|
||||
// Checks for empty platform types: Objects, Arrays, Dates
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
if (typeof value === 'object' && value !== null && !(value instanceof Date)) {
|
||||
return !!Object.keys(value).length;
|
||||
}
|
||||
// eslint-disable-next-line no-mixed-operators
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { InteractionStateMixin } from '../src/InteractionStateMixin.js';
|
|||
export function runInteractionStateMixinSuite(customConfig) {
|
||||
const cfg = {
|
||||
tagString: null,
|
||||
allowedModelValueTypes: [Array, Object, Number, Boolean, String],
|
||||
allowedModelValueTypes: [Array, Object, Number, Boolean, String, Date],
|
||||
suffix: '',
|
||||
...customConfig,
|
||||
};
|
||||
|
|
@ -154,6 +154,10 @@ export function runInteractionStateMixinSuite(customConfig) {
|
|||
changeModelValueAndLeave('');
|
||||
expect(el.prefilled, 'empty string should not be "prefilled"').to.be.false;
|
||||
}
|
||||
if (cfg.allowedModelValueTypes.includes(Date)) {
|
||||
changeModelValueAndLeave(new Date());
|
||||
expect(el.prefilled, 'Dates should be "prefilled"').to.be.true;
|
||||
}
|
||||
|
||||
// Not prefilled
|
||||
changeModelValueAndLeave(null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue