[Pkg-owncloud-commits] [owncloud] 184/273: Fix fileActionsReady event after deferred file actions update

David Prévot taffit at moszumanska.debian.org
Fri Jul 4 03:13:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 509cdebab7bb99c34467b053a2e596f48a10399d
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue Jul 1 18:50:54 2014 +0200

    Fix fileActionsReady event after deferred file actions update
---
 apps/files/js/filelist.js           | 3 ++-
 apps/files/tests/js/filelistSpec.js | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 0477a65..07e4e52 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -519,8 +519,9 @@
 		_onFileActionsUpdated: function() {
 			var self = this;
 			this.$fileList.find('tr td.filename').each(function() {
-				self.fileActions.display($(this), true, self);
+				self.fileActions.display($(this), false, self);
 			});
+			this.$fileList.trigger($.Event('fileActionsReady', {fileList: this}));
 		},
 
 		/**
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index a699177..7a6c390 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -1630,6 +1630,7 @@ describe('OCA.Files.FileList tests', function() {
 		});
 		it('redisplays actions when new actions have been registered', function() {
 			var actionStub = sinon.stub();
+			var readyHandler = sinon.stub();
 			var clock = sinon.useFakeTimers();
 			var debounceStub = sinon.stub(_, 'debounce', function(callback) {
 				return function() {
@@ -1637,11 +1638,15 @@ describe('OCA.Files.FileList tests', function() {
 					_.defer(callback);
 				};
 			});
+
 			// need to reinit the list to make the debounce call
 			fileList.destroy();
 			fileList = new OCA.Files.FileList($('#app-content-files'));
 
 			fileList.setFiles(testFiles);
+
+			fileList.$fileList.on('fileActionsReady', readyHandler);
+
 			fileList.fileActions.register(
 				'text/plain',
 				'Test',
@@ -1654,9 +1659,13 @@ describe('OCA.Files.FileList tests', function() {
 			);
 			var $tr = fileList.findFileEl('One.txt');
 			expect($tr.find('.action-test').length).toEqual(0);
+			expect(readyHandler.notCalled).toEqual(true);
+
 			// update is delayed
 			clock.tick(100);
 			expect($tr.find('.action-test').length).toEqual(1);
+			expect(readyHandler.calledOnce).toEqual(true);
+
 			clock.restore();
 			debounceStub.restore();
 		});

-- 
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