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
T181273 Make text boxes react faster #1063
Conversation
Add wrapper function for text components that calls the change and validation handler function on keypress events.
This solves a problem that was discovered during investigating https://phabricator.wikimedia.org/T181277, but the description there hints more at a problem with overlapping, unclickable elements, probably caused by https://phabricator.wikimedia.org/T181273 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work but sure enough opens new challenges (inconsistent form behaviour, ...)
@@ -200,6 +201,16 @@ module.exports = { | |||
bankDataElements.accountNumberElement.on( 'change', createDefaultChangeHandler( store, 'accountNumber' ) ); | |||
bankDataElements.bankCodeElement.on( 'change', createDefaultChangeHandler( store, 'bankCode' ) ); | |||
return component; | |||
}, | |||
|
|||
makeTextComponentMoreSnappy: function( textComponent, debounceDelay ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the point, but maybe createEagerlyValidatingTextComponent
would be a better fit.
|
||
t.ok( component.validator.calledOnce, 'validator was called once' ); | ||
t.ok( component.validator.calledWith( fakeEvent ), 'validator was called with event' ); | ||
}, 5 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plays with the hope that 1 < 5 and thus the debunce will always be finished before we test?!
Wouldn't it be nicer to stub out the _.debounce
(it's not SUT) and perform a synchronous test?
For testing the integration with lodash (if that was the goal) we could grab a hold of the timer functions.
Add wrapper function for text components that calls the change and
validation handler function on keypress events.