diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 05034a5e..7848f8b1 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -10,9 +10,6 @@ module(libName, { teardown: function(){ $.extend = extendFn; - - // NOTE reset for pageLoading tests - $('.ui-loader').remove(); } }); @@ -26,31 +23,5 @@ $.testHelper.reloadLib(libName); ok($.mobile.gradeA()); }); - - //TODO lots of duplication - test( "pageLoading doesn't add the dialog to the page when loading message is false", function(){ - $.testHelper.alterExtend({loadingMessage: false}); - $.testHelper.reloadLib(libName); - $.mobile.pageLoading(false); - ok(!$(".ui-loader").length); - }); - - test( "pageLoading doesn't add the dialog to the page when done is passed as true", function(){ - $.testHelper.alterExtend({loadingMessage: true}); - $.testHelper.reloadLib(libName); - - // TODO add post reload callback - $('.ui-loader').remove(); - - $.mobile.pageLoading(true); - ok(!$(".ui-loader").length); - }); - - test( "pageLoading adds the dialog to the page when done is true", function(){ - $.testHelper.alterExtend({loadingMessage: true}); - $.testHelper.reloadLib(libName); - $.mobile.pageLoading(false); - ok($(".ui-loader").length); - }); }); })(jQuery); \ No newline at end of file diff --git a/tests/unit/core/core_scroll.js b/tests/unit/core/core_scroll.js index 8724684e..79f29972 100644 --- a/tests/unit/core/core_scroll.js +++ b/tests/unit/core/core_scroll.js @@ -15,7 +15,7 @@ teardown: function(){ $("#scroll-testing").remove(); } - }); + }); var scrollUp = function( pos ){ $(window).scrollTop(1000); diff --git a/tests/unit/init/index.html b/tests/unit/init/index.html index eab3e057..3cdf94f7 100644 --- a/tests/unit/init/index.html +++ b/tests/unit/init/index.html @@ -11,11 +11,9 @@ + - - - diff --git a/tests/unit/init/init_core.js b/tests/unit/init/init_core.js index e7bfd09f..118bcd6f 100644 --- a/tests/unit/init/init_core.js +++ b/tests/unit/init/init_core.js @@ -11,9 +11,15 @@ setup: function(){ // NOTE reset for gradeA tests $('html').removeClass('ui-mobile'); + + // TODO add post reload callback + $('.ui-loader').remove(); }, teardown: function(){ $.extend = extendFn; + + // NOTE reset for pageLoading tests + $('.ui-loader').remove(); } }); @@ -128,5 +134,64 @@ test( "pages with a data-url attribute are left with the original value", function(){ same($("#bar").data('url'), "bak"); }); + + //TODO lots of duplication + asyncTest( "pageLoading doesn't add the dialog to the page when loading message is false", function(){ + $.testHelper.alterExtend({loadingMessage: false}); + $.testHelper.reloadLib(libName); + $.mobile.pageLoading(false); + + setTimeout(function(){ + ok(!$(".ui-loader").length); + start(); + }, 500); + }); + + asyncTest( "pageLoading doesn't add the dialog to the page when done is passed as true", function(){ + $.testHelper.alterExtend({loadingMessage: true}); + $.testHelper.reloadLib(libName); + $.mobile.pageLoading(true); + + setTimeout(function(){ + ok(!$(".ui-loader").length); + start(); + }, 500); + }); + + asyncTest( "pageLoading adds the dialog to the page when done is true", function(){ + $.testHelper.alterExtend({loadingMessage: true}); + $.testHelper.reloadLib(libName); + $.mobile.pageLoading(false); + + setTimeout(function(){ + ok($(".ui-loader").length); + start(); + }, 500); + }); + + asyncTest( "page loading should contain default loading message", function(){ + $.testHelper.reloadLib('jquery.mobile.core.js'); + $.testHelper.reloadLib(libName); + $.mobile.pageLoading(false); + + setTimeout(function(){ + same($(".ui-loader h1").text(), "loading"); + start(); + }, 500); + }); + + asyncTest( "page loading should contain custom loading message", function(){ + $(document).bind('mobileinit', function(){ + $.mobile.loadingMessage = "foo"; + }); + + $.testHelper.reloadLib(libName); + $.mobile.pageLoading(false); + + setTimeout(function(){ + same($(".ui-loader h1").text(), "foo"); + start(); + }, 500); + }); }); })(jQuery);