handling no existingUrl scenario
This commit is contained in:
parent
3d416f38e1
commit
6b4f5c4cf7
@ -80,6 +80,13 @@ describe('Util', function() {
|
||||
|
||||
expect(L.Util.getParamString(b.obj,b.url)).toEqual(b.result);
|
||||
|
||||
var c = {
|
||||
url: undefined,
|
||||
obj: {bar: 7, baz: 3},
|
||||
result: "?bar=7&baz=3"
|
||||
};
|
||||
|
||||
expect(L.Util.getParamString(c.obj,c.url)).toEqual(c.result);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -84,7 +84,7 @@ L.Util = {
|
||||
params.push(i + '=' + obj[i]);
|
||||
}
|
||||
}
|
||||
return (existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');
|
||||
return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');
|
||||
},
|
||||
|
||||
template: function (str, data) {
|
||||
|
Loading…
Reference in New Issue
Block a user