diff options
Diffstat (limited to 'test/AngularSpec.js')
| -rw-r--r-- | test/AngularSpec.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 61dc7cfc..9b3357e5 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -55,7 +55,6 @@ describe('angular', function(){ expect(copy(123)).toEqual(123); expect(copy([{key:null}])).toEqual([{key:null}]); }); - }); describe('equals', function(){ @@ -170,7 +169,7 @@ describe('angular', function(){ describe('encodeUriSegment', function() { - it('should correctly encode uri segment and not encode chars defined as pchar set in rfc2396', + it('should correctly encode uri segment and not encode chars defined as pchar set in rfc3986', function() { //don't encode alphanum expect(encodeUriSegment('asdf1234asdf')). @@ -191,6 +190,36 @@ describe('angular', function(){ }); + describe('encodeUriQuery', function() { + it('should correctly encode uri query and not encode chars defined as pchar set in rfc3986', + function() { + //don't encode alphanum + expect(encodeUriQuery('asdf1234asdf')). + toEqual('asdf1234asdf'); + + //don't encode unreserved + expect(encodeUriQuery("-_.!~*'() -_.!~*'()")). + toEqual("-_.!~*'()+-_.!~*'()"); + + //don't encode the rest of pchar + expect(encodeUriQuery(':@$, :@$,')). + toEqual(':@$,+:@$,'); + + //encode '&', ';', '=', '+', and '#' + expect(encodeUriQuery('&;=+# &;=+#')). + toEqual('%26%3B%3D%2B%23+%26%3B%3D%2B%23'); + + //encode ' ' as '+' + expect(encodeUriQuery(' ')). + toEqual('++'); + + //encode ' ' as '%20' when a flag is used + expect(encodeUriQuery(' ', true)). + toEqual('%20%20'); + }); + }); + + describe ('rngScript', function() { it('should match angular.js', function() { expect('angular.js'.match(rngScript)).not.toBeNull(); |
