This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(filterFilter): solve issue #10991 with null property value when using objects with filter #11116
Closed
Closed
fix(filterFilter): solve issue #10991 with null property value when using objects with filter #11116
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9613938
fix(filterFilter): test for pull request
ElephantRose 541a948
fix(filterFilter): solve issue #10991 with null property value when u…
ElephantRose 603a9db
removing trailing white space from previous fix
ElephantRose d8c81f8
removing trailing whitespace
ElephantRose 3a7af5c
fix(filterFilter) : issue when expectedVal is null
ElephantRose 817d19d
fix(filterFilter) : test case for "issue when expectedVal is null"
ElephantRose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -428,6 +428,32 @@ describe('Filter: filter', function() { | |
}); | ||
|
||
|
||
it('should not throw an error if property is null when comparing object', function() { | ||
var items = [ | ||
{ office:1, people: {name:'john'}}, | ||
{ office:2, people: {name:'jane'}}, | ||
{ office:3, people: null} | ||
]; | ||
var f = { }; | ||
expect(filter(items, f).length).toBe(3); | ||
|
||
f = { people:null }; | ||
expect(filter(items, f).length).toBe(3); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm...this test shouldn't pass (the length should be 1). But it does pass since version 1.3.6. |
||
|
||
//should throw an error in 1.3.12 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These comments are not necessary (read "should be removed" 😄). |
||
f = { people:{ name:'john' }}; | ||
expect(filter(items, f).length).toBe(1); | ||
|
||
//should throw an error in 1.3.12 | ||
f = { people:{ name:'j' }}; | ||
expect(filter(items, f).length).toBe(2); | ||
|
||
//should throw an error in 1.3.12 | ||
f = { people:{ name: '' }}; | ||
expect(filter(items, f).length).toBe(2); | ||
|
||
}); | ||
|
||
describe('should support comparator', function() { | ||
|
||
it('not consider `object === "[object Object]"` in non-strict comparison', function() { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test made me realize that a similar "fix" is necessary for
expectedType
.