diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-12-22 12:31:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-22 12:31:55 +0100 |
commit | e37fa60784f94abb6715704ffcbd479c05938e3a (patch) | |
tree | 7c3b22cc9dc5aa87c0319fcea497aca0b4bcd4df /apps/files/tests/js/appSpec.js | |
parent | e40d6f6d8c54df43c302eaec7496080b42a49619 (diff) | |
parent | c059fbd409b088f65922354149f6d2fd9b5d01b3 (diff) | |
download | nextcloud-server-e37fa60784f94abb6715704ffcbd479c05938e3a.tar.gz nextcloud-server-e37fa60784f94abb6715704ffcbd479c05938e3a.zip |
Merge pull request #7591 from nextcloud/trigger-events-before-and-after-a-file-action-is-executed
Trigger events before and after a file action is executed
Diffstat (limited to 'apps/files/tests/js/appSpec.js')
-rw-r--r-- | apps/files/tests/js/appSpec.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/files/tests/js/appSpec.js b/apps/files/tests/js/appSpec.js index b9c323e7c12..5728991e197 100644 --- a/apps/files/tests/js/appSpec.js +++ b/apps/files/tests/js/appSpec.js @@ -112,9 +112,22 @@ describe('OCA.Files.App tests', function() { App.initialize(); var actions = App.fileList.fileActions.actions; - expect(actions.all.OverwriteThis.action).toBe(actionStub); - expect(actions.all.LegacyTest.action).toBe(legacyActionStub); - expect(actions.all.RegularTest.action).toBe(actionStub); + var context = { fileActions: sinon.createStubInstance(OCA.Files.FileActions) }; + actions.all.OverwriteThis.action('testFileName', context); + expect(actionStub.calledOnce).toBe(true); + expect(context.fileActions._notifyUpdateListeners.callCount).toBe(2); + expect(context.fileActions._notifyUpdateListeners.getCall(0).calledWith('beforeTriggerAction')).toBe(true); + expect(context.fileActions._notifyUpdateListeners.getCall(1).calledWith('afterTriggerAction')).toBe(true); + actions.all.LegacyTest.action('testFileName', context); + expect(legacyActionStub.calledOnce).toBe(true); + expect(context.fileActions._notifyUpdateListeners.callCount).toBe(4); + expect(context.fileActions._notifyUpdateListeners.getCall(2).calledWith('beforeTriggerAction')).toBe(true); + expect(context.fileActions._notifyUpdateListeners.getCall(3).calledWith('afterTriggerAction')).toBe(true); + actions.all.RegularTest.action('testFileName', context); + expect(actionStub.calledTwice).toBe(true); + expect(context.fileActions._notifyUpdateListeners.callCount).toBe(6); + expect(context.fileActions._notifyUpdateListeners.getCall(4).calledWith('beforeTriggerAction')).toBe(true); + expect(context.fileActions._notifyUpdateListeners.getCall(5).calledWith('afterTriggerAction')).toBe(true); // default one still there expect(actions.dir.Open.action).toBeDefined(); }); |