aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/tests
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-06-30 11:19:21 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-07-05 16:20:34 +0200
commite3bac437c225f28bc6a9ca34c4fc33c936b00513 (patch)
treed58c9153cff230cf4850092f84aeafa19de448ed /apps/files/tests
parent7929ad4a9303d4f184e56f95fc89347519a164e4 (diff)
downloadnextcloud-server-e3bac437c225f28bc6a9ca34c4fc33c936b00513.tar.gz
nextcloud-server-e3bac437c225f28bc6a9ca34c4fc33c936b00513.zip
chore: remove old favorites view
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/tests')
-rw-r--r--apps/files/tests/Controller/ViewControllerTest.php79
-rw-r--r--apps/files/tests/js/favoritesfilelistspec.js116
-rw-r--r--apps/files/tests/js/favoritespluginspec.js119
3 files changed, 0 insertions, 314 deletions
diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php
index 64f0f10671c..daafb92e322 100644
--- a/apps/files/tests/Controller/ViewControllerTest.php
+++ b/apps/files/tests/Controller/ViewControllerTest.php
@@ -199,65 +199,6 @@ class ViewControllerTest extends TestCase {
'expanded' => false,
'unread' => 0,
],
- 'favorites' => [
- 'id' => 'favorites',
- 'appname' => 'files',
- 'script' => 'simplelist.php',
- 'order' => 5,
- 'name' => \OC::$server->getL10N('files')->t('Favorites'),
- 'active' => false,
- 'icon' => '',
- 'type' => 'link',
- 'classes' => 'collapsible',
- 'sublist' => [
- [
- 'id' => '-test1',
- 'dir' => '/test1',
- 'order' => 6,
- 'name' => 'test1',
- 'icon' => 'folder',
- 'params' => [
- 'view' => 'files',
- 'dir' => '/test1',
- ],
- ],
- [
- 'name' => 'test2',
- 'id' => '-test2-',
- 'dir' => '/test2/',
- 'order' => 7,
- 'icon' => 'folder',
- 'params' => [
- 'view' => 'files',
- 'dir' => '/test2/',
- ],
- ],
- [
- 'name' => 'sub4',
- 'id' => '-test3-sub4',
- 'dir' => '/test3/sub4',
- 'order' => 8,
- 'icon' => 'folder',
- 'params' => [
- 'view' => 'files',
- 'dir' => '/test3/sub4',
- ],
- ],
- [
- 'name' => 'sub6',
- 'id' => '-test5-sub6-',
- 'dir' => '/test5/sub6/',
- 'order' => 9,
- 'icon' => 'folder',
- 'params' => [
- 'view' => 'files',
- 'dir' => '/test5/sub6/',
- ],
- ],
- ],
- 'expanded' => false,
- 'unread' => 0,
- ],
'systemtagsfilter' => [
'id' => 'systemtagsfilter',
'appname' => 'systemtags',
@@ -347,10 +288,6 @@ class ViewControllerTest extends TestCase {
'id' => 'recent',
'content' => null,
],
- 'favorites' => [
- 'id' => 'favorites',
- 'content' => null,
- ],
'systemtagsfilter' => [
'id' => 'systemtagsfilter',
'content' => null,
@@ -379,22 +316,6 @@ class ViewControllerTest extends TestCase {
'id' => 'shareoverview',
'content' => null,
],
- '-test1' => [
- 'id' => '-test1',
- 'content' => '',
- ],
- '-test2-' => [
- 'id' => '-test2-',
- 'content' => '',
- ],
- '-test3-sub4' => [
- 'id' => '-test3-sub4',
- 'content' => '',
- ],
- '-test5-sub6-' => [
- 'id' => '-test5-sub6-',
- 'content' => '',
- ],
],
'hiddenFields' => [],
'showgridview' => null
diff --git a/apps/files/tests/js/favoritesfilelistspec.js b/apps/files/tests/js/favoritesfilelistspec.js
deleted file mode 100644
index 5d1ad2312f2..00000000000
--- a/apps/files/tests/js/favoritesfilelistspec.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Jan-Christoph Borchardt <hey@jancborchardt.net>
- * @author Vincent Petry <vincent@nextcloud.com>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-describe('OCA.Files.FavoritesFileList tests', function() {
- var fileList;
-
- beforeEach(function() {
- // init parameters and test table elements
- $('#testArea').append(
- '<div id="app-content">' +
- // init horrible parameters
- '<input type="hidden" id="permissions" value="31"></input>' +
- // dummy controls
- '<div class="files-controls">' +
- ' <div class="actions creatable"></div>' +
- ' <div class="notCreatable"></div>' +
- '</div>' +
- // dummy table
- // TODO: at some point this will be rendered by the fileList class itself!
- '<table class="files-filestable list-container view-grid">' +
- '<thead><tr>' +
- '<th class="hidden column-name">' +
- '<a class="name columntitle" data-sort="name"><span>Name</span><span class="sort-indicator"></span></a>' +
- '</th>' +
- '<th class="hidden column-mtime">' +
- '<a class="columntitle" data-sort="mtime"><span class="sort-indicator"></span></a>' +
- '</th>' +
- '</tr></thead>' +
- '<tbody class="files-fileList"></tbody>' +
- '<tfoot></tfoot>' +
- '</table>' +
- '<div class="emptyfilelist emptycontent">Empty content message</div>' +
- '</div>'
- );
- });
-
- describe('loading file list', function() {
- var fetchStub;
-
- beforeEach(function() {
- fileList = new OCA.Files.FavoritesFileList(
- $('#app-content')
- );
- OCA.Files.FavoritesPlugin.attach(fileList);
-
- fetchStub = sinon.stub(fileList.filesClient, 'getFilteredFiles');
- });
- afterEach(function() {
- fetchStub.restore();
- fileList.destroy();
- fileList = undefined;
- });
- it('render files', function(done) {
- var deferred = $.Deferred();
- fetchStub.returns(deferred.promise());
-
- fileList.reload();
-
- expect(fetchStub.calledOnce).toEqual(true);
-
- deferred.resolve(207, [{
- id: 7,
- name: 'test.txt',
- path: '/somedir',
- size: 123,
- mtime: 11111000,
- tags: [OC.TAG_FAVORITE],
- permissions: OC.PERMISSION_ALL,
- mimetype: 'text/plain'
- }]);
-
- setTimeout(function() {
- var $rows = fileList.$el.find('tbody tr');
- var $tr = $rows.eq(0);
- expect($rows.length).toEqual(1);
- expect($tr.attr('data-id')).toEqual('7');
- expect($tr.attr('data-type')).toEqual('file');
- expect($tr.attr('data-file')).toEqual('test.txt');
- expect($tr.attr('data-path')).toEqual('/somedir');
- expect($tr.attr('data-size')).toEqual('123');
- expect(parseInt($tr.attr('data-permissions'), 10))
- .toEqual(OC.PERMISSION_ALL);
- expect($tr.attr('data-mime')).toEqual('text/plain');
- expect($tr.attr('data-mtime')).toEqual('11111000');
- expect($tr.find('a.name').attr('href')).toEqual(
- OC.getRootPath() +
- '/remote.php/webdav/somedir/test.txt'
- );
- expect($tr.find('.nametext').text().trim()).toEqual('test.txt');
-
- done();
- }, 0);
- });
- });
-});
diff --git a/apps/files/tests/js/favoritespluginspec.js b/apps/files/tests/js/favoritespluginspec.js
deleted file mode 100644
index ca0cea8b29a..00000000000
--- a/apps/files/tests/js/favoritespluginspec.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
- *
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Vincent Petry <vincent@nextcloud.com>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-describe('OCA.Files.FavoritesPlugin tests', function() {
- var Plugin = OCA.Files.FavoritesPlugin;
- var fileList;
-
- beforeEach(function() {
- $('#testArea').append(
- '<div id="content">' +
- '<div id="app-navigation">' +
- '<ul><li data-id="files"><a>Files</a></li>' +
- '<li data-id="sharingin"><a></a></li>' +
- '<li data-id="sharingout"><a></a></li>' +
- '</ul></div>' +
- '<div id="app-content">' +
- '<div id="app-content-files" class="hidden">' +
- '</div>' +
- '<div id="app-content-favorites" class="hidden">' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</div>'
- );
- OC.Plugins.attach('OCA.Files.App', Plugin);
- fileList = Plugin.showFileList($('#app-content-favorites'));
- });
- afterEach(function() {
- OC.Plugins.detach('OCA.Files.App', Plugin);
- });
-
- describe('initialization', function() {
- it('inits favorites list on show', function() {
- expect(fileList).toBeDefined();
- });
- });
- describe('file actions', function() {
- it('provides default file actions', function() {
- var fileActions = fileList.fileActions;
-
- expect(fileActions.actions.all).toBeDefined();
- expect(fileActions.actions.all.Delete).toBeDefined();
- expect(fileActions.actions.all.Rename).toBeDefined();
- expect(fileActions.actions.all.Download).toBeDefined();
-
- expect(fileActions.defaults.dir).toEqual('Open');
- });
- it('provides custom file actions', function() {
- var actionStub = sinon.stub();
- // regular file action
- OCA.Files.fileActions.register(
- 'all',
- 'RegularTest',
- OC.PERMISSION_READ,
- OC.imagePath('core', 'actions/shared'),
- actionStub
- );
-
- Plugin.favoritesFileList = null;
- fileList = Plugin.showFileList($('#app-content-favorites'));
-
- expect(fileList.fileActions.actions.all.RegularTest).toBeDefined();
- });
- it('redirects to files app when opening a directory', function() {
- var oldList = OCA.Files.App.fileList;
- // dummy new list to make sure it exists
- OCA.Files.App.fileList = new OCA.Files.FileList($('<table><thead></thead><tbody></tbody></table>'));
-
- var setActiveViewStub = sinon.stub(OCA.Files.App, 'setActiveView');
- // create dummy table so we can click the dom
- var $table = '<table><thead></thead><tbody class="files-fileList"></tbody></table>';
- $('#app-content-favorites').append($table);
-
- Plugin.favoritesFileList = null;
- fileList = Plugin.showFileList($('#app-content-favorites'));
-
- fileList.setFiles([{
- name: 'testdir',
- type: 'dir',
- path: '/somewhere/inside/subdir',
- counterParts: ['user2'],
- shareOwner: 'user2'
- }]);
-
- fileList.findFileEl('testdir').find('td .nametext').click();
-
- expect(OCA.Files.App.fileList.getCurrentDirectory()).toEqual('/somewhere/inside/subdir/testdir');
-
- expect(setActiveViewStub.calledOnce).toEqual(true);
- expect(setActiveViewStub.calledWith('files')).toEqual(true);
-
- setActiveViewStub.restore();
-
- // restore old list
- OCA.Files.App.fileList = oldList;
- });
- });
-});
-