Skip to content

Commit

Permalink
Test to search when null values are present. Update other tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewheston committed Nov 9, 2011
1 parent 2086aa1 commit 15b5021
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/list.tests.js
Expand Up @@ -80,6 +80,27 @@ test('Search', function() {
theList.search('');
});

test('Search with null values', function() {
var objectWithNulls = {
id: 7
, name: null
, feature: null
};
theList.add(objectWithNulls);
try {
var items = theList.search('Node');
equals(items.length, 2);
items = [
items[0].values(),
items[1].values()
];
deepEqual(items, [ryah, tj]);
}
finally {
theList.search('');
}
});

test('Filter', function() {
var visibleItems = theList.filter(function(values) {
if (+values.id < 3) {
Expand All @@ -95,5 +116,5 @@ test('Filter', function() {

test('Restore from filter', function() {
var visibleItems = theList.filter(false);
equals(visibleItems.length, 5);
equals(visibleItems.length, 6);
});

0 comments on commit 15b5021

Please sign in to comment.