-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove BooleanFieldValue (#1290)
- Loading branch information
Showing
14 changed files
with
467 additions
and
439 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ | |
/libpeerconnection.log | ||
npm-debug.log | ||
testem.log | ||
/.chrome |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {coerceBooleanProperty} from './boolean-property'; | ||
|
||
|
||
describe('coerceBooleanProperty', () => { | ||
it('should coerce undefined to false', () => { | ||
expect(coerceBooleanProperty(undefined)).toBe(false); | ||
}); | ||
|
||
it('should coerce null to false', () => { | ||
expect(coerceBooleanProperty(null)).toBe(false); | ||
}); | ||
|
||
it('should coerce the empty string to true', () => { | ||
expect(coerceBooleanProperty('')).toBe(true); | ||
}); | ||
|
||
it('should coerce zero to true', () => { | ||
expect(coerceBooleanProperty(0)).toBe(true); | ||
}); | ||
|
||
it('should coerce the string "false" to false', () => { | ||
expect(coerceBooleanProperty('false')).toBe(false); | ||
}); | ||
|
||
it('should coerce the boolean false to false', () => { | ||
expect(coerceBooleanProperty(false)).toBe(false); | ||
}); | ||
|
||
it('should coerce the boolean true to true', () => { | ||
expect(coerceBooleanProperty(true)).toBe(true); | ||
}); | ||
|
||
it('should coerce the string "true" to true', () => { | ||
expect(coerceBooleanProperty('true')).toBe(true); | ||
}); | ||
|
||
it('should coerce an arbitrary string to true', () => { | ||
expect(coerceBooleanProperty('pink')).toBe(true); | ||
}); | ||
|
||
it('should coerce an object to true', () => { | ||
expect(coerceBooleanProperty({})).toBe(true); | ||
}); | ||
|
||
it('should coerce an array to true', () => { | ||
expect(coerceBooleanProperty([])).toBe(true); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** Coerces a data-bound value (typically a string) to a boolean. */ | ||
export function coerceBooleanProperty(value: any): boolean { | ||
return value != null && `${value}` !== 'false'; | ||
} |
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
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
Oops, something went wrong.