aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-07-01 18:50:54 +0200
committerVincent Petry <pvince81@owncloud.com>2014-07-01 18:50:54 +0200
commit509cdebab7bb99c34467b053a2e596f48a10399d (patch)
treeeea9a162922f69a06362d14488b64dd6743e3550 /apps/files/tests
parent19a6dc5420d3a27c50590b2f060700edff2ef73e (diff)
downloadnextcloud-server-509cdebab7bb99c34467b053a2e596f48a10399d.tar.gz
nextcloud-server-509cdebab7bb99c34467b053a2e596f48a10399d.zip
Fix fileActionsReady event after deferred file actions update
Diffstat (limited to 'apps/files/tests')
-rw-r--r--apps/files/tests/js/filelistSpec.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index a699177767a..7a6c390f325 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();
});