From: Vincent Petry Date: Tue, 16 Sep 2014 13:30:56 +0000 (+0200) Subject: Tentative fix for legacy file actions unit test side effect X-Git-Tag: v8.0.0alpha1~670^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=05cf940983bed37b9b29b496dbd3dea073fe21ee;p=nextcloud-server.git Tentative fix for legacy file actions unit test side effect Sometimes the JS unit test with legacy file actions fail. This fix runs the legacy file actions tests on a dummy instead of the real one. --- diff --git a/apps/files/tests/js/appSpec.js b/apps/files/tests/js/appSpec.js index 77d36d59fa9..dce513339f0 100644 --- a/apps/files/tests/js/appSpec.js +++ b/apps/files/tests/js/appSpec.js @@ -23,6 +23,7 @@ describe('OCA.Files.App tests', function() { var App = OCA.Files.App; var pushStateStub; var parseUrlQueryStub; + var oldLegacyFileActions; beforeEach(function() { $('#testArea').append( @@ -41,6 +42,7 @@ describe('OCA.Files.App tests', function() { '' ); + oldLegacyFileActions = window.FileActions; window.FileActions = new OCA.Files.FileActions(); OCA.Files.legacyFileActions = window.FileActions; OCA.Files.fileActions = new OCA.Files.FileActions(); @@ -54,6 +56,8 @@ describe('OCA.Files.App tests', function() { afterEach(function() { App.destroy(); + window.FileActions = oldLegacyFileActions; + pushStateStub.restore(); parseUrlQueryStub.restore(); }); diff --git a/apps/files_sharing/tests/js/appSpec.js b/apps/files_sharing/tests/js/appSpec.js index 3f9cc61da5d..49bca568001 100644 --- a/apps/files_sharing/tests/js/appSpec.js +++ b/apps/files_sharing/tests/js/appSpec.js @@ -57,6 +57,16 @@ describe('OCA.Sharing.App 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() { _.each([fileListIn, fileListOut], function(fileList) { var fileActions = fileList.fileActions;