mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Update tests to work around QUnit 1.9.0 bug in Narwhal/older-Firefox and add platform.js to test/index.html.
Former-commit-id: eed8246c795735558ba9f499b86f08ed3970ccaf
This commit is contained in:
@@ -7,7 +7,14 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||
<script src="../vendor/platform.js/platform.js"></script>
|
||||
<script>
|
||||
// avoid syntax errors for `QUnit.throws` in older Firefoxes
|
||||
document.write(platform.name == 'Firefox' && /^1\b/.test(platform.version)
|
||||
? '<script src="../vendor/qunit/qunit/qunit-1.8.0.js"><\/script>'
|
||||
: '<script src="../vendor/qunit/qunit/qunit.js"><\/script>'
|
||||
);
|
||||
</script>
|
||||
<script src="test-ui.js"></script>
|
||||
<script>
|
||||
// set a bad shim
|
||||
@@ -59,6 +66,17 @@
|
||||
|
||||
require(['test.js']);
|
||||
});
|
||||
|
||||
// set a more readable browser name
|
||||
window.onload = function() {
|
||||
var timeoutId = setInterval(function() {
|
||||
var ua = document.getElementById('qunit-userAgent');
|
||||
if (ua) {
|
||||
ua.innerHTML = platform;
|
||||
clearInterval(timeoutId);
|
||||
}
|
||||
}, 15);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
'<input name="norequire" type="checkbox">No RequireJS</label>';
|
||||
|
||||
var label2 = document.createElement('label');
|
||||
label2.innerHTML =
|
||||
label2.innerHTML = ' ' +
|
||||
'<select name="build">' +
|
||||
'<option value="dev">Developement</option>' +
|
||||
'<option value="prod">Production</option>' +
|
||||
@@ -82,7 +82,7 @@
|
||||
'</select> Build';
|
||||
|
||||
var checkbox = label1.firstChild,
|
||||
dropdown = label2.firstChild;
|
||||
dropdown = label2.getElementsByTagName('select')[0];
|
||||
|
||||
init();
|
||||
});
|
||||
|
||||
10
test/test.js
10
test/test.js
@@ -4,11 +4,17 @@
|
||||
/** Use a single load function */
|
||||
var load = typeof require == 'function' ? require : window.load;
|
||||
|
||||
/** The `platform` object to check */
|
||||
var platform =
|
||||
window.platform ||
|
||||
load('../vendor/platform.js/platform.js') ||
|
||||
window.platform;
|
||||
|
||||
/** The unit testing framework */
|
||||
var QUnit =
|
||||
window.QUnit || (
|
||||
window.setTimeout || (window.addEventListener = window.setTimeout = / /),
|
||||
window.QUnit = load('../vendor/qunit/qunit/qunit.js') || window.QUnit,
|
||||
window.QUnit = load('../vendor/qunit/qunit/qunit' + (platform.name == 'Narwhal' ? '-1.8.0' : '') + '.js') || window.QUnit,
|
||||
load('../vendor/qunit-clib/qunit-clib.js'),
|
||||
(window.addEventListener || 0).test && delete window.addEventListener,
|
||||
window.QUnit
|
||||
@@ -792,7 +798,7 @@
|
||||
});
|
||||
|
||||
test('should raise an error if a template, compiled with errors, is executed', function() {
|
||||
throws(_.template('<% if x %>'));
|
||||
raises(_.template('<% if x %>'));
|
||||
});
|
||||
|
||||
test('should work with complex "interpolate" delimiters', function() {
|
||||
|
||||
1863
vendor/qunit/qunit/qunit-1.8.0.js
vendored
Normal file
1863
vendor/qunit/qunit/qunit-1.8.0.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user