removed console log and added test for default transition

This commit is contained in:
John Bender 2010-12-16 19:12:47 -08:00
parent 8e30a3dc8a
commit b8babd1003
3 changed files with 33 additions and 8 deletions

View file

@ -173,6 +173,12 @@
//kill the keyboard
$( window.document.activeElement ).add(':focus').blur();
function defaultTransition(){
if(transition === undefined){
transition = $.mobile.defaultTransition;
}
}
// if the new href is the same as the previous one
if ( back ) {
var pop = urlStack.pop();
@ -181,9 +187,12 @@
if( pop && !transition ){
transition = pop.transition;
}
// ensure a transition has been set where pop is undefined
defaultTransition();
} else {
// if no transition passed set the default
transition = transition || $.mobile.defaultTransition;
// If no transition has been passed
defaultTransition();
// push the url and transition onto the stack
urlStack.push({ url: url, transition: transition });
@ -247,8 +256,6 @@
addContainerClass('ui-mobile-viewport-perspective');
}
console.log(transition);
addContainerClass('ui-mobile-viewport-transitioning');
// animate in / out

View file

@ -12,7 +12,7 @@
<script type="text/javascript" src="../../../js/jquery.mobile.event.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.hashchange.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.core.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.navigation.js"></script>
n <script type="text/javascript" src="../../../js/jquery.mobile.navigation.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.page.js"></script>
<script type="text/javascript" src="../../../js/jquery.ui.position.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.fixHeaderFooter.js"></script>
@ -84,5 +84,9 @@
<div id="pop-trans" data-role="page">
<a href="#no-trans" data-transition="pop"></a>
</div>
<div id="default-trans" data-role="page">
<a href="#no-trans"></a>
</div>
</body>
</html>

View file

@ -4,14 +4,14 @@
// TODO move tests to navigation_transitions.js
var perspective = "ui-mobile-viewport-perspective",
transitioning = "ui-mobile-viewport-transitioning",
animationCompleteFn = $.fn.animationComplete,
animationCompleteFn = $.fn.animationComplete,
removeBodyClasses = function(){
$("body").removeClass([perspective, transitioning].join(" "));
},
removePageTransClasses = function(){
$("[data-role='page']").removeClass("in out fade slide flip reverse");
$("[data-role='page']").removeClass("in out fade slide flip reverse pop");
};
module('jquery.mobile.navigation.js', {
@ -26,7 +26,7 @@ module('jquery.mobile.navigation.js', {
// required cleanup from animation complete mocking
removeBodyClasses();
}
}
});
test( "changePage applys perspective class to mobile viewport for flip", function(){
@ -94,3 +94,17 @@ test( "previous transition used when not set and going back through url stack",
start();
}, 900);
});
test( "default transition is slide", function(){
stop();
setTimeout(function(){
//guarantee that we check only the newest changes
removePageTransClasses();
$("#default-trans > a").click();
ok($("#no-trans").hasClass("slide"), "has slide class");
start();
}, 900);
});