-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added option to removeempty values; moved functions to service
- Loading branch information
Mark
committed
Apr 30, 2014
1 parent
51378e0
commit 0f9c698
Showing
5 changed files
with
80 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
describe("The url service", function () { | ||
|
||
var $url; | ||
|
||
beforeEach(module('url')); | ||
|
||
beforeEach(inject(["$url", function (providedUrl) { | ||
$url = providedUrl; | ||
}])); | ||
|
||
it("returns an object", function () { | ||
expect($url).toBeObject(); | ||
}); | ||
|
||
var myQuery = { | ||
blah: '1', | ||
tornado: "attack", | ||
something: null, | ||
hello: true, | ||
bye: false, | ||
'chocolate-chips': 'ring-ring', | ||
monkeys: 'dancing dancing', | ||
imNotHere: undefined, | ||
imEmpty: '' | ||
}; | ||
|
||
it("encodes a querystring", function(){ | ||
var result = $url.toKeyValue(myQuery); | ||
expect(result).toBe('blah=1&tornado=attack&something=&hello&bye=false&chocolate-chips=ring-ring&monkeys=dancing%20dancing&imNotHere=&imEmpty='); | ||
}); | ||
|
||
it("encodes a querystring without empty values", function(){ | ||
var result = $url.toKeyValue(myQuery, true); | ||
expect(result).toBe('blah=1&tornado=attack&hello&chocolate-chips=ring-ring&monkeys=dancing%20dancing'); | ||
}); | ||
|
||
}); |