mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-28 18:04:46 +00:00
added file protocol helper
This commit is contained in:
parent
8725b2dcc5
commit
4bec9b1ae2
3 changed files with 22 additions and 9 deletions
19
tests/jquery.testHelper.js
Normal file
19
tests/jquery.testHelper.js
Normal 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);
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
Loading…
Reference in a new issue