diff --git a/tests/unit/navigation/index.html b/tests/unit/navigation/index.html index feb2f278113..583cf49448d 100644 --- a/tests/unit/navigation/index.html +++ b/tests/unit/navigation/index.html @@ -263,5 +263,13 @@

Dialog

back button + + + +
+ foo +
+ +
diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index 421816f8b97..9373c500165 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -787,6 +787,38 @@ ]); }); + asyncTest( "clicks with middle mouse button are ignored", function() { + $.testHelper.pageSequence([ + function() { + $.testHelper.openPage( "#odd-clicks-page" ); + }, + + function() { + $( "#right-or-middle-click" ).click(); + }, + + // make sure the page is opening first without the mocked button click value + // only necessary to prevent issues with test specific fixtures + function() { + same($.mobile.activePage[0], $("#odd-clicks-page-dest")[0]); + $.testHelper.openPage( "#odd-clicks-page" ); + + // mock the which value to simulate a middle click + $.Event.prototype.which = 2; + }, + + function() { + $( "#right-or-middle-click" ).click(); + }, + + function( timeout ) { + ok( timeout, "page event handler timed out due to ignored click" ); + ok($.mobile.activePage[0] !== $("#odd-clicks-page-dest")[0], "pages are not the same"); + start(); + } + ]); + }); + asyncTest( "handling of button active state when navigating by clicking back button", 1, function(){ $.testHelper.pageSequence([ // open our test page