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

Tests are failing on restrictNumeric and restrictAlphaNumeric #4

Open
omarshammas opened this issue Sep 10, 2013 · 1 comment
Open
Labels

Comments

@omarshammas
Copy link
Owner

The tests are failing, but in practice it works.

@omarshammas
Copy link
Owner Author

It appears that triggering the keypress event using js is not the same as clicking the input field and pressing 4.

$number = $('<input />').val('123')

e = $.Event('keypress')
e.which = 52 # 4
$number.trigger(e)

assert_equal '1234', $number.val()

So you may be wondering why do the tests pass on the other fields even though their formatters are also listening to the keypress event?

Even though they're listening for the keypress event, the value of the field is modified directly. For example the data formatter does

$target.val("#{val} / ")

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

1 participant