]> source.dussan.org Git - nextcloud-server.git/commitdiff
Tentative fix for legacy file actions unit test side effect
authorVincent Petry <pvince81@owncloud.com>
Tue, 16 Sep 2014 13:30:56 +0000 (15:30 +0200)
committerVincent Petry <pvince81@owncloud.com>
Tue, 16 Sep 2014 13:38:44 +0000 (15:38 +0200)
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.

apps/files/tests/js/appSpec.js
apps/files_sharing/tests/js/appSpec.js

index 77d36d59fa931f99c3fe2a969b0e5471f08249ad..dce513339f0303c18f8686bd69ab89fc7b8588ad 100644 (file)
@@ -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() {
                        '</div>'
                );
 
+               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();
        });
index 3f9cc61da5d3f0f89b79510780d318cd56952d2d..49bca5680010e74dea33b69c1b35a2ef47e8a0c9 100644 (file)
@@ -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;