aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBenjamín Eidelman2012-08-20 19:47:26 -0300
committerMisko Hevery2012-09-06 15:49:49 -0700
commit125573602f420a4f3c94cba762f03bff1b936f0c (patch)
tree9b61e37488542524e03251d80c1db2cd91c4af54 /test
parented5dfbcd66cd72372843cb4f6f5957a7a9e7da79 (diff)
downloadangular.js-125573602f420a4f3c94cba762f03bff1b936f0c.tar.bz2
fix($resource): allow falsy values in URL parameters
Close #1212 when a param value was 0 (or false) it was ignored and removed from url. after this fix that only happens if the value is undefined or null.
Diffstat (limited to 'test')
-rw-r--r--test/ngResource/resourceSpec.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js
index 37a8d568..dc837f80 100644
--- a/test/ngResource/resourceSpec.js
+++ b/test/ngResource/resourceSpec.js
@@ -51,14 +51,22 @@ describe("resource", function() {
it('should ignore slashes of undefinend parameters', function() {
var R = $resource('/Path/:a/:b/:c');
- $httpBackend.when('GET').respond('{}');
- $httpBackend.expect('GET', '/Path');
- $httpBackend.expect('GET', '/Path/1');
- $httpBackend.expect('GET', '/Path/2/3');
- $httpBackend.expect('GET', '/Path/4/5');
- $httpBackend.expect('GET', '/Path/6/7/8');
+ $httpBackend.when('GET', '/Path').respond('{}');
+ $httpBackend.when('GET', '/Path/0').respond('{}');
+ $httpBackend.when('GET', '/Path/false').respond('{}');
+ $httpBackend.when('GET', '/Path').respond('{}');
+ $httpBackend.when('GET', '/Path/').respond('{}');
+ $httpBackend.when('GET', '/Path/1').respond('{}');
+ $httpBackend.when('GET', '/Path/2/3').respond('{}');
+ $httpBackend.when('GET', '/Path/4/5').respond('{}');
+ $httpBackend.when('GET', '/Path/6/7/8').respond('{}');
R.get({});
+ R.get({a:0});
+ R.get({a:false});
+ R.get({a:null});
+ R.get({a:undefined});
+ R.get({a:''});
R.get({a:1});
R.get({a:2, b:3});
R.get({a:4, c:5});