diff options
| author | Pete Bacon Darwin | 2013-06-20 13:59:46 +0100 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-06-20 14:32:05 +0100 |
| commit | b9dcb35e9bc64cb2f48f3a349ead66c501cbdc48 (patch) | |
| tree | e45f21f034d6a3df392e178cfc1da1b72f66d133 /test | |
| parent | 25d9f5a804b7a6a61db6e84e594b1b5fe7ea14bf (diff) | |
| download | angular.js-b9dcb35e9bc64cb2f48f3a349ead66c501cbdc48.tar.bz2 | |
fix(Angular.js): don't crash on invalid query parameters
Diffstat (limited to 'test')
| -rw-r--r-- | test/AngularSpec.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js index db7ac785..febc0226 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -310,6 +310,12 @@ describe('angular', function() { expect(parseKeyValue('flag1&key=value&flag2')). toEqual({flag1: true, key: 'value', flag2: true}); }); + it('should ignore key values that are not valid URI components', function() { + expect(function() { parseKeyValue('%'); }).not.toThrow(); + expect(parseKeyValue('%')).toEqual({}); + expect(parseKeyValue('invalid=%')).toEqual({ invalid: undefined }); + expect(parseKeyValue('invalid=%&valid=good')).toEqual({ invalid: undefined, valid: 'good' }); + }); }); describe('toKeyValue', function() { |
