From 54ea95a3d8dbd6a4232b2bfd7e511c248a432646 Mon Sep 17 00:00:00 2001 From: John Bender Date: Tue, 14 Dec 2010 00:03:07 -0800 Subject: [PATCH] added negative test case for perspective transition and simple case for transitioning class --- tests/unit/navigation/index.html | 23 +++++++++++----- tests/unit/navigation/navigation_core.js | 35 ++++++++++++++++-------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/tests/unit/navigation/index.html b/tests/unit/navigation/index.html index f29e5fe6..886bd0d8 100644 --- a/tests/unit/navigation/index.html +++ b/tests/unit/navigation/index.html @@ -33,6 +33,7 @@ + @@ -46,14 +47,22 @@
-
-
-
+ -
-
+
+ +
-
-
+
+ +
+ +
+ +
diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index d0f8552a..0038eb73 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -7,13 +7,7 @@ animationCompleteFn = $.fn.animationComplete, removeClasses = function(){ - $("#main").removeClass([perspective, transitioning].join(" ")); - }, - - insertNewTestPage = function(i){ - var id = "other" + i; - $("
").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); \ No newline at end of file