LearnBoost / tobi

Tobi: Expressive server-side functional testing with jQuery
409 stars 33 forks source link

jQuery(".selector").click Throws Exception if Collection Empty #53

Open mhemesath opened 13 years ago

mhemesath commented 13 years ago

If no nodes exist that match .foo then

browser.jQuery(".foo").click(func);

will result in an exception, because https://github.com/LearnBoost/tobi/blob/master/lib/jquery/index.js#L89 is expecting a node to exist.

The nodeName should default to an empty String and only set the nodeName if a node exists in the jQuery object. That way the switch statement will break and continue to line 116 where a more useful error message will be thrown.

Not a huge issue, but one I ran into a little bit while writing tests.

I'll try to get to this sometime this week.