This commit is contained in:
Ghislain Seguin 2011-12-21 16:41:43 -08:00
parent 3f05a5e12c
commit c58022c8ff
2 changed files with 42 additions and 24 deletions

View file

@ -6,16 +6,22 @@
<title>jQuery Mobile Support Test Suite</title>
<script src="../../../js/jquery.js"></script>
<script src="../../../tests/jquery.testHelper.js"></script>
<script src="../../../js/jquery.ui.widget.js"></script>
<script src="../../../js/jquery.mobile.widget.js"></script>
<script src="../../../js/jquery.mobile.media.js"></script>
<script src="../../../js/jquery.mobile.support.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css"/>
<script src="../../../external/qunit.js"></script>
<script src="../../../tests/jquery.testHelper.js"></script>
<script src="../../../external/require.js"></script>
<script>
$.testHelper.asyncLoad([
[
"jquery.mobile.support"
],
[
"support_core.js"
]
]);
</script>
<script src="support_core.js"></script>
<link rel="stylesheet" href="../../../css/themes/default/"/>
<link rel="stylesheet" href="../../../external/qunit.css"/>
<script src="../swarminject.js"></script>
</head>

View file

@ -4,7 +4,8 @@
$.testHelper.excludeFileProtocol(function(){
var prependToFn = $.fn.prependTo,
libName = "jquery.mobile.support.js";
libName = "jquery.mobile.support.js",
cnt = 0;
module(libName, {
teardown: function(){
@ -15,7 +16,7 @@ $.testHelper.excludeFileProtocol(function(){
// NOTE following two tests have debatable value as they only
// prevent property name changes and improper attribute checks
test( "detects functionality from basic affirmative properties and attributes", function(){
asyncTest( "detects functionality from basic affirmative properties and attributes", function(){
// TODO expose properties for less brittle tests
$.extend(window, {
WebKitTransitionEvent: true,
@ -30,23 +31,30 @@ $.testHelper.excludeFileProtocol(function(){
$.mobile.media = function(){ return true; };
$.testHelper.reloadLib(libName);
require( {context: "test"+(++cnt), baseUrl: "../../../js"} )(["jquery.mobile.support"],
function() {
ok($.support.orientation);
ok($.support.touch);
ok($.support.cssTransitions);
ok($.support.pushState);
ok($.support.mediaquery);
start();
}
);
ok($.support.orientation);
ok($.support.touch);
ok($.support.cssTransitions);
ok($.support.pushState);
ok($.support.mediaquery);
});
test( "detects functionality from basic negative properties and attributes (where possible)", function(){
asyncTest( "detects functionality from basic negative properties and attributes (where possible)", function(){
delete window["orientation"];
delete document["ontouchend"];
$.testHelper.reloadLib(libName);
ok(!$.support.orientation);
ok(!$.support.touch);
require( {context: "test"+(++cnt), baseUrl: "../../../js"} )(["jquery.mobile.support"],
function() {
ok(!$.support.orientation);
ok(!$.support.touch);
start();
}
);
});
// NOTE mocks prependTo to simulate base href updates or lack thereof
@ -67,10 +75,14 @@ $.testHelper.excludeFileProtocol(function(){
ok($.support.dynamicBaseTag);
});
test( "detects no dynamic base tag when new base element added and base href unchanged", function(){
asyncTest( "detects no dynamic base tag when new base element added and base href unchanged", function(){
mockBaseCheck('testurl');
$.testHelper.reloadLib(libName);
ok(!$.support.dynamicBaseTag);
require( {context: "test"+(++cnt), baseUrl: "../../../js"} )(["jquery.mobile.support"],
function() {
ok(!$.support.dynamicBaseTag);
start();
}
);
});
test( "jQM's IE browser check properly detects IE versions", function(){