altered tests to represent init change and added two for the load message customization Fixes #1178

This commit is contained in:
John Bender 2011-03-03 18:07:26 -08:00
parent 608b39ed39
commit 433384e150
4 changed files with 67 additions and 33 deletions

View file

@ -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);

View file

@ -15,7 +15,7 @@
teardown: function(){
$("#scroll-testing").remove();
}
});
});
var scrollUp = function( pos ){
$(window).scrollTop(1000);

View file

@ -11,11 +11,9 @@
<script type="text/javascript" src="../../../js/"></script>
<!-- added explicitly for library reloading (see testHelper ) -->
<script type="text/javascript" src="../../../js/jquery.mobile.init.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.core.js"></script>
<link rel="stylesheet" href="../../../themes/default" />
<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
<script type="text/javascript" src="core.js"></script>
<script type="text/javascript" src="core_scroll.js"></script>
</head>
<body>

View file

@ -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);