aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVojta Jina2010-10-16 16:13:53 +0100
committerIgor Minar2010-10-16 22:10:01 -0700
commit732bcd8a368d50995c796373e37be5a4d3b2bc8c (patch)
treee47e8b20493d5735c07f08a367cb78fd82910f36 /test
parentce49c361d71d1c5f8dc5b773298945957dba0175 (diff)
downloadangular.js-732bcd8a368d50995c796373e37be5a4d3b2bc8c.tar.bz2
Add missing tests for toKeyValue() function
Diffstat (limited to 'test')
-rw-r--r--test/AngularSpec.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index 6faed707..64fd8997 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -104,3 +104,14 @@ describe('parseKeyValue', function() {
toEqual({flag1: true, key: 'value', flag2: true});
});
});
+
+describe('toKeyValue', function() {
+ it('should parse key-value pairs into string', function() {
+ expect(toKeyValue({})).toEqual('');
+ expect(toKeyValue({simple: 'pair'})).toEqual('simple=pair');
+ expect(toKeyValue({first: '1', second: '2'})).toEqual('first=1&second=2');
+ expect(toKeyValue({'escaped key': 'escaped value'})).
+ toEqual('escaped%20key=escaped%20value');
+ expect(toKeyValue({emptyKey: ''})).toEqual('emptyKey=');
+ });
+});