diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-09 07:44:26 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-09 13:53:59 +0200 |
commit | 9af69ca2a5ed74acefdaedad6d189bdfd9e61e0e (patch) | |
tree | c755177c3886de1498010820b9a547a5314c8d41 /apps/files/tests | |
parent | 8b38b601e5bd07559bb86d38132be31820c41627 (diff) | |
download | nextcloud-server-9af69ca2a5ed74acefdaedad6d189bdfd9e61e0e.tar.gz nextcloud-server-9af69ca2a5ed74acefdaedad6d189bdfd9e61e0e.zip |
Fix usage of deprecated OC.webroot
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/favoritesfilelistspec.js | 2 | ||||
-rw-r--r-- | apps/files/tests/js/fileactionsSpec.js | 2 | ||||
-rw-r--r-- | apps/files/tests/js/fileactionsmenuSpec.js | 4 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 60 | ||||
-rw-r--r-- | apps/files/tests/js/filesSpec.js | 6 |
5 files changed, 37 insertions, 37 deletions
diff --git a/apps/files/tests/js/favoritesfilelistspec.js b/apps/files/tests/js/favoritesfilelistspec.js index db890927ed4..d1421c84ee2 100644 --- a/apps/files/tests/js/favoritesfilelistspec.js +++ b/apps/files/tests/js/favoritesfilelistspec.js @@ -90,7 +90,7 @@ describe('OCA.Files.FavoritesFileList tests', function() { expect($tr.attr('data-mime')).toEqual('text/plain'); expect($tr.attr('data-mtime')).toEqual('11111000'); expect($tr.find('a.name').attr('href')).toEqual( - OC.webroot + + OC.getRootPath() + '/remote.php/webdav/somedir/test.txt' ); expect($tr.find('.nametext').text().trim()).toEqual('test.txt'); diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js index 2dc8bb50920..00d13859b5b 100644 --- a/apps/files/tests/js/fileactionsSpec.js +++ b/apps/files/tests/js/fileactionsSpec.js @@ -716,7 +716,7 @@ describe('OCA.Files.FileActions tests', function() { expect(busyStub.calledWith('testName.txt', true)).toEqual(true); expect(handleDownloadStub.calledOnce).toEqual(true); expect(handleDownloadStub.getCall(0).args[0]).toEqual( - OC.webroot + '/remote.php/webdav/subdir/testName.txt' + OC.getRootPath() + '/remote.php/webdav/subdir/testName.txt' ); busyStub.reset(); handleDownloadStub.yield(); diff --git a/apps/files/tests/js/fileactionsmenuSpec.js b/apps/files/tests/js/fileactionsmenuSpec.js index c678d166153..f171f2848f8 100644 --- a/apps/files/tests/js/fileactionsmenuSpec.js +++ b/apps/files/tests/js/fileactionsmenuSpec.js @@ -281,7 +281,7 @@ describe('OCA.Files.FileActionsMenu tests', function() { expect(redirectStub.calledOnce).toEqual(true); expect(redirectStub.getCall(0).args[0]).toContain( - OC.webroot + + OC.getRootPath() + '/remote.php/webdav/subdir/testName.txt' ); redirectStub.restore(); @@ -315,7 +315,7 @@ describe('OCA.Files.FileActionsMenu tests', function() { expect(redirectStub.calledOnce).toEqual(true); expect(redirectStub.getCall(0).args[0]).toContain( - OC.webroot + '/remote.php/webdav/anotherpath/there/testName.txt' + OC.getRootPath() + '/remote.php/webdav/anotherpath/there/testName.txt' ); redirectStub.restore(); }); diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 50b336902b9..04102a84754 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -62,8 +62,8 @@ describe('OCA.Files.FileList tests', function() { filesClient = new OC.Files.Client({ host: 'localhost', port: 80, - // FIXME: uncomment after fixing the test OC.webroot - //root: OC.webroot + '/remote.php/webdav', + // FIXME: uncomment after fixing the test OC.getRootPath() + //root: OC.getRootPath() + '/remote.php/webdav', root: '/remote.php/webdav', useHTTPS: false }); @@ -232,7 +232,7 @@ describe('OCA.Files.FileList tests', function() { expect($tr.attr('data-mtime')).toEqual('123456'); expect($tr.attr('data-e2eencrypted')).toEqual('false'); expect($tr.find('a.name').attr('href')) - .toEqual(OC.webroot + '/remote.php/webdav/subdir/testName.txt'); + .toEqual(OC.getRootPath() + '/remote.php/webdav/subdir/testName.txt'); expect($tr.find('.nametext').text().trim()).toEqual('testName.txt'); expect($tr.find('.filesize').text()).toEqual('1 KB'); @@ -725,7 +725,7 @@ describe('OCA.Files.FileList tests', function() { $tr = fileList.findFileEl('Tu_after_three.txt'); expect($tr.find('a.name').attr('href')) - .toEqual(OC.webroot + '/remote.php/webdav/some/subdir/Tu_after_three.txt'); + .toEqual(OC.getRootPath() + '/remote.php/webdav/some/subdir/Tu_after_three.txt'); }); it('Triggers "fileActionsReady" event after rename', function() { var handler = sinon.stub(); @@ -1412,7 +1412,7 @@ describe('OCA.Files.FileList tests', function() { }; var $tr = fileList.add(fileData); var $imgDiv = $tr.find('td.filename .thumbnail'); - expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.webroot + '/core/img/filetypes/file.svg'); + expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.getRootPath() + '/core/img/filetypes/file.svg'); // tries to load preview expect(previewLoadStub.calledOnce).toEqual(true); }); @@ -1424,7 +1424,7 @@ describe('OCA.Files.FileList tests', function() { var $tr = fileList.add(fileData); var $imgDiv = $tr.find('td.filename .thumbnail'); - expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.webroot + '/core/img/filetypes/folder.svg'); + expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.getRootPath() + '/core/img/filetypes/folder.svg'); // no preview since it's a directory expect(previewLoadStub.notCalled).toEqual(true); }); @@ -1432,24 +1432,24 @@ describe('OCA.Files.FileList tests', function() { var fileData = new FileInfo({ type: 'file', name: 'test file', - icon: OC.webroot + '/core/img/filetypes/application-pdf.svg', + icon: OC.getRootPath() + '/core/img/filetypes/application-pdf.svg', mimetype: 'application/pdf' }); var $tr = fileList.add(fileData); var $imgDiv = $tr.find('td.filename .thumbnail'); - expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.webroot + '/core/img/filetypes/application-pdf.svg'); + expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.getRootPath() + '/core/img/filetypes/application-pdf.svg'); // try loading preview expect(previewLoadStub.calledOnce).toEqual(true); }); it('renders provided icon for file when provided', function() { var fileData = new FileInfo({ name: 'somefile.pdf', - icon: OC.webroot + '/core/img/filetypes/application-pdf.svg' + icon: OC.getRootPath() + '/core/img/filetypes/application-pdf.svg' }); var $tr = fileList.add(fileData); var $imgDiv = $tr.find('td.filename .thumbnail'); - expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.webroot + '/core/img/filetypes/application-pdf.svg'); + expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.getRootPath() + '/core/img/filetypes/application-pdf.svg'); // try loading preview expect(previewLoadStub.calledOnce).toEqual(true); }); @@ -1457,12 +1457,12 @@ describe('OCA.Files.FileList tests', function() { var fileData = new FileInfo({ name: 'some folder', mimetype: 'httpd/unix-directory', - icon: OC.webroot + '/core/img/filetypes/folder-alt.svg' + icon: OC.getRootPath() + '/core/img/filetypes/folder-alt.svg' }); var $tr = fileList.add(fileData); var $imgDiv = $tr.find('td.filename .thumbnail'); - expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.webroot + '/core/img/filetypes/folder-alt.svg'); + expect(OC.TestUtil.getImageUrl($imgDiv)).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-alt.svg'); // do not load preview for folders expect(previewLoadStub.notCalled).toEqual(true); }); @@ -1474,11 +1474,11 @@ describe('OCA.Files.FileList tests', function() { var $tr = fileList.add(fileData); var $td = $tr.find('td.filename'); expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))) - .toEqual(OC.webroot + '/core/img/filetypes/file.svg'); + .toEqual(OC.getRootPath() + '/core/img/filetypes/file.svg'); expect(previewLoadStub.calledOnce).toEqual(true); // third argument is callback - previewLoadStub.getCall(0).args[0].callback(OC.webroot + '/somepath.png'); - expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.webroot + '/somepath.png'); + previewLoadStub.getCall(0).args[0].callback(OC.getRootPath() + '/somepath.png'); + expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.getRootPath() + '/somepath.png'); }); it('does not render preview for directories', function() { var fileData = { @@ -1488,7 +1488,7 @@ describe('OCA.Files.FileList tests', function() { }; var $tr = fileList.add(fileData); var $td = $tr.find('td.filename'); - expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.webroot + '/core/img/filetypes/folder.svg'); + expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.getRootPath() + '/core/img/filetypes/folder.svg'); expect(previewLoadStub.notCalled).toEqual(true); }); it('render encrypted folder icon for encrypted root', function() { @@ -1500,7 +1500,7 @@ describe('OCA.Files.FileList tests', function() { }; var $tr = fileList.add(fileData); var $td = $tr.find('td.filename'); - expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.webroot + '/core/img/filetypes/folder-encrypted.svg'); + expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-encrypted.svg'); expect(previewLoadStub.notCalled).toEqual(true); }); it('render encrypted folder icon for encrypted subdir', function() { @@ -1512,10 +1512,10 @@ describe('OCA.Files.FileList tests', function() { }; var $tr = fileList.add(fileData); var $td = $tr.find('td.filename'); - expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.webroot + '/core/img/filetypes/folder-encrypted.svg'); + expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-encrypted.svg'); expect(previewLoadStub.notCalled).toEqual(true); // default icon override - expect($tr.attr('data-icon')).toEqual(OC.webroot + '/core/img/filetypes/folder-encrypted.svg'); + expect($tr.attr('data-icon')).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-encrypted.svg'); }); it('render external storage icon for external storage root', function() { var fileData = { @@ -1526,7 +1526,7 @@ describe('OCA.Files.FileList tests', function() { }; var $tr = fileList.add(fileData); var $td = $tr.find('td.filename'); - expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.webroot + '/core/img/filetypes/folder-external.svg'); + expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-external.svg'); expect(previewLoadStub.notCalled).toEqual(true); }); it('render external storage icon for external storage subdir', function() { @@ -1538,10 +1538,10 @@ describe('OCA.Files.FileList tests', function() { }; var $tr = fileList.add(fileData); var $td = $tr.find('td.filename'); - expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.webroot + '/core/img/filetypes/folder-external.svg'); + expect(OC.TestUtil.getImageUrl($td.find('.thumbnail'))).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-external.svg'); expect(previewLoadStub.notCalled).toEqual(true); // default icon override - expect($tr.attr('data-icon')).toEqual(OC.webroot + '/core/img/filetypes/folder-external.svg'); + expect($tr.attr('data-icon')).toEqual(OC.getRootPath() + '/core/img/filetypes/folder-external.svg'); }); }); @@ -1811,20 +1811,20 @@ describe('OCA.Files.FileList tests', function() { describe('Download Url', function() { it('returns correct download URL for single files', function() { expect(fileList.getDownloadUrl('some file.txt')) - .toEqual(OC.webroot + '/remote.php/webdav/subdir/some%20file.txt'); + .toEqual(OC.getRootPath() + '/remote.php/webdav/subdir/some%20file.txt'); expect(fileList.getDownloadUrl('some file.txt', '/anotherpath/abc')) - .toEqual(OC.webroot + '/remote.php/webdav/anotherpath/abc/some%20file.txt'); + .toEqual(OC.getRootPath() + '/remote.php/webdav/anotherpath/abc/some%20file.txt'); $('#dir').val('/'); expect(fileList.getDownloadUrl('some file.txt')) - .toEqual(OC.webroot + '/remote.php/webdav/some%20file.txt'); + .toEqual(OC.getRootPath() + '/remote.php/webdav/some%20file.txt'); }); it('returns correct download URL for multiple files', function() { expect(fileList.getDownloadUrl(['a b c.txt', 'd e f.txt'])) - .toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=%5B%22a%20b%20c.txt%22%2C%22d%20e%20f.txt%22%5D'); + .toEqual(OC.getRootPath() + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=%5B%22a%20b%20c.txt%22%2C%22d%20e%20f.txt%22%5D'); }); it('returns the correct ajax URL', function() { expect(fileList.getAjaxUrl('test', {a:1, b:'x y'})) - .toEqual(OC.webroot + '/index.php/apps/files/ajax/test.php?a=1&b=x%20y'); + .toEqual(OC.getRootPath() + '/index.php/apps/files/ajax/test.php?a=1&b=x%20y'); }); }); describe('File selection', function() { @@ -2239,7 +2239,7 @@ describe('OCA.Files.FileList tests', function() { it('Opens download URL when clicking "Download"', function() { $('.selectedActions .filesSelectMenu .download').click(); expect(redirectStub.calledOnce).toEqual(true); - expect(redirectStub.getCall(0).args[0]).toContain(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=%5B%22One.txt%22%2C%22Three.pdf%22%2C%22somedir%22%5D'); + expect(redirectStub.getCall(0).args[0]).toContain(OC.getRootPath() + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=%5B%22One.txt%22%2C%22Three.pdf%22%2C%22somedir%22%5D'); redirectStub.restore(); }); it('Downloads root folder when all selected in root folder', function() { @@ -2247,13 +2247,13 @@ describe('OCA.Files.FileList tests', function() { $('.select-all').click(); $('.selectedActions .filesSelectMenu .download').click(); expect(redirectStub.calledOnce).toEqual(true); - expect(redirectStub.getCall(0).args[0]).toContain(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2F&files='); + expect(redirectStub.getCall(0).args[0]).toContain(OC.getRootPath() + '/index.php/apps/files/ajax/download.php?dir=%2F&files='); }); it('Downloads parent folder when all selected in subfolder', function() { $('.select-all').click(); $('.selectedActions .filesSelectMenu .download').click(); expect(redirectStub.calledOnce).toEqual(true); - expect(redirectStub.getCall(0).args[0]).toContain(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2F&files=subdir'); + expect(redirectStub.getCall(0).args[0]).toContain(OC.getRootPath() + '/index.php/apps/files/ajax/download.php?dir=%2F&files=subdir'); }); afterEach(function() { diff --git a/apps/files/tests/js/filesSpec.js b/apps/files/tests/js/filesSpec.js index 5c3f68b2ba4..bd4bae65102 100644 --- a/apps/files/tests/js/filesSpec.js +++ b/apps/files/tests/js/filesSpec.js @@ -78,15 +78,15 @@ describe('OCA.Files.Files tests', function() { describe('getDownloadUrl', function() { it('returns the ajax download URL when filename and dir specified', function() { var url = Files.getDownloadUrl('test file.txt', '/subdir'); - expect(url).toEqual(OC.webroot + '/remote.php/webdav/subdir/test%20file.txt'); + expect(url).toEqual(OC.getRootPath() + '/remote.php/webdav/subdir/test%20file.txt'); }); it('returns the webdav download URL when filename and root dir specified', function() { var url = Files.getDownloadUrl('test file.txt', '/'); - expect(url).toEqual(OC.webroot + '/remote.php/webdav/test%20file.txt'); + expect(url).toEqual(OC.getRootPath() + '/remote.php/webdav/test%20file.txt'); }); it('returns the ajax download URL when multiple files specified', function() { var url = Files.getDownloadUrl(['test file.txt', 'abc.txt'], '/subdir'); - expect(url).toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=%5B%22test%20file.txt%22%2C%22abc.txt%22%5D'); + expect(url).toEqual(OC.getRootPath() + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=%5B%22test%20file.txt%22%2C%22abc.txt%22%5D'); }); }); describe('handleDownload', function() { |