Selectmenu: Delay trigger until after the list closes #7197

Closed
wants to merge 3 commits into
from

Projects

None yet

3 participants

@gabrielschulhof
Contributor

Fixes gh-7076

Coverage Status

Coverage remained the same when pulling 4116f85 on 7076-delay-value-change-trigger into 00e80c9 on master.

@gabrielschulhof gabrielschulhof added this to the 1.4.3 milestone Feb 28, 2014
@arschmitz arschmitz commented on an outdated diff May 29, 2014
tests/integration/select/select_core.js
+ });
+ return origTrigger.apply( this, arguments );
+ };
+
+ openEvent.event += ns + "1";
+ closeEvent.event += ns + "2";
+
+ $.testHelper.detailedEventCascade([
+ function() {
+ $( "#" + select.attr( "id" ) + "-button" ).click();
+ },
+ {
+ openevent: openEvent
+ },
+ function() {
+ $.event.trigger = replacementTrigger;
arschmitz
arschmitz May 29, 2014 Owner

this should be done as part of setup and teardown

Coverage Status

Coverage increased (+0.12%) when pulling e758e34 on 7076-delay-value-change-trigger into 7b818d8 on master.

@arschmitz arschmitz commented on an outdated diff Jun 2, 2014
js/widgets/forms/select.custom.js
@@ -243,14 +247,16 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
.toggleClass( "ui-checkbox-off", !option.selected );
}
- // trigger change if value changed
- if ( self.isMultiple || oldIndex !== newIndex ) {
- self.select.trigger( "change" );
+ // if it's not a multiple select, trigger change after it has finished closing
arschmitz
arschmitz Jun 2, 2014 Owner

Capitalize first word of comments

@arschmitz arschmitz commented on an outdated diff Jun 2, 2014
js/widgets/forms/select.custom.js
}
+ // trigger change if it's a multiple select
@arschmitz arschmitz commented on an outdated diff Jun 2, 2014
js/widgets/forms/select.custom.js
@@ -243,14 +247,16 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
.toggleClass( "ui-checkbox-off", !option.selected );
}
- // trigger change if value changed
- if ( self.isMultiple || oldIndex !== newIndex ) {
- self.select.trigger( "change" );
+ // if it's not a multiple select, trigger change after it has finished closing
+ if ( !self.isMultiple && oldIndex !== newIndex ) {
+ self._triggerChange = true;
arschmitz
arschmitz Jun 2, 2014 Owner

should switch to use _on to remove need for self

Coverage Status

Coverage increased (+0.35%) when pulling f2f89c3 on 7076-delay-value-change-trigger into 7b818d8 on master.

Coverage Status

Coverage increased (+0.11%) when pulling 9c2ea16 on 7076-delay-value-change-trigger into 44f503d on master.

Owner

👍

@gabrielschulhof gabrielschulhof added a commit that referenced this pull request Jun 6, 2014
@gabrielschulhof gabrielschulhof Selectmenu: Delay trigger until after the list closes
(cherry picked from commit dde4873)

Closes gh-7197
Fixes gh-7076
ea0533f
@gabrielschulhof gabrielschulhof deleted the 7076-delay-value-change-trigger branch Jun 6, 2014
@agcolom agcolom added a commit to agcolom/jquery-mobile that referenced this pull request Nov 26, 2014
@gabrielschulhof @agcolom gabrielschulhof + agcolom Selectmenu: Delay trigger until after the list closes
Closes gh-7197
Fixes gh-7076
436a2f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment