Add tests for Element#descendantOf that deal with dynamically-created elements. [Andrew Dupont]

This commit is contained in:
Andrew Dupont 2008-01-25 22:03:39 +00:00
parent c24a390c49
commit 034d4e1d4a
1 changed files with 8 additions and 1 deletions

View File

@ -1106,7 +1106,14 @@
assert(!$('great-grand-child').descendantOf('not-in-the-family'), 'great-grand-child < not-in-the-family');
assert(!$('child').descendantOf('not-in-the-family'), 'child < not-in-the-family');
assert(!$(document.body).descendantOf('great-grand-child'));
assert(!$(document.body).descendantOf('great-grand-child'));
// dynamically-created elements
$('ancestor').insert(new Element('div', { id: 'weird-uncle' }));
assert($('weird-uncle').descendantOf('ancestor'));
$(document.body).insert(new Element('div', { id: 'impostor' }));
assert(!$('impostor').descendantOf('ancestor'));
}},
testChildOf: function() {with(this) {