test-ui.js (lodash-4.0.0) | : | test-ui.js (lodash-4.17.21) | ||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURICompon ent(build[1]); | var build = (build = /build=([^&]+)/.exec(location.search)) && decodeURICompon ent(build[1]); | |||
/** The module loader to use. */ | /** The module loader to use. */ | |||
var loader = (loader = /loader=([^&]+)/.exec(location.search)) && decodeURICom ponent(loader[1]); | var loader = (loader = /loader=([^&]+)/.exec(location.search)) && decodeURICom ponent(loader[1]); | |||
/** The `ui` object. */ | /** The `ui` object. */ | |||
var ui = {}; | var ui = {}; | |||
/*--------------------------------------------------------------------------*/ | /*--------------------------------------------------------------------------*/ | |||
/** | ||||
* Registers an event listener on an element. | ||||
* | ||||
* @private | ||||
* @param {Element} element The element. | ||||
* @param {string} eventName The name of the event. | ||||
* @param {Function} handler The event handler. | ||||
* @returns {Element} The element. | ||||
*/ | ||||
function addListener(element, eventName, handler) { | ||||
if (typeof element.addEventListener != 'undefined') { | ||||
element.addEventListener(eventName, handler, false); | ||||
} else if (typeof element.attachEvent != 'undefined') { | ||||
element.attachEvent('on' + eventName, handler); | ||||
} | ||||
} | ||||
/*--------------------------------------------------------------------------*/ | ||||
// Initialize controls. | // Initialize controls. | |||
addListener(window, 'load', function() { | addEventListener('load', function() { | |||
function eventHandler(event) { | function eventHandler(event) { | |||
var buildIndex = buildList.selectedIndex, | var buildIndex = buildList.selectedIndex, | |||
loaderIndex = loaderList.selectedIndex, | loaderIndex = loaderList.selectedIndex, | |||
search = location.search.replace(/^\?|&?(?:build|loader)=[^&]*&?/g, '' ); | search = location.search.replace(/^\?|&?(?:build|loader)=[^&]*&?/g, '' ); | |||
if (event.stopPropagation) { | if (event.stopPropagation) { | |||
event.stopPropagation(); | event.stopPropagation(); | |||
} else { | } else { | |||
event.cancelBubble = true; | event.cancelBubble = true; | |||
} | } | |||
skipping to change at line 62 | skipping to change at line 43 | |||
'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' + | 'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' + | |||
'loader=' + (loaderIndex < 0 ? loader : loaderList[loaderIndex].value); | 'loader=' + (loaderIndex < 0 ? loader : loaderList[loaderIndex].value); | |||
} | } | |||
function init() { | function init() { | |||
var toolbar = document.getElementById('qunit-testrunner-toolbar'); | var toolbar = document.getElementById('qunit-testrunner-toolbar'); | |||
if (!toolbar) { | if (!toolbar) { | |||
setTimeout(init, 15); | setTimeout(init, 15); | |||
return; | return; | |||
} | } | |||
toolbar.appendChild(span1); | toolbar.insertBefore(span2, toolbar.lastChild); | |||
toolbar.appendChild(span2); | toolbar.insertBefore(span1, span2); | |||
buildList.selectedIndex = (function() { | buildList.selectedIndex = (function() { | |||
switch (build) { | switch (build) { | |||
case 'lodash': return 1; | case 'lodash': return 1; | |||
case 'lodash-core-dev': return 2; | case 'lodash-core-dev': return 2; | |||
case 'lodash-core': return 3; | case 'lodash-core': return 3; | |||
case 'lodash-dev': | case 'lodash-dev': | |||
case null: return 0; | case null: return 0; | |||
} | } | |||
return -1; | return -1; | |||
skipping to change at line 87 | skipping to change at line 68 | |||
switch (loader) { | switch (loader) { | |||
case 'curl': return 1; | case 'curl': return 1; | |||
case 'dojo': return 2; | case 'dojo': return 2; | |||
case 'requirejs': return 3; | case 'requirejs': return 3; | |||
case 'none': | case 'none': | |||
case null: return 0; | case null: return 0; | |||
} | } | |||
return -1; | return -1; | |||
}()); | }()); | |||
addListener(buildList, 'change', eventHandler); | buildList.addEventListener('change', eventHandler); | |||
addListener(loaderList, 'change', eventHandler); | loaderList.addEventListener('change', eventHandler); | |||
} | } | |||
var span1 = document.createElement('span'); | var span1 = document.createElement('span'); | |||
span1.style.cssText = 'float:right'; | ||||
span1.innerHTML = | span1.innerHTML = | |||
'<label for="qunit-build">Build: </label>' + | '<label for="qunit-build">Build: </label>' + | |||
'<select id="qunit-build">' + | '<select id="qunit-build">' + | |||
'<option value="lodash-dev">lodash (development)</option>' + | '<option value="lodash-dev">lodash (development)</option>' + | |||
'<option value="lodash">lodash (production)</option>' + | '<option value="lodash">lodash (production)</option>' + | |||
'<option value="lodash-core-dev">lodash-core (development)</option>' + | '<option value="lodash-core-dev">lodash-core (development)</option>' + | |||
'<option value="lodash-core">lodash-core (production)</option>' + | '<option value="lodash-core">lodash-core (production)</option>' + | |||
'</select>'; | '</select>'; | |||
var span2 = document.createElement('span'); | var span2 = document.createElement('span'); | |||
span2.style.cssText = 'float:right'; | ||||
span2.innerHTML = | span2.innerHTML = | |||
'<label for="qunit-loader">Loader: </label>' + | '<label for="qunit-loader">Loader: </label>' + | |||
'<select id="qunit-loader">' + | '<select id="qunit-loader">' + | |||
'<option value="none">None</option>' + | '<option value="none">None</option>' + | |||
'<option value="curl">Curl</option>' + | '<option value="curl">Curl</option>' + | |||
'<option value="dojo">Dojo</option>' + | '<option value="dojo">Dojo</option>' + | |||
'<option value="requirejs">RequireJS</option>' + | '<option value="requirejs">RequireJS</option>' + | |||
'</select>'; | '</select>'; | |||
span1.style.cssText = | ||||
span2.style.cssText = 'display:inline-block;float:right;line-height:2.1em;ma | ||||
rgin-left:1em;margin-top:0;'; | ||||
span1.firstChild.style.cssText = | ||||
span2.firstChild.style.cssText = 'display:inline-block;margin-right:.5em;'; | ||||
var buildList = span1.lastChild, | var buildList = span1.lastChild, | |||
loaderList = span2.lastChild; | loaderList = span2.lastChild; | |||
setTimeout(function() { | setTimeout(function() { | |||
ui.timing.loadEventEnd = +new Date; | ui.timing.loadEventEnd = +new Date; | |||
}, 1); | }, 1); | |||
init(); | init(); | |||
}); | }); | |||
skipping to change at line 157 | skipping to change at line 142 | |||
return basePath + result; | return basePath + result; | |||
}()); | }()); | |||
// Used to indicate testing a core build. | // Used to indicate testing a core build. | |||
ui.isCore = /\bcore(\.min)?\.js\b/.test(ui.buildPath); | ui.isCore = /\bcore(\.min)?\.js\b/.test(ui.buildPath); | |||
// Used to indicate testing a foreign file. | // Used to indicate testing a foreign file. | |||
ui.isForeign = RegExp('^(\\w+:)?//').test(build); | ui.isForeign = RegExp('^(\\w+:)?//').test(build); | |||
// Used to indicate testing a modularized build. | // Used to indicate testing a modularized build. | |||
ui.isModularize = /\b(?:amd|commonjs|es6?|node|npm|(index|main)\.js)\b/.test([ location.pathname, location.search]); | ui.isModularize = /\b(?:amd|commonjs|es|node|npm|(index|main)\.js)\b/.test([lo cation.pathname, location.search]); | |||
// Used to indicate testing in Sauce Labs' automated test cloud. | // Used to indicate testing in Sauce Labs' automated test cloud. | |||
ui.isSauceLabs = location.port == '9001'; | ui.isSauceLabs = location.port == '9001'; | |||
// Used to indicate that lodash is in strict mode. | // Used to indicate that lodash is in strict mode. | |||
ui.isStrict = /\bes6?\b/.test([location.pathname, location.search]); | ui.isStrict = /\bes\b/.test([location.pathname, location.search]); | |||
ui.urlParams = { 'build': build, 'loader': loader }; | ui.urlParams = { 'build': build, 'loader': loader }; | |||
ui.timing = { 'loadEventEnd': 0 }; | ui.timing = { 'loadEventEnd': 0 }; | |||
window.ui = ui; | window.ui = ui; | |||
}(this)); | }(this)); | |||
End of changes. 9 change blocks. | ||||
28 lines changed or deleted | 14 lines changed or added |