Add more DOM element tests.

This commit is contained in:
John-David Dalton
2014-04-26 07:29:06 -07:00
parent f1b2d4340d
commit 626dac600a

View File

@@ -1206,7 +1206,7 @@
Klass.prototype = { 'b': 1 };
var nonCloneable = {
'an element': body,
'a DOM element': body,
'a function': Klass
};
@@ -1330,6 +1330,20 @@
var actual = func(regexp);
strictEqual(actual.lastIndex, 3);
});
test('`_.' + methodName + '` should not error on DOM elements', 1, function() {
if (document) {
var element = document.createElement('div');
try {
strictEqual(func(element), element);
} catch(e) {
ok(false);
}
}
else {
skipTest();
}
});
});
}(1, 2, 3));
@@ -4177,7 +4191,7 @@
}
});
test('should return `false` for non elements', 11, function() {
test('should return `false` for non DOM elements', 11, function() {
var expected = _.map(falsey, _.constant(false));
var actual = _.map(falsey, function(value, index) {
@@ -4198,7 +4212,7 @@
deepEqual(actual, expected);
});
test('should work with elements from another realm', 1, function() {
test('should work with DOM elements from another realm', 1, function() {
if (_._element) {
strictEqual(_.isElement(_._element), true);
}
@@ -4800,6 +4814,22 @@
skipTest();
}
});
test('should not error on DOM elements', 1, function() {
if (document) {
var element1 = document.createElement('div'),
element2 = element1.cloneNode(true);
try {
strictEqual(_.isEqual(element1, element2), false);
} catch(e) {
ok(false);
}
}
else {
skipTest();
}
});
}());
/*--------------------------------------------------------------------------*/