Merge pull request #11105 from owncloud/jsunit-legacyfileactionsfix

Tentative fix for legacy file actions unit test side effect
This commit is contained in:
Lukas Reschke 2014-09-17 18:10:49 +02:00
commit 7db0d55129
2 changed files with 14 additions and 0 deletions

View File

@ -23,6 +23,7 @@ describe('OCA.Files.App tests', function() {
var App = OCA.Files.App; var App = OCA.Files.App;
var pushStateStub; var pushStateStub;
var parseUrlQueryStub; var parseUrlQueryStub;
var oldLegacyFileActions;
beforeEach(function() { beforeEach(function() {
$('#testArea').append( $('#testArea').append(
@ -41,6 +42,7 @@ describe('OCA.Files.App tests', function() {
'</div>' '</div>'
); );
oldLegacyFileActions = window.FileActions;
window.FileActions = new OCA.Files.FileActions(); window.FileActions = new OCA.Files.FileActions();
OCA.Files.legacyFileActions = window.FileActions; OCA.Files.legacyFileActions = window.FileActions;
OCA.Files.fileActions = new OCA.Files.FileActions(); OCA.Files.fileActions = new OCA.Files.FileActions();
@ -54,6 +56,8 @@ describe('OCA.Files.App tests', function() {
afterEach(function() { afterEach(function() {
App.destroy(); App.destroy();
window.FileActions = oldLegacyFileActions;
pushStateStub.restore(); pushStateStub.restore();
parseUrlQueryStub.restore(); parseUrlQueryStub.restore();
}); });

View File

@ -57,6 +57,16 @@ describe('OCA.Sharing.App tests', function() {
}); });
}); });
describe('file actions', 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() { it('provides default file actions', function() {
_.each([fileListIn, fileListOut], function(fileList) { _.each([fileListIn, fileListOut], function(fileList) {
var fileActions = fileList.fileActions; var fileActions = fileList.fileActions;