From 9e30baad3feafc82fb2f2011fd3f21909f4ba29e Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 16 Feb 2011 19:48:21 -0500 Subject: 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 --- test/AngularSpec.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/AngularSpec.js') 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(); -- cgit v1.2.3