jquery-mobile/tests/unit/core/core.js

56 lines
1.4 KiB
JavaScript
Raw Normal View History

2010-11-23 03:16:37 +00:00
/*
* mobile core unit tests
*/
(function($){
var libName = "jquery.mobile.core.js",
setGradeA = function(value) { $.support.mediaquery = value; },
extendFn = $.extend;
module(libName, {
2011-02-14 06:37:23 +00:00
teardown: function(){
$.extend = extendFn;
// NOTE reset for pageLoading tests
$('.ui-loader').remove();
}
2010-11-23 03:35:20 +00:00
});
2010-11-23 03:16:37 +00:00
$.testHelper.excludeFileProtocol(function(){
test( "grade A browser support media queries", function(){
setGradeA(false);
$.testHelper.reloadLib(libName);
ok(!$.mobile.gradeA());
2010-11-23 03:16:37 +00:00
setGradeA(true);
$.testHelper.reloadLib(libName);
ok($.mobile.gradeA());
2010-11-23 03:16:37 +00:00
});
//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);
});
2010-11-23 08:45:43 +00:00
test( "pageLoading doesn't add the dialog to the page when done is passed as true", function(){
$.testHelper.alterExtend({loadingMessage: true});
$.testHelper.reloadLib(libName);
2010-11-23 08:45:43 +00:00
// TODO add post reload callback
$('.ui-loader').remove();
2010-11-24 01:56:28 +00:00
$.mobile.pageLoading(true);
ok(!$(".ui-loader").length);
});
2010-11-24 01:56:28 +00:00
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);