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

T181273 Make text boxes react faster #1063

Merged
merged 3 commits into from Dec 4, 2017

Conversation

gbirke
Copy link
Member

@gbirke gbirke commented Nov 30, 2017

Add wrapper function for text components that calls the change and
validation handler function on keypress events.

Add wrapper function for text components that calls the change and
validation handler function on keypress events.
@gbirke
Copy link
Member Author

gbirke commented Nov 30, 2017

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

Copy link
Contributor

@wiese wiese left a 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 ) {
Copy link
Contributor

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 );
Copy link
Contributor

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.

@JeroenDeDauw JeroenDeDauw merged commit 712f16e into master Dec 4, 2017
@JeroenDeDauw JeroenDeDauw deleted the cat17-faster-address-fields branch December 4, 2017 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants