From 4680283ce728dddc0d6ffe6bf88fc31eac6880d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 8 Mar 2011 00:58:47 +0000 Subject: [PATCH] Simply use document.write() for script loading, as load.js seems not ready for primetime yet (it magically half-broke QUnit on Safari). --- examples/Animated/RadialRainbows.html | 1 - examples/Animated/Raster.html | 1 - examples/Animated/RotationRaster.html | 1 - examples/Animated/RoundedRectangles.html | 1 - examples/Animated/animatedStar.html | 1 - examples/Scripts/BouncingBalls.html | 1 - examples/Scripts/arcTo.html | 1 - examples/Scripts/circle.html | 1 - examples/Scripts/letter.html | 1 - examples/Scripts/lines.html | 1 - examples/Scripts/rectangle.html | 1 - examples/Scripts/roundRectangle.html | 1 - examples/Scripts/roundSymbol.html | 1 - examples/Scripts/star.html | 1 - examples/Scripts/strokeBounds.html | 1 - examples/Scripts/strokeJoin.html | 1 - examples/Tools/BezierTool.html | 1 - examples/Tools/Circles.html | 1 - examples/Tools/Clouds.html | 1 - examples/Tools/Dripping Brush.html | 1 - examples/Tools/Fancy Brush.html | 1 - examples/Tools/Grid.html | 1 - examples/Tools/MultiLines.html | 1 - examples/Tools/Wave.html | 1 - examples/Tools/Worm Farm.html | 1 - lib/load.js | 2 - src/load.js | 189 +++++++++-------------- test/index.html | 7 +- test/lib/qunit/qunit.js | 132 ++++++++-------- 29 files changed, 135 insertions(+), 220 deletions(-) delete mode 100644 lib/load.js diff --git a/examples/Animated/RadialRainbows.html b/examples/Animated/RadialRainbows.html index afe7aa24..4e0840b7 100644 --- a/examples/Animated/RadialRainbows.html +++ b/examples/Animated/RadialRainbows.html @@ -4,7 +4,6 @@ Example - - - - - - - - - - - - - - - - - - - - - - - - - '); } - - - -// At the end of loading, run PaperScript and QUnit if required -loader.thenRun( - function() { - if (loaded) { - PaperScript.load(); - if (loadTests) { - QUnit.load(); - } - } - } -); diff --git a/test/index.html b/test/index.html index 70c33a81..57d942fd 100644 --- a/test/index.html +++ b/test/index.html @@ -3,12 +3,7 @@ Paper.js Tests - - - + diff --git a/test/lib/qunit/qunit.js b/test/lib/qunit/qunit.js index 19cd5335..894e29b6 100644 --- a/test/lib/qunit/qunit.js +++ b/test/lib/qunit/qunit.js @@ -611,72 +611,7 @@ extend(QUnit, { message: output }); }, - - load: function() { - QUnit.begin({}); - - // Initialize the config, saving the execution queue - var oldconfig = extend({}, config); - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - var userAgent = id("qunit-userAgent"); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - var banner = id("qunit-header"); - if ( banner ) { - var paramsIndex = location.href.lastIndexOf(location.search); - if ( paramsIndex > -1 ) { - var mainPageLocation = location.href.slice(0, paramsIndex); - if ( mainPageLocation == location.href ) { - banner.innerHTML = ' ' + banner.innerHTML + ' '; - } else { - var testName = decodeURIComponent(location.search.slice(1)); - banner.innerHTML = '' + banner.innerHTML + '' + testName + ''; - } - } - } - - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - var filter = document.createElement("input"); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - addEvent( filter, "click", function() { - var li = document.getElementsByTagName("li"); - for ( var i = 0; i < li.length; i++ ) { - if ( li[i].className.indexOf("pass") > -1 ) { - li[i].style.display = filter.checked ? "none" : ""; - } - } - if ( defined.sessionStorage ) { - sessionStorage.setItem("qunit-filter-passed-tests", filter.checked ? "true" : ""); - } - }); - if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { - filter.checked = true; - } - toolbar.appendChild( filter ); - - var label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-pass"); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - } - - var main = id('main') || id('qunit-fixture'); - if ( main ) { - config.fixture = main.innerHTML; - } - - if (config.autostart) { - QUnit.start(); - } - }, - + // Logging callbacks; all receive a single argument with the listed properties // run test/logs.html for any related changes begin: function() {}, @@ -698,7 +633,70 @@ if ( typeof document === "undefined" || document.readyState === "complete" ) { config.autorun = true; } -addEvent(window, "load", QUnit.load); +addEvent(window, "load", function() { + QUnit.begin({}); + + // Initialize the config, saving the execution queue + var oldconfig = extend({}, config); + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + var userAgent = id("qunit-userAgent"); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + var banner = id("qunit-header"); + if ( banner ) { + var paramsIndex = location.href.lastIndexOf(location.search); + if ( paramsIndex > -1 ) { + var mainPageLocation = location.href.slice(0, paramsIndex); + if ( mainPageLocation == location.href ) { + banner.innerHTML = ' ' + banner.innerHTML + ' '; + } else { + var testName = decodeURIComponent(location.search.slice(1)); + banner.innerHTML = '' + banner.innerHTML + '' + testName + ''; + } + } + } + + var toolbar = id("qunit-testrunner-toolbar"); + if ( toolbar ) { + var filter = document.createElement("input"); + filter.type = "checkbox"; + filter.id = "qunit-filter-pass"; + addEvent( filter, "click", function() { + var li = document.getElementsByTagName("li"); + for ( var i = 0; i < li.length; i++ ) { + if ( li[i].className.indexOf("pass") > -1 ) { + li[i].style.display = filter.checked ? "none" : ""; + } + } + if ( defined.sessionStorage ) { + sessionStorage.setItem("qunit-filter-passed-tests", filter.checked ? "true" : ""); + } + }); + if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { + filter.checked = true; + } + toolbar.appendChild( filter ); + + var label = document.createElement("label"); + label.setAttribute("for", "qunit-filter-pass"); + label.innerHTML = "Hide passed tests"; + toolbar.appendChild( label ); + } + + var main = id('main') || id('qunit-fixture'); + if ( main ) { + config.fixture = main.innerHTML; + } + + if (config.autostart) { + QUnit.start(); + } +}); function done() { config.autorun = true;