I am using jQuery 1.4.1 and here is a simple code.
buildCol1: function() {
var col = $('<select />', {className: 'col1' }).append($('<option />'));
return $('<td />').append(col);
},
I am using qunit . In this case the method call is returning a jquery element. Since I am writing a test I should have something like
s = "<td><select class='col1'><option></option></select></td>"
I am not sure how do I get the fully expanded text value from a jquery element. I am sure I can get that by fully treaversing all the children. But I am hoping that there is an easier way to unit test this method.
Update:
After I posted the question I got an idea that on the returned element I can check for class name and for the right count of children. Basically this will be like inspecting the returned td to have right values.