|
@@ -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() {
|