aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSergei Z2014-02-14 13:54:41 +0200
committerCaitlin Potter2014-02-15 13:48:52 -0500
commitcceb455fb167571e26341ded6b595dafd4d92bc6 (patch)
tree748e7633638419d2139b59e797b839ce9a50c546 /test
parent3018ff7130a42a87c1a2d84ee532edede6bf1d1d (diff)
downloadangular.js-cceb455fb167571e26341ded6b595dafd4d92bc6.tar.bz2
fix(numberFilter): convert all non-finite/non-numbers/non-numeric strings to the empty string
The previous code for filtering out non-finite numbers was broken, as it would convert `null` to `0`, as well as arrays. This change fixes this by converting null/undefined/NaN/Infinity/any object to the empty string. Closes #6188 Closes #6261
Diffstat (limited to 'test')
-rw-r--r--test/ng/filter/filtersSpec.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ng/filter/filtersSpec.js b/test/ng/filter/filtersSpec.js
index 2d648b65..66e31397 100644
--- a/test/ng/filter/filtersSpec.js
+++ b/test/ng/filter/filtersSpec.js
@@ -128,6 +128,11 @@ describe('filters', function() {
expect(number(1234)).toEqual('1,234');
expect(number(1234.5678)).toEqual('1,234.568');
expect(number(Number.NaN)).toEqual('');
+ expect(number(null)).toEqual('');
+ expect(number({})).toEqual('');
+ expect(number([])).toEqual('');
+ expect(number(+Infinity)).toEqual('');
+ expect(number(-Infinity)).toEqual('');
expect(number("1234.5678")).toEqual('1,234.568');
expect(number(1/0)).toEqual("");
expect(number(1, 2)).toEqual("1.00");