diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-10-14 19:19:16 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-10-14 19:19:16 +0200 |
commit | 5e4eda1ae0ea0ee7e690fee1017dae873a1a7512 (patch) | |
tree | 82da6da8c61c74922451ff23e93f8b398cb1cbc6 /apps/files/tests | |
parent | b076e3a17da1bb3f418af366f78e397fe3cc9b79 (diff) | |
download | nextcloud-server-5e4eda1ae0ea0ee7e690fee1017dae873a1a7512.tar.gz nextcloud-server-5e4eda1ae0ea0ee7e690fee1017dae873a1a7512.zip |
Remove deprecated legacy file actions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/appSpec.js | 66 | ||||
-rw-r--r-- | apps/files/tests/js/favoritespluginspec.js | 26 |
2 files changed, 0 insertions, 92 deletions
diff --git a/apps/files/tests/js/appSpec.js b/apps/files/tests/js/appSpec.js index 15297a029d4..62e3ac2868a 100644 --- a/apps/files/tests/js/appSpec.js +++ b/apps/files/tests/js/appSpec.js @@ -24,7 +24,6 @@ describe('OCA.Files.App tests', function() { var pushStateStub; var replaceStateStub; var parseUrlQueryStub; - var oldLegacyFileActions; beforeEach(function() { $('#testArea').append( @@ -43,9 +42,6 @@ describe('OCA.Files.App tests', function() { '</div>' ); - oldLegacyFileActions = window.FileActions; - window.FileActions = new OCA.Files.FileActions(); - OCA.Files.legacyFileActions = window.FileActions; OCA.Files.fileActions = new OCA.Files.FileActions(); pushStateStub = sinon.stub(OC.Util.History, 'pushState'); @@ -58,8 +54,6 @@ describe('OCA.Files.App tests', function() { afterEach(function() { App.destroy(); - window.FileActions = oldLegacyFileActions; - pushStateStub.restore(); replaceStateStub.restore(); parseUrlQueryStub.restore(); @@ -71,66 +65,6 @@ describe('OCA.Files.App tests', function() { expect(App.fileList.fileActions.actions.all).toBeDefined(); expect(App.fileList.$el.is('#app-content-files')).toEqual(true); }); - it('merges the legacy file actions with the default ones', function() { - var legacyActionStub = sinon.stub(); - var actionStub = sinon.stub(); - // legacy action - window.FileActions.register( - 'all', - 'LegacyTest', - OC.PERMISSION_READ, - OC.imagePath('core', 'actions/test'), - legacyActionStub - ); - // legacy action to be overwritten - window.FileActions.register( - 'all', - 'OverwriteThis', - OC.PERMISSION_READ, - OC.imagePath('core', 'actions/test'), - legacyActionStub - ); - - // regular file actions - OCA.Files.fileActions.register( - 'all', - 'RegularTest', - OC.PERMISSION_READ, - OC.imagePath('core', 'actions/test'), - actionStub - ); - - // overwrite - OCA.Files.fileActions.register( - 'all', - 'OverwriteThis', - OC.PERMISSION_READ, - OC.imagePath('core', 'actions/test'), - actionStub - ); - - App.initialize(); - - var actions = App.fileList.fileActions.actions; - 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(); - }); }); describe('URL handling', function() { diff --git a/apps/files/tests/js/favoritespluginspec.js b/apps/files/tests/js/favoritespluginspec.js index bc4ec5b9fca..4687aadcdbe 100644 --- a/apps/files/tests/js/favoritespluginspec.js +++ b/apps/files/tests/js/favoritespluginspec.js @@ -42,16 +42,6 @@ describe('OCA.Files.FavoritesPlugin tests', function() { }); }); describe('file actions', function() { - var oldLegacyFileActions; - - beforeEach(function() { - oldLegacyFileActions = window.FileActions; - window.FileActions = new OCA.Files.FileActions(); - }); - - afterEach(function() { - window.FileActions = oldLegacyFileActions; - }); it('provides default file actions', function() { var fileActions = fileList.fileActions; @@ -78,22 +68,6 @@ describe('OCA.Files.FavoritesPlugin tests', function() { expect(fileList.fileActions.actions.all.RegularTest).toBeDefined(); }); - it('does not provide legacy file actions', function() { - var actionStub = sinon.stub(); - // legacy file action - window.FileActions.register( - 'all', - 'LegacyTest', - OC.PERMISSION_READ, - OC.imagePath('core', 'actions/shared'), - actionStub - ); - - Plugin.favoritesFileList = null; - fileList = Plugin.showFileList($('#app-content-favorites')); - - expect(fileList.fileActions.actions.all.LegacyTest).not.toBeDefined(); - }); it('redirects to files app when opening a directory', function() { var oldList = OCA.Files.App.fileList; // dummy new list to make sure it exists |