← Back to team overview

launchpad-dev team mailing list archive

Re: Javascript learnings #1: YUI tests

 

>>
>> Yes, simulating mouse clicks. Think of it as black box testing. Often
>> the callbacks are not exposed and accessible to the test harness and you
>> want to see that all the internal wiring of handlers and callbacks is
>> correct and the DOM is properly updated (the output) in response to a
>> user action (the input), albeit short circuiting that aspect of the
>> interaction that occurs outside the component under test.
> 
> You can simulate clicks with Y.Event.simulate.  You need to pass it
> the DOM node and the name of the event you want to simulate.  There's
> a helper to make it more friendly, by accepting CSS selectors and Node
> instances, in the Landscape code base.  You can find the relevant code
> by grepping for 'simulate' in $landscape/canonical/landscape/javascript.
>

Without looking at the exact landscaper source code, this sounds exactly
what we do too. Looks like there's already been a little cross
pollination there :-)





References