From afb3806326e72cc79e302a279d00be799e4fb624 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 22 Jan 2014 23:04:10 -0800 Subject: [PATCH] Cleanup the perf and test ui files. --- perf/asset/perf-ui.js | 6 +- test/asset/test-ui.js | 129 +++++++++++++++++++++--------------------- 2 files changed, 67 insertions(+), 68 deletions(-) diff --git a/perf/asset/perf-ui.js b/perf/asset/perf-ui.js index ecb5b7ce2..406a2f4d2 100644 --- a/perf/asset/perf-ui.js +++ b/perf/asset/perf-ui.js @@ -87,9 +87,6 @@ otherList = span2.lastChild, toolbar = document.getElementById('perf-toolbar'); - toolbar.appendChild(span2); - toolbar.appendChild(span1); - buildList.selectedIndex = (function() { switch (build) { case 'lodash-compat': return 0; @@ -120,6 +117,9 @@ return -1; }()); + toolbar.appendChild(span2); + toolbar.appendChild(span1); + addListener(buildList, 'change', eventHandler); addListener(otherList, 'change', eventHandler); }); diff --git a/test/asset/test-ui.js b/test/asset/test-ui.js index ab5b03851..807aecde5 100644 --- a/test/asset/test-ui.js +++ b/test/asset/test-ui.js @@ -55,75 +55,74 @@ function init() { var toolbar = document.getElementById('qunit-testrunner-toolbar'); - if (toolbar) { - toolbar.appendChild(span1); - toolbar.appendChild(span2); - - buildList.selectedIndex = (function() { - switch (build) { - case 'lodash-compat': return 1; - case 'lodash-modern-dev': return 2; - case 'lodash-modern': return 3; - case 'lodash-legacy': return 4; - case 'lodash-mobile': return 5; - case 'lodash-underscore': return 6; - case 'lodash-custom-dev': return 7; - case 'lodash-custom': return 8; - case 'lodash-compat-dev': - case null: return 0; - } - return -1; - }()); - - loaderList.selectedIndex = (function() { - switch (loader) { - case 'curl': return 1; - case 'dojo': return 2; - case 'requirejs': return 3; - case 'none': - case null: return 0; - } - return -1; - }()); - - addListener(buildList, 'change', eventHandler); - addListener(loaderList, 'change', eventHandler); - } - else { + if (!toolbar) { setTimeout(init, 15); + return; } + var span1 = document.createElement('span'); + span1.style.cssText = 'float:right'; + span1.innerHTML = + '' + + ''; + + var span2 = document.createElement('span'); + span2.style.cssText = 'float:right'; + span2.innerHTML = + '' + + ''; + + var buildList = span1.lastChild, + loaderList = span2.lastChild; + + buildList.selectedIndex = (function() { + switch (build) { + case 'lodash-compat': return 1; + case 'lodash-modern-dev': return 2; + case 'lodash-modern': return 3; + case 'lodash-legacy': return 4; + case 'lodash-mobile': return 5; + case 'lodash-underscore': return 6; + case 'lodash-custom-dev': return 7; + case 'lodash-custom': return 8; + case 'lodash-compat-dev': + case null: return 0; + } + return -1; + }()); + + loaderList.selectedIndex = (function() { + switch (loader) { + case 'curl': return 1; + case 'dojo': return 2; + case 'requirejs': return 3; + case 'none': + case null: return 0; + } + return -1; + }()); + + toolbar.appendChild(span1); + toolbar.appendChild(span2); + + addListener(buildList, 'change', eventHandler); + addListener(loaderList, 'change', eventHandler); } - var span1 = document.createElement('span'); - span1.style.cssText = 'float:right'; - span1.innerHTML = - '' + - ''; - - var span2 = document.createElement('span'); - span2.style.cssText = 'float:right'; - span2.innerHTML = - '' + - ''; - - var buildList = span1.lastChild, - loaderList = span2.lastChild; - init(); });