Add _.noConflict test.

This commit is contained in:
jdalton
2015-06-24 23:00:57 -07:00
parent 91849e4cd1
commit 6921fb66d5

View File

@@ -11446,13 +11446,31 @@
test('should return the `lodash` function', 1, function() { test('should return the `lodash` function', 1, function() {
if (!isModularize) { if (!isModularize) {
var oldDash = root._; var oldDash = root._;
strictEqual(_.noConflict(), _); strictEqual(_.noConflict(), oldDash);
root._ = oldDash; root._ = oldDash;
} }
else { else {
skipTest(); skipTest();
} }
}); });
test('should work with a `context` of `this`', 2, function() {
if (!isModularize && !document && _._object) {
var fs = require('fs'),
vm = require('vm'),
expected = {},
context = vm.createContext({ '_': expected }),
source = fs.readFileSync(filePath);
vm.runInContext(source + '\nthis.lodash = this._.noConflict()', context);
strictEqual(context._, expected);
ok(!!context.lodash);
}
else {
skipTest(2);
}
});
}()); }());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/