Enterprise: Datepicker: mask is lost after updated is called

Created on 24 Sep 2019  路  10Comments  路  Source: infor-design/enterprise

Describe the bug
The mask on a date picker is lost after updated is called on the component.

The teardown method is causing this.element.data('mask') to return "" instead of undefined, so the mask doesn't get re-inited here.

To Reproduce
Steps to reproduce the behavior:

  1. Copy test-mask-after-update
    test-mask-after-update.zip into app/views/components/datepicker.
  2. Navigate to '/components/datepicker/test-mask-after-update.html'
  3. Enter some numbers manually into the field, see that slashes are automatically put in and the date is formated
  4. Clear out the field, and click the updated button
  5. Enter some numbers manually into the field, see that no slashes are added and no formatting occurs.

Expected behavior
The mask should still work after updated is called on the datepicker component.

Version

  • ids-enterprise: v4.22.0-dev and earlier

Screenshots
DatepickerMaskIssue

Platform

  • All
[2] customer critical type test

All 10 comments

The problem is here https://github.com/infor-design/enterprise/blob/master/src/components/datepicker/datepicker.js#L418 as after the component is detroyed the mask variable is set to empty string not undefined and will never reinvoke the mask.

The fix should be to move this line https://github.com/infor-design/enterprise/blob/master/src/components/datepicker/datepicker.js#L1639

Down a bit to after https://github.com/infor-design/enterprise/blob/master/src/components/datepicker/datepicker.js#L1654

And set it to undefined not empty string. Seems like even the mask is not getting destroyed.

@lipetzan I know this is in our upcoming release to customers. Which I believe uses EP 4.21. Do we need a patch for this or can it wait until next CU?

Just let me know asap i can do either a 4.21 patch or just add it in 4.22 which freezes EOM

Please add some unit tests for form field masks. Adding a tag for that.

There are tests for mask but not the case of doing a destroy and then reinvoking. Adding a test on the PR... Incomming

We added a tag "for customer". We didnt want to increase the number of tags as we have a system in place.

What are these new tags for?

Removing these new tags as they dont make sense to us. But let me know what the purpose as and we can try to fit it into our system. Just let me know if you need a tag and what for.

"There are tests for mask but not the case of doing a destroy and then reinvoking. Adding a test on the PR... Incomming"

@tmcconechy We probably need test for all components updated() functions that destroy and then reinvoke. But that's not in the scope of this ticket

That would be a separate issue. Feel free to raise. Many should be there but would be a tad bit of work to check every single component and make sure there is a test like that for each of them.

Was this page helpful?
0 / 5 - 0 ratings