summaryrefslogtreecommitdiffstats
path: root/core/js/tests/specs
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/tests/specs')
-rw-r--r--core/js/tests/specs/coreSpec.js32
-rw-r--r--core/js/tests/specs/l10nSpec.js4
-rw-r--r--core/js/tests/specs/mimeTypeSpec.js8
3 files changed, 22 insertions, 22 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index 6766fc2789c..96c8e3f99ec 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -31,7 +31,7 @@ describe('Core base tests', function() {
});
describe('Base values', function() {
it('Sets webroots', function() {
- expect(OC.webroot).toBeDefined();
+ expect(OC.getRootPath()).toBeDefined();
expect(OC.appswebroots).toBeDefined();
});
});
@@ -256,7 +256,7 @@ describe('Core base tests', function() {
describe('filePath', function() {
beforeEach(function() {
OC.webroot = 'http://localhost';
- OC.appswebroots.files = OC.webroot + '/apps3/files';
+ OC.appswebroots.files = OC.getRootPath() + '/apps3/files';
});
afterEach(function() {
delete OC.appswebroots.files;
@@ -275,7 +275,7 @@ describe('Core base tests', function() {
});
describe('Link functions', function() {
var TESTAPP = 'testapp';
- var TESTAPP_ROOT = OC.webroot + '/appsx/testapp';
+ var TESTAPP_ROOT = OC.getRootPath() + '/appsx/testapp';
beforeEach(function() {
OC.appswebroots[TESTAPP] = TESTAPP_ROOT;
@@ -285,22 +285,22 @@ describe('Core base tests', function() {
delete OC.appswebroots[TESTAPP];
});
it('Generates correct links for core apps', function() {
- expect(OC.linkTo('core', 'somefile.php')).toEqual(OC.webroot + '/core/somefile.php');
- expect(OC.linkTo('admin', 'somefile.php')).toEqual(OC.webroot + '/admin/somefile.php');
+ expect(OC.linkTo('core', 'somefile.php')).toEqual(OC.getRootPath() + '/core/somefile.php');
+ expect(OC.linkTo('admin', 'somefile.php')).toEqual(OC.getRootPath() + '/admin/somefile.php');
});
it('Generates correct links for regular apps', function() {
- expect(OC.linkTo(TESTAPP, 'somefile.php')).toEqual(OC.webroot + '/index.php/apps/' + TESTAPP + '/somefile.php');
+ expect(OC.linkTo(TESTAPP, 'somefile.php')).toEqual(OC.getRootPath() + '/index.php/apps/' + TESTAPP + '/somefile.php');
});
it('Generates correct remote links', function() {
- expect(OC.linkToRemote('webdav')).toEqual(window.location.protocol + '//' + window.location.host + OC.webroot + '/remote.php/webdav');
+ expect(OC.linkToRemote('webdav')).toEqual(window.location.protocol + '//' + window.location.host + OC.getRootPath() + '/remote.php/webdav');
});
describe('Images', function() {
it('Generates image path with given extension', function() {
- expect(OC.imagePath('core', 'somefile.jpg')).toEqual(OC.webroot + '/core/img/somefile.jpg');
+ expect(OC.imagePath('core', 'somefile.jpg')).toEqual(OC.getRootPath() + '/core/img/somefile.jpg');
expect(OC.imagePath(TESTAPP, 'somefile.jpg')).toEqual(TESTAPP_ROOT + '/img/somefile.jpg');
});
it('Generates image path with svg extension', function() {
- expect(OC.imagePath('core', 'somefile')).toEqual(OC.webroot + '/core/img/somefile.svg');
+ expect(OC.imagePath('core', 'somefile')).toEqual(OC.getRootPath() + '/core/img/somefile.svg');
expect(OC.imagePath(TESTAPP, 'somefile')).toEqual(TESTAPP_ROOT + '/img/somefile.svg');
});
});
@@ -502,23 +502,23 @@ describe('Core base tests', function() {
});
describe('Generate Url', function() {
it('returns absolute urls', function() {
- expect(OC.generateUrl('csrftoken')).toEqual(OC.webroot + '/index.php/csrftoken');
- expect(OC.generateUrl('/csrftoken')).toEqual(OC.webroot + '/index.php/csrftoken');
+ expect(OC.generateUrl('csrftoken')).toEqual(OC.getRootPath() + '/index.php/csrftoken');
+ expect(OC.generateUrl('/csrftoken')).toEqual(OC.getRootPath() + '/index.php/csrftoken');
});
it('substitutes parameters which are escaped by default', function() {
- expect(OC.generateUrl('apps/files/download/{file}', {file: '<">ImAnUnescapedString/!'})).toEqual(OC.webroot + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!');
+ expect(OC.generateUrl('apps/files/download/{file}', {file: '<">ImAnUnescapedString/!'})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!');
});
it('substitutes parameters which can also be unescaped via option flag', function() {
- expect(OC.generateUrl('apps/files/download/{file}', {file: 'subfolder/Welcome.txt'}, {escape: false})).toEqual(OC.webroot + '/index.php/apps/files/download/subfolder/Welcome.txt');
+ expect(OC.generateUrl('apps/files/download/{file}', {file: 'subfolder/Welcome.txt'}, {escape: false})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/subfolder/Welcome.txt');
});
it('substitutes multiple parameters which are escaped by default', function() {
- expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: '<">ImAnUnescapedString/!', id: 5})).toEqual(OC.webroot + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!/5');
+ expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: '<">ImAnUnescapedString/!', id: 5})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/%3C%22%3EImAnUnescapedString%2F!/5');
});
it('substitutes multiple parameters which can also be unescaped via option flag', function() {
- expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: 'subfolder/Welcome.txt', id: 5}, {escape: false})).toEqual(OC.webroot + '/index.php/apps/files/download/subfolder/Welcome.txt/5');
+ expect(OC.generateUrl('apps/files/download/{file}/{id}', {file: 'subfolder/Welcome.txt', id: 5}, {escape: false})).toEqual(OC.getRootPath() + '/index.php/apps/files/download/subfolder/Welcome.txt/5');
});
it('doesnt error out with no params provided', function () {
- expect(OC.generateUrl('apps/files/download{file}')).toEqual(OC.webroot + '/index.php/apps/files/download%7Bfile%7D');
+ expect(OC.generateUrl('apps/files/download{file}')).toEqual(OC.getRootPath() + '/index.php/apps/files/download%7Bfile%7D');
});
});
describe('Main menu mobile toggle', function() {
diff --git a/core/js/tests/specs/l10nSpec.js b/core/js/tests/specs/l10nSpec.js
index 3dd1fa268ef..219c9348717 100644
--- a/core/js/tests/specs/l10nSpec.js
+++ b/core/js/tests/specs/l10nSpec.js
@@ -12,7 +12,7 @@ describe('OC.L10N tests', function() {
var TEST_APP = 'jsunittestapp';
beforeEach(function() {
- OC.appswebroots[TEST_APP] = OC.webroot + '/apps3/jsunittestapp';
+ OC.appswebroots[TEST_APP] = OC.getRootPath() + '/apps3/jsunittestapp';
});
afterEach(function() {
delete OC.L10N._bundles[TEST_APP];
@@ -141,7 +141,7 @@ describe('OC.L10N tests', function() {
expect(fakeServer.requests.length).toEqual(1);
var req = fakeServer.requests[0];
expect(req.url).toEqual(
- OC.webroot + '/apps3/' + TEST_APP + '/l10n/zh_CN.json'
+ OC.getRootPath() + '/apps3/' + TEST_APP + '/l10n/zh_CN.json'
);
req.respond(
200,
diff --git a/core/js/tests/specs/mimeTypeSpec.js b/core/js/tests/specs/mimeTypeSpec.js
index 8ad0300a0a7..c9497a7c574 100644
--- a/core/js/tests/specs/mimeTypeSpec.js
+++ b/core/js/tests/specs/mimeTypeSpec.js
@@ -100,7 +100,7 @@ describe('MimeType tests', function() {
it('return the url for the mimetype file', function() {
var res = OC.MimeType.getIconUrl('file');
- expect(res).toEqual(OC.webroot + '/core/img/filetypes/file.svg');
+ expect(res).toEqual(OC.getRootPath() + '/core/img/filetypes/file.svg');
});
it('test if the cache works correctly', function() {
@@ -118,7 +118,7 @@ describe('MimeType tests', function() {
it('test if alaiases are converted correctly', function() {
var res = OC.MimeType.getIconUrl('app/foobar');
- expect(res).toEqual(OC.webroot + '/core/img/filetypes/foo-bar.svg');
+ expect(res).toEqual(OC.getRootPath() + '/core/img/filetypes/foo-bar.svg');
expect(OC.MimeType._mimeTypeIcons['foo/bar']).toEqual(res);
});
});
@@ -139,12 +139,12 @@ describe('MimeType tests', function() {
it('test if theme path is used if a theme icon is availble', function() {
var res = OC.MimeType.getIconUrl('dir');
- expect(res).toEqual(OC.webroot + '/themes/abc/core/img/filetypes/folder.svg');
+ expect(res).toEqual(OC.getRootPath() + '/themes/abc/core/img/filetypes/folder.svg');
});
it('test if we fallback to the default theme if no icon is available in the theme', function() {
var res = OC.MimeType.getIconUrl('dir-shared');
- expect(res).toEqual(OC.webroot + '/core/img/filetypes/folder-shared.svg');
+ expect(res).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-shared.svg');
});
});
});