From 034d4e1d4a679c21946522f288e21337c518ce8f Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Fri, 25 Jan 2008 22:03:39 +0000 Subject: [PATCH] Add tests for Element#descendantOf that deal with dynamically-created elements. [Andrew Dupont] --- test/unit/dom.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/unit/dom.html b/test/unit/dom.html index e596cf8..e268a37 100644 --- a/test/unit/dom.html +++ b/test/unit/dom.html @@ -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) {