Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What exactly is overwrite mode? #415

Open
cgatian opened this issue Nov 13, 2020 · 1 comment
Open

What exactly is overwrite mode? #415

cgatian opened this issue Nov 13, 2020 · 1 comment
Labels

Comments

@cgatian
Copy link

cgatian commented Nov 13, 2020

From the docs

It enables characters overwriting instead of inserting

What exactly does that mean? From my testing enabling or disabling overwrite has no affect on the output produced. The only unit test produces the same result regardless of overwrite being true or false.

https://stackblitz.com/edit/imask-overwrite?file=index.js

@uNmAnNeR uNmAnNeR added the docs label Feb 9, 2021
@otacilioMota
Copy link

I also had the same doubt, but I identified the issue 129 that originated this functionality and I understood the problem it solves.

Explaining: The overwrite property is useful when you work with an input and, after typing a value, you go back to some previous position and type again. At that point, it will check the overwrite. If it has 'true' then it replaces the character that is currently in it. If it has 'false' then it adds a new character and pushes the others.

Simulate: https://stackblitz.com/edit/js-1rivqr?file=index.js

overwrite 'true':

  1. Fill the input with 12345;
  2. Go back to second position and type 7;
  3. The result will be: 17345;

overwrite 'false':

  1. Fill the input with 12345;
  2. Go back to second position and type 7;
  3. The result will be: 127345;

In unit test this functionality is not clear, as it needs an input to simulate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants