diff --git a/build.js b/build.js index 97ed77ce35..e72fd4673d 100755 --- a/build.js +++ b/build.js @@ -810,6 +810,7 @@ // remove IE `shift` and `splice` fix source = source.replace(/(?:\s*\/\/.*)*\n( +)if *\(value.length *=== *0[\s\S]+?\n\1}/, ''); + source = removeVar(source, 'extendIteratorOptions'); source = removeVar(source, 'hasDontEnumBug'); source = removeVar(source, 'iteratorTemplate'); source = removeIsArgumentsFallback(source); diff --git a/test/backbone.html b/test/backbone.html index 0ef73f2fb4..ca3e00dc0a 100644 --- a/test/backbone.html +++ b/test/backbone.html @@ -25,7 +25,10 @@

Test

- + + diff --git a/test/index.html b/test/index.html index 8d660d2d18..2761c90645 100644 --- a/test/index.html +++ b/test/index.html @@ -8,46 +8,57 @@
+ - - - diff --git a/test/test.js b/test/test.js index a857fe88c9..7af1f13b29 100644 --- a/test/test.js +++ b/test/test.js @@ -1,4 +1,5 @@ -(function(window, undefined) { +;(function(window, undefined) { + 'use strict'; /** Use a single load function */ var load = typeof require == 'function' ? require : window.load; @@ -71,7 +72,7 @@ (function() { test('supports loading lodash.js as the "lodash" module', function() { if (window.document && window.require) { - equal((_2 || {}).moduleName, 'lodash'); + equal((lodashModule || {}).moduleName, 'lodash'); } else { skipTest(1) } @@ -79,15 +80,15 @@ test('supports loading lodash.js as the "underscore" module', function() { if (window.document && window.require) { - equal((_3 || {}).moduleName, 'underscore'); + equal((underscoreModule || {}).moduleName, 'underscore'); } else { skipTest(1) } }); test('avoids overwritten native methods', function() { - if (window.lodashBadKeys) { - notDeepEqual(lodashBadKeys.keys({ 'a': 1 }), []); + if (window.document) { + notDeepEqual(lodashBadShim.keys({ 'a': 1 }), []); } else { skipTest(1); } diff --git a/test/ui.js b/test/ui.js new file mode 100644 index 0000000000..a97c77329a --- /dev/null +++ b/test/ui.js @@ -0,0 +1,80 @@ +;(function(window) { + 'use strict'; + + /** `QUnit.addEvent` shortcut */ + var addEvent = QUnit.addEvent; + + /** The Lo-Dash build to load */ + var build = (/build=([^&]+)/.exec(location.search) || [])[1]; + + /** A flag to determine if RequireJS should be loaded */ + var norequire = /[?&]norequire=true(?:&|$)/.test(location.search); + + /*--------------------------------------------------------------------------*/ + + // assign `QUnit.config` properties + QUnit.config.lodashFilename = build == 'prod' + ? 'lodash.min' + : (build == 'custom' ? 'lodash.custom.min' : 'lodash'); + + // assign `QUnit.urlParams` properties + QUnit.extend(QUnit.urlParams, { + 'build': build, + 'norequire': norequire + }); + + // initialize the build dropdown + addEvent(window, 'load', function() { + function eventHandler(event) { + var search = location.search.replace(/^\?|&?(?:build|norequire)=[^&]*&?/g, ''); + if (event.stopPropagation) { + event.stopPropagation(); + } else { + event.cancelBubble = true; + } + location.href = + location.href.split('?')[0] + '?' + + (search ? search + '&' : '') + 'build=' + + dropdown[dropdown.selectedIndex].value + + (checkbox.checked ? '&norequire=true' : ''); + } + + function init() { + var header = document.getElementById('qunit-header'); + if (header) { + header.appendChild(label1); + header.appendChild(label2); + + if (build == 'prod') { + dropdown.selectedIndex = 1; + } else if (build == 'custom') { + dropdown.selectedIndex = 2; + } + checkbox.checked = norequire; + addEvent(checkbox, 'click', eventHandler); + addEvent(dropdown, 'change', eventHandler); + } + else { + setTimeout(init, 15); + } + } + + var label1 = document.createElement('label'); + label1.innerHTML = + 'norequire'; + + var label2 = document.createElement('label'); + label2.innerHTML = + 'build'; + + var checkbox = label1.firstChild, + dropdown = label2.firstChild; + + init(); + }); + +}(this)); diff --git a/test/underscore.html b/test/underscore.html index 1ff1d02314..6b62790cf1 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -22,7 +22,10 @@ - + +