mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-27 03:00:35 +00:00
added negative test case for perspective transition and simple case for transitioning class
This commit is contained in:
parent
22d4f4f687
commit
54ea95a3d8
2 changed files with 40 additions and 18 deletions
|
|
@ -33,6 +33,7 @@
|
|||
<script type="text/javascript" src="../../../tests/jquery.testHelper.js"></script>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../themes/default" type="text/css"/>
|
||||
<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
|
||||
<script type="text/javascript" src="../../../external/qunit.js"></script>
|
||||
|
||||
|
|
@ -46,14 +47,22 @@
|
|||
<ol id="qunit-tests">
|
||||
</ol>
|
||||
|
||||
<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
|
||||
<div id="page0" data-role="page">
|
||||
</div>
|
||||
<style>
|
||||
[data-role='page'] {
|
||||
position: absolute; top: -10000px; left: -10000px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="page1" data-url="page1" data-role="page">
|
||||
</div>
|
||||
<div id="foo" data-role="page">
|
||||
<a href="#bar" data-transition="flip"></a>
|
||||
</div>
|
||||
|
||||
<div id="page2" data-url="page2" data-role="page">
|
||||
</div>
|
||||
<div id="bar" data-role="page">
|
||||
<a href="#baz"></a>
|
||||
</div>
|
||||
|
||||
<div id="baz" data-role="page">
|
||||
<a href="foo"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -7,13 +7,7 @@
|
|||
animationCompleteFn = $.fn.animationComplete,
|
||||
|
||||
removeClasses = function(){
|
||||
$("#main").removeClass([perspective, transitioning].join(" "));
|
||||
},
|
||||
|
||||
insertNewTestPage = function(i){
|
||||
var id = "other" + i;
|
||||
$("<div data-role='page' id='" + id + "'></div>").appendTo("#main");
|
||||
return "#" + id;
|
||||
$("body").removeClass([perspective, transitioning].join(" "));
|
||||
};
|
||||
|
||||
module('jquery.mobile.navigation.js', {
|
||||
|
|
@ -26,10 +20,29 @@
|
|||
|
||||
test( "changePage applys perspective class to mobile viewport for flip", function(){
|
||||
//stub to prevent class removal
|
||||
$.mobile.changePage("#page0", "flip", false, false);
|
||||
ok($("#main").
|
||||
hasClass(perspective), "has perspective class");
|
||||
$.fn.animationComplete = function(){};
|
||||
|
||||
$("#foo > a").click();
|
||||
|
||||
ok($("body").hasClass(perspective), "has perspective class");
|
||||
});
|
||||
|
||||
//TODO test negative case and normal class application
|
||||
|
||||
test( "changePage applys perspective class to mobile viewport for flip", function(){
|
||||
//stub to prevent class removal
|
||||
$.fn.animationComplete = function(){};
|
||||
|
||||
$("#bar > a").click();
|
||||
|
||||
ok(!$("body").hasClass(perspective), "has perspective class");
|
||||
});
|
||||
|
||||
test( "changePage applys perspective class to mobile viewport for flip", function(){
|
||||
//stub to prevent class removal
|
||||
$.fn.animationComplete = function(){};
|
||||
|
||||
$("#baz > a").click();
|
||||
|
||||
ok($("body").hasClass(transitioning), "has transitioning class");
|
||||
});
|
||||
})(jQuery);
|
||||
Loading…
Reference in a new issue