Is there any built in support in jQuery for basic assertion checking, primarily of things like \'expected number of returned elements\'.
For instance I may have a simple
I created a plugin for that: jquery-assert. You could use it like this:
Make sure, one or more elements were found, before calling the next function:
$('#element01').assertFound().val('x')
Assert that 1 element was selected:
$('#element01').assertOne(); // same as assertFound(1)
Make sure a given number of elements were found before calling further functions:
$('.item').assertFound(10).find('p').assertFound(10).data(...)