summaryrefslogtreecommitdiffstats
path: root/apps/files/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-07-01 21:32:04 +0200
committerVincent Petry <pvince81@owncloud.com>2014-07-01 21:32:04 +0200
commit025b71d068bf530581693af67a31a56dca24beb1 (patch)
tree1d3aeda7b7f569b02adf96399896b1a59c307913 /apps/files/tests
parent509cdebab7bb99c34467b053a2e596f48a10399d (diff)
downloadnextcloud-server-025b71d068bf530581693af67a31a56dca24beb1.tar.gz
nextcloud-server-025b71d068bf530581693af67a31a56dca24beb1.zip
Use fileActionsReady to re-render sharing icons
Whenever file actions are modified, either by registering new actions or when appending a new page of entries, the sharing app is now notified so it can correctly refresh the sharing icon status. Additionally, the core's loadIcons() method is also used to load the existing shares and also refresh the sharing icons afterwards.
Diffstat (limited to 'apps/files/tests')
-rw-r--r--apps/files/tests/js/filelistSpec.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 7a6c390f325..713cd5468d8 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -797,13 +797,24 @@ describe('OCA.Files.FileList tests', function() {
fileList.$fileList.on('fileActionsReady', handler);
fileList.setFiles(testFiles);
expect(handler.calledOnce).toEqual(true);
+ expect(handler.getCall(0).args[0].$files.length).toEqual(testFiles.length);
});
it('triggers "fileActionsReady" event after single add', function() {
var handler = sinon.stub();
+ var $tr;
fileList.setFiles(testFiles);
fileList.$fileList.on('fileActionsReady', handler);
- fileList.add({name: 'test.txt'});
+ $tr = fileList.add({name: 'test.txt'});
+ expect(handler.calledOnce).toEqual(true);
+ expect(handler.getCall(0).args[0].$files.is($tr)).toEqual(true);
+ });
+ it('triggers "fileActionsReady" event after next page load with the newly appended files', function() {
+ var handler = sinon.stub();
+ fileList.setFiles(generateFiles(0, 64));
+ fileList.$fileList.on('fileActionsReady', handler);
+ fileList._nextPage();
expect(handler.calledOnce).toEqual(true);
+ expect(handler.getCall(0).args[0].$files.length).toEqual(fileList.pageSize);
});
it('does not trigger "fileActionsReady" event after single add with silent argument', function() {
var handler = sinon.stub();