jquery.formance
jquery.formance copied to clipboard
Tests are failing on restrictNumeric and restrictAlphaNumeric
The tests are failing, but in practice it works.
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} / ")