Merge pull request #10637 from owncloud/fixing-js-issues
Init vars with a value if none is provided
This commit is contained in:
commit
ed2424c382
|
@ -234,6 +234,7 @@ var OC={
|
|||
*/
|
||||
generateUrl: function(url, params) {
|
||||
var _build = function (text, vars) {
|
||||
var vars = vars || [];
|
||||
return text.replace(/{([^{}]*)}/g,
|
||||
function (a, b) {
|
||||
var r = vars[b];
|
||||
|
|
|
@ -376,6 +376,9 @@ describe('Core base tests', function() {
|
|||
it('substitutes parameters', function() {
|
||||
expect(OC.generateUrl('apps/files/download{file}', {file: '/Welcome.txt'})).toEqual(OC.webroot + '/index.php/apps/files/download/Welcome.txt');
|
||||
});
|
||||
it('doesnt error out with no params provided', function () {
|
||||
expect(OC.generateUrl('apps/files/download{file}')).toEqual(OC.webroot + '/index.php/apps/files/download{file}');
|
||||
});
|
||||
});
|
||||
describe('Main menu mobile toggle', function() {
|
||||
var clock;
|
||||
|
|
Loading…
Reference in New Issue