Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

filter test typos and another test case #7891

Closed
@rolfyone

Description

@rolfyone

There was a test submission earlier regarding filtering on empty text.

While investigating, there were a couple of typos I found, and I added a test case showing the described issue, and how to solve the problem of filtering on an empty string.

I'm not sure how to submit it, whether to push my tested change etc, so I figured I'd raise it as an issue, and if someone wants to push the commit themselves I dont mind... I tried to find things in 'getting started', but couldnt really find any newbie dev guidelines that covered this kind of thing.... no doubt I missed a huge section of doco somewhere...

anyway a diff is

diff --git a/test/ng/filter/filterSpec.js b/test/ng/filter/filterSpec.js
index fecfcf7..8398949 100644
--- a/test/ng/filter/filterSpec.js
+++ b/test/ng/filter/filterSpec.js
@@ -49,7 +49,7 @@ describe('Filter: filter', function() {
     expect(filter(items, function(i) {return i.done;}).length).toBe(1);
   });

-  it('should take object as perdicate', function() {
+  it('should take object as predicate', function() {
     var items = [{first: 'misko', last: 'hevery'},
                  {first: 'adam', last: 'abrons'}];

@@ -61,7 +61,7 @@ describe('Filter: filter', function() {
   });


-  it('should support predicat object with dots in the name', function() {
+  it('should support predicate object with dots in the name', function() {
     var items = [{'first.name': 'misko', 'last.name': 'hevery'},
                  {'first.name': 'adam', 'last.name': 'abrons'}];

@@ -81,6 +81,16 @@ describe('Filter: filter', function() {
     ]);
   });

+  it('should be able to use exact match to match empty strings', function() {
+    var items = [{person: {name: 'John'}},
+                 {person: {name: 'Rita'}},
+                 {person: {name: 'Billy'}},
+                 {person: {name: ''}},
+                 {person: {name: 'Joan'}}];
+    expect(filter(items, {person: {name: ''}}).length).toBe(5);
+    expect(filter(items, {person: {name: ''}}, true).length).toBe(1);
+  });
+

   it('should match any properties for given "$" property', function() {
     var items = [{first: 'tom', last: 'hevery'},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions