diff options
| author | Michał Gołębiowski | 2013-08-21 11:25:04 +0200 | 
|---|---|---|
| committer | Michał Gołębiowski | 2014-02-26 00:38:37 +0100 | 
| commit | 6b049c74ccc9ee19688bb9bbe504c300e61776dc (patch) | |
| tree | e54c50da99f930823c1550b97a03c065016b713a /test/ng/parseSpec.js | |
| parent | c99dd224a518ac8c976fe9b22587e4dd2eda78c9 (diff) | |
| download | angular.js-6b049c74ccc9ee19688bb9bbe504c300e61776dc.tar.bz2 | |
feat($parse): support trailing commas in object & array literals
Per ECMAScript 5.1 specification trailing commas are allowed in object and
array literals. All modern browsers as well as IE>8 support this syntax.
This commit adds support for such syntax to Angular expressions.
Diffstat (limited to 'test/ng/parseSpec.js')
| -rw-r--r-- | test/ng/parseSpec.js | 5 | 
1 files changed, 5 insertions, 0 deletions
| diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js index 466be755..38fce3f7 100644 --- a/test/ng/parseSpec.js +++ b/test/ng/parseSpec.js @@ -460,6 +460,8 @@ describe('parser', function() {            expect(scope.$eval("[1, 2]").length).toEqual(2);            expect(scope.$eval("[1, 2]")[0]).toEqual(1);            expect(scope.$eval("[1, 2]")[1]).toEqual(2); +          expect(scope.$eval("[1, 2,]")[1]).toEqual(2); +          expect(scope.$eval("[1, 2,]").length).toEqual(2);          });          it('should evaluate array access', function() { @@ -474,6 +476,9 @@ describe('parser', function() {            expect(toJson(scope.$eval("{a:'b'}"))).toEqual('{"a":"b"}');            expect(toJson(scope.$eval("{'a':'b'}"))).toEqual('{"a":"b"}');            expect(toJson(scope.$eval("{\"a\":'b'}"))).toEqual('{"a":"b"}'); +          expect(toJson(scope.$eval("{a:'b',}"))).toEqual('{"a":"b"}'); +          expect(toJson(scope.$eval("{'a':'b',}"))).toEqual('{"a":"b"}'); +          expect(toJson(scope.$eval("{\"a\":'b',}"))).toEqual('{"a":"b"}');          });          it('should evaluate object access', function() { | 
