This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigation: When going forward, grab transition from current entry
Our history entries contain exactly one transition: The one used to arrive at the entry. In addition, the index of the current entry and that of the previous entry is updated before the value for the transition is computed. So, it makes sense, when going backwards, to read the transition value from the previous entry, because that value stores the transition that was used to get there from where history is currently at. However, when going forward, it makes no sense to read the transition value from the previous entry, because that one stores the transition that was used to reach it, not the transition that must be used to reach the next entry. Closes gh-7485 Fixes gh-1867 Fixes gh-4951
- Loading branch information
Gabriel Schulhof
committed
Jul 24, 2014
1 parent
8334371
commit 8ea937f
Showing
6 changed files
with
259 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
tests/integration/pagecontainer/transition-choice-dialog-tests.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Popup Test Suite</title> | ||
|
||
<script src="../../../external/requirejs/require.js"></script> | ||
<script src="../../../js/requirejs.config.js"></script> | ||
<script src="../../../js/jquery.tag.inserter.js"></script> | ||
<script src="../../jquery.setNameSpace.js"></script> | ||
<script src="../../../tests/jquery.testHelper.js"></script> | ||
|
||
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/> | ||
<link rel="stylesheet" href="../../../external/qunit/qunit.css"/> | ||
<link rel="stylesheet" href="../../jqm-tests.css"/> | ||
<script src="../../../external/qunit/qunit.js"></script> | ||
<script> | ||
$.testHelper.asyncLoad([ | ||
[ "widgets/dialog" ], | ||
[ "jquery.mobile.init" ], | ||
[ | ||
"transition_choice_dialog_core.js" | ||
] | ||
]); | ||
</script> | ||
|
||
<script src="../../swarminject.js"></script> | ||
</head> | ||
<body> | ||
<div id="qunit"></div> | ||
|
||
<div data-nstest-role="page" id="a"> | ||
<a id="go-to-b" data-nstest-transition="flip" data-nstest-rel="dialog" href="#b">Go to b</a> | ||
</div> | ||
|
||
<div data-nstest-role="dialog" id="b"> | ||
<a id="go-to-c" data-nstest-transition="slide" data-nstest-rel="dialog" href="#c">Go to c</a> | ||
</div> | ||
|
||
<div data-nstest-role="dialog" id="c"> | ||
</div> | ||
</body> | ||
</html> |
43 changes: 43 additions & 0 deletions
43
tests/integration/pagecontainer/transition-choice-tests.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>jQuery Mobile Popup Test Suite</title> | ||
|
||
<script src="../../../external/requirejs/require.js"></script> | ||
<script src="../../../js/requirejs.config.js"></script> | ||
<script src="../../../js/jquery.tag.inserter.js"></script> | ||
<script src="../../jquery.setNameSpace.js"></script> | ||
<script src="../../../tests/jquery.testHelper.js"></script> | ||
|
||
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/> | ||
<link rel="stylesheet" href="../../../external/qunit/qunit.css"/> | ||
<link rel="stylesheet" href="../../jqm-tests.css"/> | ||
<script src="../../../external/qunit/qunit.js"></script> | ||
<script> | ||
$.testHelper.asyncLoad([ | ||
[ "jquery.mobile.init" ], | ||
[ | ||
"transition_choice_core.js" | ||
] | ||
]); | ||
</script> | ||
|
||
<script src="../../swarminject.js"></script> | ||
</head> | ||
<body> | ||
<div id="qunit"></div> | ||
|
||
<div data-nstest-role="page" id="a"> | ||
<a id="go-to-b" data-nstest-transition="flip" href="#b">Go to b</a> | ||
</div> | ||
|
||
<div data-nstest-role="page" id="b"> | ||
<a id="go-to-c" data-nstest-transition="slide" href="#c">Go to c</a> | ||
</div> | ||
|
||
<div data-nstest-role="page" id="c"> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
( function() { | ||
|
||
var origChange, callSequence; | ||
|
||
module( "Pagecontainer transition choice", { | ||
setup: function() { | ||
callSequence = []; | ||
origChange = $.mobile.pagecontainer.prototype.change; | ||
$.mobile.pagecontainer.prototype.change = function( url, options ) { | ||
callSequence.push({ | ||
transition: options.transition, | ||
reverse: !!( options.reverse ) | ||
}); | ||
return origChange.apply( this, arguments ); | ||
}; | ||
}, | ||
teardown: function() { | ||
$.mobile.pagecontainer.prototype.change = origChange; | ||
} | ||
}); | ||
|
||
asyncTest( "Pagecontainer chooses correct transition", function() { | ||
debugger; | ||
|
||
var pageContainer = $( ":mobile-pagecontainer" ); | ||
|
||
$.testHelper.pageSequence([ | ||
function() { | ||
$( "#go-to-b" ).click(); | ||
}, | ||
function() { | ||
$( "#go-to-c" ).click(); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "back" ); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "forward" ); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "back" ); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "back" ); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "forward" ); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "back" ); | ||
}, | ||
function() { | ||
deepEqual( callSequence, | ||
[ | ||
{ transition: "flip", reverse: false }, | ||
{ transition: "slide", reverse: false }, | ||
{ transition: "slide", reverse: true }, | ||
{ transition: "slide", reverse: false }, | ||
{ transition: "slide", reverse: true }, | ||
{ transition: "flip", reverse: true }, | ||
{ transition: "flip", reverse: false }, | ||
{ transition: "flip", reverse: true } | ||
], | ||
"call sequence has resulted in the correct transitions" ); | ||
|
||
start(); | ||
} | ||
]); | ||
}); | ||
|
||
})(); |
55 changes: 55 additions & 0 deletions
55
tests/integration/pagecontainer/transition_choice_dialog_core.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
( function() { | ||
|
||
var origChange, callSequence; | ||
|
||
module( "Pagecontainer transition choice", { | ||
setup: function() { | ||
callSequence = []; | ||
origChange = $.mobile.pagecontainer.prototype.change; | ||
$.mobile.pagecontainer.prototype.change = function( url, options ) { | ||
callSequence.push({ | ||
transition: options.transition, | ||
reverse: !!( options.reverse ) | ||
}); | ||
return origChange.apply( this, arguments ); | ||
}; | ||
}, | ||
teardown: function() { | ||
$.mobile.pagecontainer.prototype.change = origChange; | ||
} | ||
}); | ||
|
||
asyncTest( "Pagecontainer chooses correct transition", function() { | ||
debugger; | ||
|
||
var pageContainer = $( ":mobile-pagecontainer" ); | ||
|
||
$.testHelper.pageSequence([ | ||
function() { | ||
$( "#go-to-b" ).click(); | ||
}, | ||
function() { | ||
$( "#go-to-c" ).click(); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "back" ); | ||
}, | ||
function() { | ||
pageContainer.pagecontainer( "back" ); | ||
}, | ||
function() { | ||
deepEqual( callSequence, | ||
[ | ||
{ transition: "flip", reverse: false }, | ||
{ transition: "slide", reverse: false }, | ||
{ transition: "slide", reverse: true }, | ||
{ transition: "flip", reverse: true } | ||
], | ||
"call sequence has resulted in the correct transitions" ); | ||
|
||
start(); | ||
} | ||
]); | ||
}); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters