added file protocol helper

This commit is contained in:
John Bender 2010-11-22 23:51:15 +08:00 committed by Scott Jehl
parent 8725b2dcc5
commit 4bec9b1ae2
3 changed files with 22 additions and 9 deletions

View file

@ -0,0 +1,19 @@
/*
* mobile support unit tests
*/
(function( $ ) {
$.testHelper = {
excludeFileProtocol: function(callback){
var message = "Tests require script reload and cannot be run via file: protocol";
//NOTE alert tester that running the file locally will not work for these tests
if ( location.protocol == "file:" ) {
test(message, function(){
ok(false, message);
});
} else {
callback();
}
}
};
})(jQuery);

View file

@ -5,6 +5,7 @@
<title>jQuery Mobile Support Test Suite</title>
<script type="text/javascript" src="../../../js/jquery.js"></script>
<script type="text/javascript" src="../../../tests/jquery.testHelper.js"></script>
<script type="text/javascript" src="../../../js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.widget.js"></script>
<script type="text/javascript" src="../../../js/jquery.mobile.media.js"></script>

View file

@ -3,14 +3,7 @@
*/
(function( $ ) {
//NOTE alert tester that running the file locally will not work for these tests
if ( location.protocol == "file:" ) {
var message = "Tests require script reload and cannot be run via file: protocol";
test(message, function(){
ok(false, message);
});
} else {
$.testHelper.excludeFileProtocol(function(){
var reloadCount = 0,
lib = $("script[src$=support.js]"),
src = lib.attr('src'),
@ -87,5 +80,5 @@
//TODO propExists testing, refactor propExists into mockable method
//TODO scrollTop testing, refactor scrollTop logic into mockable method
}
});
})(jQuery);