Filterable: fix preventDefault not working #7154

Closed
wants to merge 1 commit into from

3 participants

@gabrielschulhof gabrielschulhof added this to the 1.4.3 milestone Feb 28, 2014
@arschmitz arschmitz commented on the diff Apr 7, 2014
js/widgets/filterable.backcompat.js
@@ -72,7 +72,8 @@ $.widget( "mobile.filterable", $.mobile.filterable, {
// Also trigger listviewbeforefilter if this widget is also a listview
this._widget._trigger( "beforefilter", event, data );
}
- this._super( type, event, data );
+ // Passing back the response enables calling preventDefault()
@arschmitz
jQuery Foundation member

Need blank line before comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@arschmitz arschmitz commented on the diff Apr 7, 2014
tests/integration/filterable/filterable_core.js
@@ -67,6 +67,28 @@
], 500 );
});
+ asyncTest( "Calling preventDefault on 'filterablebeforefilter' stops the filter from running", function() {
@arschmitz
jQuery Foundation member

lines should be less then 100 characters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@arschmitz arschmitz commented on the diff Apr 7, 2014
tests/integration/filterable/filterable_core.js
+ asyncTest( "Calling preventDefault on 'filterablebeforefilter' stops the filter from running", function() {
+ expect( 1 );
+
+ var input = $( "#test-prevent-default-handler" ),
+ listview = $( "#test-prevent-default-signal-emission" );
+
+ listview.on( "filterablebeforefilter.theEventIsPrevented", function (e) {
+ e.preventDefault();
+ });
+
+ $.testHelper.sequence([
+ function() {
+ input.val( "a" ).trigger( "change" );
+ },
+ function() {
+ deepEqual( listview.children( ".ui-screen-hidden" ).length, 0, "No children are hidden." );
@arschmitz
jQuery Foundation member

lines should be less then 100 characters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@arschmitz
jQuery Foundation member

@gabrielschulhof if you want to rebase these few minor changes 👍

@gabrielschulhof

Awesome! Will do!

@gabrielschulhof gabrielschulhof added a commit that closed this pull request Apr 8, 2014
@frequent frequent Filterable: fix preventDefault not working
Closes gh-7154
Fixes gh-7153
6b46425
@gabrielschulhof gabrielschulhof added a commit that referenced this pull request Apr 8, 2014
@frequent frequent Filterable: fix preventDefault not working
Closes gh-7154
Fixes gh-7153

(cherry picked from commit 6b46425)
6a08158
@frequent

@arschmitz, @gabrielschulhof : too late to join the party. Thanks for fixing.

@frequent frequent deleted the frequent:fix_7153 branch Sep 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment