diff --git a/lib/network/modules/CanvasRenderer.js b/lib/network/modules/CanvasRenderer.js index 16d39a0b4..4771687ee 100644 --- a/lib/network/modules/CanvasRenderer.js +++ b/lib/network/modules/CanvasRenderer.js @@ -13,8 +13,9 @@ * * During unit testing, it happens that the window object is reset during execution, causing * a runtime error due to missing `requestAnimationFrame()`. This needs to be compensated for, * see `_requestNextFrame()`. - * * Since this is a global object, it may affect other modules besides `Network`! This has not - * caused any problems yet. The method is only used within `Network`. + * * Since this is a global object, it may affect other modules besides `Network`. With normal + * usage, this does not cause any problems. During unit testing, errors may occur. These have + * been compensated for, see comment block in _requestNextFrame(). * * @private */ @@ -127,6 +128,9 @@ class CanvasRenderer { // 'requestAnimationFrame()' is not present because it is not defined on the // mock window object. // + // As a consequence, unrelated unit tests may appear to fail, even if the problem + // described happens in the current unit test. + // // This is not something that will happen in normal operation, but we still need // to take it into account. if (window === undefined) return; diff --git a/test/Network.test.js b/test/Network.test.js index fc476b63f..082d8e65e 100644 --- a/test/Network.test.js +++ b/test/Network.test.js @@ -236,6 +236,7 @@ describe('Network', function () { }, clusterNodeProperties: {id:"c1", label:'c1'} } + network.cluster(clusterOptionsByData); numNodes += 1; // new cluster node assertNumNodes(network, numNodes, numNodes - 3); // 3 clustered nodes @@ -273,6 +274,7 @@ describe('on node.js', function () { describe('runs example ', function () { + function loadExample(path, noPhysics) { include(path, this); var container = document.getElementById('mynetwork');