Merge pull request #1493 from ether/feature/fixtests

Fixes for the testrunner
This commit is contained in:
John McLear 2013-02-10 14:06:02 -08:00
commit 9c4a2ef819
3 changed files with 42 additions and 35 deletions

View File

@ -2,10 +2,11 @@
Copied from jQuery 1.8, the last jquery version with browser recognition support Copied from jQuery 1.8, the last jquery version with browser recognition support
*/ */
// Use of jQuery.browser is frowned upon. (function(){
// More details: http://api.jquery.com/jQuery.browser // Use of jQuery.browser is frowned upon.
// jQuery.uaMatch maintained for back-compat // More details: http://api.jquery.com/jQuery.browser
var uaMatch = function( ua ) { // jQuery.uaMatch maintained for back-compat
var uaMatch = function( ua ) {
ua = ua.toLowerCase(); ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
@ -19,26 +20,31 @@ var uaMatch = function( ua ) {
browser: match[ 1 ] || "", browser: match[ 1 ] || "",
version: match[ 2 ] || "0" version: match[ 2 ] || "0"
}; };
}; };
var userAgent = navigator.userAgent; var userAgent = navigator.userAgent;
var matched = uaMatch(userAgent); var matched = uaMatch(userAgent);
var browser = {}; var browser = {};
if ( matched.browser ) { if ( matched.browser ) {
browser[ matched.browser ] = true; browser[ matched.browser ] = true;
browser.version = matched.version; browser.version = matched.version;
} }
// Chrome is Webkit, but Webkit is also Safari. // Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) { if ( browser.chrome ) {
browser.webkit = true; browser.webkit = true;
} else if ( browser.webkit ) { } else if ( browser.webkit ) {
browser.safari = true; browser.safari = true;
} }
//custom extensions, the original jquery didn't have these //custom extensions, the original jquery didn't have these
browser.windows = /windows/.test(userAgent); browser.windows = /windows/.test(userAgent);
browser.mobile = /mobile/.test(userAgent) || /android/.test(userAgent); browser.mobile = /mobile/.test(userAgent) || /android/.test(userAgent);
exports.browser = browser; if(typeof exports !== 'undefined'){
exports.browser = browser;
} else{
$.browser = browser;
}
})();

View File

@ -85,8 +85,8 @@ var helper = {};
return !$iframe.contents().find("#editorloadingbox").is(":visible"); return !$iframe.contents().find("#editorloadingbox").is(":visible");
}, 50000).done(function(){ }, 50000).done(function(){
helper.padChrome$ = getFrameJQuery( $('#iframe-container iframe')); helper.padChrome$ = getFrameJQuery( $('#iframe-container iframe'));
helper.padOuter$ = getFrameJQuery(helper.padChrome$('iframe.[name="ace_outer"]')); helper.padOuter$ = getFrameJQuery(helper.padChrome$('iframe[name="ace_outer"]'));
helper.padInner$ = getFrameJQuery( helper.padOuter$('iframe.[name="ace_inner"]')); helper.padInner$ = getFrameJQuery( helper.padOuter$('iframe[name="ace_inner"]'));
//disable all animations, this makes tests faster and easier //disable all animations, this makes tests faster and easier
helper.padChrome$.fx.off = true; helper.padChrome$.fx.off = true;

View File

@ -10,6 +10,7 @@
<div id="iframe-container"></div> <div id="iframe-container"></div>
<script src="/static/js/jquery.js"></script> <script src="/static/js/jquery.js"></script>
<script src="/static/js/jquery_browser.js"></script>
<script src="lib/underscore.js"></script> <script src="lib/underscore.js"></script>
<script src="lib/mocha.js"></script> <script src="lib/mocha.js"></script>