summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-06 12:50:18 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-06 12:50:18 +0100
commite129f6845b8ec728455737e46cda872cc45f50c2 (patch)
treeee208db940f3a08d5ca0bbc199cd0b3b8b9d5036 /core
parent1785c0c9b9fcdc6e9a8e58f13f45e5b53364882a (diff)
downloadnextcloud-server-e129f6845b8ec728455737e46cda872cc45f50c2.tar.gz
nextcloud-server-e129f6845b8ec728455737e46cda872cc45f50c2.zip
Added testArea for JS Unit tests
Added a testArea that is outside the viewport but still considered as visible from the jQuery code. The testArea is useful when: - tested code tries to access DOM elements using global ids - tested code is requiring some UI elements to be visible to activate themselves
Diffstat (limited to 'core')
-rw-r--r--core/js/tests/specHelper.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/js/tests/specHelper.js b/core/js/tests/specHelper.js
index b1193240580..48dcb97ef76 100644
--- a/core/js/tests/specHelper.js
+++ b/core/js/tests/specHelper.js
@@ -68,9 +68,14 @@ window.oc_defaults = {};
// global setup for all tests
(function setupTests() {
var fakeServer = null,
+ $testArea = null,
routesRequestStub;
beforeEach(function() {
+ // test area for elements that need absolute selector access or measure widths/heights
+ // which wouldn't work for detached or hidden elements
+ $testArea = $('<div id="testArea" style="position: absolute; width: 1280px; height: 800px; top: -3000px; left: -3000px;"></div>');
+ $('body').append($testArea);
// enforce fake XHR, tests should not depend on the server and
// must use fake responses for expected calls
fakeServer = sinon.fakeServer.create();
@@ -101,6 +106,8 @@ window.oc_defaults = {};
// uncomment this to log requests
// console.log(window.fakeServer.requests);
fakeServer.restore();
+
+ $testArea.remove();
});
})();