From 1950602dcbdfdfde32907458f249a43a3d046e8d Mon Sep 17 00:00:00 2001 From: Ghislain Seguin Date: Wed, 18 Jan 2012 11:10:02 -0800 Subject: [PATCH] Switched to using AMD loader and $.testHelper.reloadModule instead of $.testHelper.reloadLib --- tests/unit/support/index.html | 27 ++++++++++----- tests/unit/support/support_core.js | 55 +++++++++++++++++------------- 2 files changed, 49 insertions(+), 33 deletions(-) diff --git a/tests/unit/support/index.html b/tests/unit/support/index.html index 25061aae..302acc66 100644 --- a/tests/unit/support/index.html +++ b/tests/unit/support/index.html @@ -5,18 +5,27 @@ jQuery Mobile Support Test Suite + - - - - - - - - + + - + + + + + + diff --git a/tests/unit/support/support_core.js b/tests/unit/support/support_core.js index 755d2323..e30f5f66 100644 --- a/tests/unit/support/support_core.js +++ b/tests/unit/support/support_core.js @@ -4,9 +4,9 @@ $.testHelper.excludeFileProtocol(function(){ var prependToFn = $.fn.prependTo, - libName = "jquery.mobile.support.js"; + moduleName = "jquery.mobile.support"; - module(libName, { + module(moduleName, { teardown: function(){ //NOTE undo any mocking $.fn.prependTo = prependToFn; @@ -15,7 +15,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 +30,25 @@ $.testHelper.excludeFileProtocol(function(){ $.mobile.media = function(){ return true; }; - $.testHelper.reloadLib(libName); - - ok($.support.orientation); - ok($.support.touch); - ok($.support.cssTransitions); - ok($.support.pushState); - ok($.support.mediaquery); + $.testHelper.reloadModule( moduleName ).done( function() { + ok($.support.orientation); + ok($.support.touch); + ok($.support.cssTransitions); + ok($.support.pushState); + ok($.support.mediaquery); + start(); + }); }); - 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); + $.testHelper.reloadModule( moduleName ).done( function() { + ok(!$.support.orientation); + ok(!$.support.touch); + start(); + }); }); // NOTE mocks prependTo to simulate base href updates or lack thereof @@ -61,21 +63,24 @@ $.testHelper.excludeFileProtocol(function(){ }; }; - test( "detects dynamic base tag when new base element added and base href updates", function(){ + asyncTest( "detects dynamic base tag when new base element added and base href updates", function(){ mockBaseCheck(location.protocol + '//' + location.host + location.pathname + "ui-dir/"); - $.testHelper.reloadLib(libName); - ok($.support.dynamicBaseTag); + $.testHelper.reloadModule( moduleName ).done( function() { + ok($.support.dynamicBaseTag); + start(); + }); }); - 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); + $.testHelper.reloadModule( moduleName ).done( function() { + ok(!$.support.dynamicBaseTag); + start(); + }); }); - test( "jQM's IE browser check properly detects IE versions", function(){ - $.testHelper.reloadLib(libName); - + asyncTest( "jQM's IE browser check properly detects IE versions", function(){ + $.testHelper.reloadModule( moduleName ).done( function() { //here we're just comparing our version to what the conditional compilation finds var ie = !!$.browser.msie, //get a boolean version = parseInt( $.browser.version, 10), @@ -87,6 +92,8 @@ $.testHelper.excludeFileProtocol(function(){ else{ same(ie, jqmdetectedver, "It's not IE"); } + start(); + }); });