]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add unit tests for fileActionsReady
authorVincent Petry <pvince81@owncloud.com>
Mon, 19 May 2014 16:48:48 +0000 (18:48 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 30 May 2014 08:06:29 +0000 (10:06 +0200)
apps/files/tests/js/filelistSpec.js

index a3dc5b255a15d142abd62416b337108a3f796bf8..3dd715254e491b297910db2870892203f0560271 100644 (file)
@@ -753,6 +753,20 @@ describe('OCA.Files.FileList tests', function() {
                        fileList.setFiles(testFiles);
                        expect(handler.calledOnce).toEqual(true);
                });
+               it('triggers "fileActionsReady" event after single add', function() {
+                       var handler = sinon.stub();
+                       fileList.setFiles(testFiles);
+                       fileList.$fileList.on('fileActionsReady', handler);
+                       fileList.add({name: 'test.txt'});
+                       expect(handler.calledOnce).toEqual(true);
+               });
+               it('does not trigger "fileActionsReady" event after single add with silent argument', function() {
+                       var handler = sinon.stub();
+                       fileList.setFiles(testFiles);
+                       fileList.$fileList.on('fileActionsReady', handler);
+                       fileList.add({name: 'test.txt'}, {silent: true});
+                       expect(handler.notCalled).toEqual(true);
+               });
                it('triggers "updated" event after update', function() {
                        var handler = sinon.stub();
                        fileList.$fileList.on('updated', handler);