You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the code review with @daniell I'm trying to understand the meaning of these tests. The assertioncount isn't counting assertions, its just counting the elements of the generated list of elements that satisfy some conditions.
it("Blank element if max size not yet reached",function(){varlistView=newMyListView({maxLength: 4,collection: newBB.Collection(models)});listView.render();varassertionCount=0;listView.$el.children("div").each(function(i,el){varcontents=$(el).html();if(contents==="empty"){expect(true).toBe(true);assertionCount++;}elseif(contents===""){expect(false).toBe(true);}else{expect(_.contains(ids,contents,"ID rendered is from list")).toBe(true);assertionCount++;}});expect(assertionCount).toEqual(4);})});
What we'er doing here is looking at the output of a rendered list view with the model ["1", "2", "3"]. This should contain four divs containing "1", "2", "3", and "empty" -- because that' show the blank element gets rendered. And none of those divs should be properly empty (none of them have content = ""). I think we can do much better.
I'm thinking instead of .each() we could use .map() to project a list of the contents of the list of divs, and then make some simpler assertions about those:
there should be four elements: "1", "3", "3", "empty", and no empty elements.
After the code review with @daniell I'm trying to understand the meaning of these tests. The assertioncount isn't counting assertions, its just counting the elements of the generated list of elements that satisfy some conditions.
If we look at the setup:
... then clauses like this make a bit more sense:
What we'er doing here is looking at the output of a rendered list view with the model ["1", "2", "3"]. This should contain four divs containing "1", "2", "3", and "empty" -- because that' show the blank element gets rendered. And none of those divs should be properly empty (none of them have content = ""). I think we can do much better.
I'm thinking instead of
.each()
we could use.map()
to project a list of the contents of the list of divs, and then make some simpler assertions about those:something like this??...
The text was updated successfully, but these errors were encountered: