[Pkg-owncloud-commits] [owncloud] 21/129: Do not register sidebar panels when no sidebar
David Prévot
taffit at moszumanska.debian.org
Thu Nov 5 01:04:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 1d04317fbcfb9c67cbab3a5fd7aa003d924af949
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Thu Oct 15 16:30:50 2015 +0200
Do not register sidebar panels when no sidebar
---
apps/files/js/filelist.js | 8 ++++--
apps/files/js/mainfileinfodetailview.js | 4 +--
apps/files/tests/js/filelistSpec.js | 43 +++++++++++++++++++++++++++++++--
3 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 6cf8239..9587910 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -2620,14 +2620,18 @@
* Register a tab view to be added to all views
*/
registerTabView: function(tabView) {
- this._detailsView.addTabView(tabView);
+ if (this._detailsView) {
+ this._detailsView.addTabView(tabView);
+ }
},
/**
* Register a detail view to be added to all views
*/
registerDetailView: function(detailView) {
- this._detailsView.addDetailView(detailView);
+ if (this._detailsView) {
+ this._detailsView.addDetailView(detailView);
+ }
}
};
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js
index b50e92d..57576d2 100644
--- a/apps/files/js/mainfileinfodetailview.js
+++ b/apps/files/js/mainfileinfodetailview.js
@@ -66,10 +66,10 @@
this._fileList = options.fileList;
this._fileActions = options.fileActions;
if (!this._fileList) {
- throw 'Missing requird parameter "fileList"';
+ throw 'Missing required parameter "fileList"';
}
if (!this._fileActions) {
- throw 'Missing requird parameter "fileActions"';
+ throw 'Missing required parameter "fileActions"';
}
},
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 9601891..994e1d3 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -1879,15 +1879,54 @@ describe('OCA.Files.FileList tests', function() {
$tr2.find('td.filename .name').trigger(e);
expect(fileList.getSelectedFiles().length).toEqual(0);
});
- })
+ });
});
describe('Details sidebar', function() {
beforeEach(function() {
fileList.setFiles(testFiles);
fileList.showDetailsView('Two.jpg');
});
+ describe('registering', function() {
+ var addTabStub;
+ var addDetailStub;
+
+ beforeEach(function() {
+ addTabStub = sinon.stub(OCA.Files.DetailsView.prototype, 'addTabView');
+ addDetailStub = sinon.stub(OCA.Files.DetailsView.prototype, 'addDetailView');
+ });
+ afterEach(function() {
+ addTabStub.restore();
+ addDetailStub.restore();
+ });
+ it('forward the registered views to the underlying DetailsView', function() {
+ fileList.destroy();
+ fileList = new OCA.Files.FileList($('#app-content-files'), {
+ detailsViewEnabled: true
+ });
+ fileList.registerTabView(new OCA.Files.DetailTabView());
+ fileList.registerDetailView(new OCA.Files.DetailFileInfoView());
+
+ expect(addTabStub.calledOnce).toEqual(true);
+ // twice because the filelist already registers one by default
+ expect(addDetailStub.calledTwice).toEqual(true);
+ });
+ it('does not error when registering panels when not details view configured', function() {
+ fileList.destroy();
+ fileList = new OCA.Files.FileList($('#app-content-files'), {
+ detailsViewEnabled: false
+ });
+ fileList.registerTabView(new OCA.Files.DetailTabView());
+ fileList.registerDetailView(new OCA.Files.DetailFileInfoView());
+
+ expect(addTabStub.notCalled).toEqual(true);
+ expect(addDetailStub.notCalled).toEqual(true);
+ });
+ });
it('triggers file action when clicking on row if no details view configured', function() {
- fileList._detailsView = null;
+ fileList.destroy();
+ fileList = new OCA.Files.FileList($('#app-content-files'), {
+ detailsViewEnabled: false
+ });
var updateDetailsViewStub = sinon.stub(fileList, '_updateDetailsView');
var actionStub = sinon.stub();
fileList.setFiles(testFiles);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list