Add unit tests for fileActionsReady

This commit is contained in:
Vincent Petry 2014-05-19 18:48:48 +02:00
parent 8bdce6698c
commit 89ff2857fc

View 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);