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

Copy and paste broken when caret in middle of value #79

Open
ryanggrey opened this issue Jul 5, 2017 · 2 comments
Open

Copy and paste broken when caret in middle of value #79

ryanggrey opened this issue Jul 5, 2017 · 2 comments
Labels

Comments

@ryanggrey
Copy link
Contributor

To reproduce issue:

  • Follow Developing section in readme and load localhost:3000 in browser
  • Type 12 in default finput field
  • Select all and copy
  • Position caret between 1 and 2
  • Paste

Observed (broken) behaviour:
12 is completely replaced with 12 making it look like no paste has happened.

Expected:
Value should now be 1,212

The fix needs to be tested on both mac & windows. We should probably test edge cases such as positioning the caret before and after thousands/decimal delimiters before pasting.

@oriondean oriondean added the bug label Jul 6, 2017
@msuperina
Copy link
Contributor

@ryanggrey I am working on this bug.
Would it be possible to give me some advice about possible combinations and edge cases to test ?

@ryanggrey
Copy link
Contributor Author

ryanggrey commented Jul 25, 2018

@msuperina I guess cases would include (I'm making up my own notation here so let me know if it isn't clear):

  • pasting at the beginning of existing value: [paste 12]12 => 1,212
  • pasting in the middle of existing value where there are no delimiters: 1[paste 12]2 => 1,122
  • pasting in the middle of existing value before a thousands delimiter: 1[paste 12],212 => 112,212
  • pasting in the middle of existing value after a thousands delimiter: 1,[paste 12]212 => 112,212
  • pasting at the end of existing value: 12[paste 12] => 1,212
  • pasting in the middle of existing value before a decimal delimiter: 12[paste 12].00 => 1,212.00
  • pasting in the middle of existing value after a decimal delimiter: 12.[paste 12]00 => 12.12. There's additional behaviour to consider here - what if the value pasted after the decimal delimiter is more than the number of allowed decimal digits? Not sure what should happen here. One option is to truncate the pasted value (12.[paste 1234]00 => 12.12)
  • pasting in the middle of existing decimal value: 12.1[paste 12]2 => ?. Again not sure what the behaviour here should be. One option is to treat as though we'd expanded to over the allowed decimals and then truncated it to allowed decimal places (12.11)

And then permutations of those with different options settings. There's possibly more cases that I'm missing.

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