Re: Sample event tests

>Can anyone have or better yet provide any samples of DOM event testing?

Register listeners on every node in sight, do something to the DOM, make
sure the right listeners get called in reasonable order. This is a bit more
complicated because you need a way to say what the expected sequence is,
but it shouldn't be harder than saying, for example, "Normalize should
leave us with these text nodes having this content".

However: Writing these expectations is going to be a Major Pain because the
sequence of events was deliberately left somewhat fuzzy. Some folks
objected to the idea of having a precise sequence of responses to each
document mutation nailed down, and insisted that "as long as the sequence
of events correctly represents the change that was made to the document,
it's good enough." For example, replaceChild may send events saying that
the old child was removed and the new one added... or vice versa.

I wrote some primitive mutation-event exercising code back when I first
started playing with those. It just dumped a trace to standard output and
relied upon having a human sanity-check the results. Not exhaustive by any
means but it was sufficient to get the basic functionality running. It
isn't a _good_ test, but it's a test; if folks want it donated I'm fairly
sure I can get permission.

The Right Way to handle this may be to come up with some sort of abstract
description of event sequences -- with their alternatives -- in XML, and
write a portion of the test compiler that knows how to generate the
corresponding listener...?

______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 14 May 2001 17:16:04 UTC