diff options
| author | Igor Minar | 2011-02-16 19:48:21 -0500 |
|---|---|---|
| committer | Igor Minar | 2011-02-17 23:06:53 -0800 |
| commit | 9e30baad3feafc82fb2f2011fd3f21909f4ba29e (patch) | |
| tree | 98bceb6601422c859b1f7cf326fdb77385593808 /test/AngularSpec.js | |
| parent | a070ff5ad08450a1eb6375790fc90693d624e283 (diff) | |
| download | angular.js-9e30baad3feafc82fb2f2011fd3f21909f4ba29e.tar.bz2 | |
resources should not over-encode chars in url path
- added encodeUriSegment that properly encodes only those chars
that URI RFC requires us to encode
- modified Resource to use encodeUriSegment
Diffstat (limited to 'test/AngularSpec.js')
| -rw-r--r-- | test/AngularSpec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 8753d887..5b7e33fd 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -139,6 +139,28 @@ describe('angular', function(){ }); + describe('encodeUriSegment', function() { + it('should correctly encode uri segment and not encode chars defined as pchar set in rfc2396', + function() { + //don't encode alphanum + expect(encodeUriSegment('asdf1234asdf')). + toEqual('asdf1234asdf'); + + //don't encode unreserved' + expect(encodeUriSegment("-_.!~*'() -_.!~*'()")). + toEqual("-_.!~*'()%20-_.!~*'()"); + + //don't encode the rest of pchar' + expect(encodeUriSegment(':@&=+$, :@&=+$,')). + toEqual(':@&=+$,%20:@&=+$,'); + + //encode '/', ';' and ' '' + expect(encodeUriSegment('/; /;')). + toEqual('%2F%3B%20%2F%3B'); + }); + }); + + describe ('rngScript', function() { it('should match angular.js', function() { expect('angular.js'.match(rngScript)).not.toBeNull(); |
