Skip to content

Commit ad338c2

Browse files
committed
Add more debug code
1 parent 3f94db5 commit ad338c2

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

test/jasmine/tests/scatter3d_test.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ describe('Test scatter3d interactions:', function() {
178178
});
179179

180180
fit('@gl should be able to toggle visibility', function(done) {
181+
var originalOnerror = window.onerror;
182+
window.onerror = function(msg, src, line, col, err) {
183+
console.error('Uncaught error during toggle visibility test:',
184+
msg, 'at', src + ':' + line + ':' + col,
185+
err && err.stack ? '\nStack: ' + err.stack : ''
186+
);
187+
return false;
188+
};
189+
var cleanup = function(x) { window.onerror = originalOnerror; return x; };
190+
181191
var _mock = Lib.extendDeep({}, mock2);
182192
_mock.data[0].x = [0, 1, 3];
183193
_mock.data[0].y = [0, 1, 2];
@@ -195,17 +205,24 @@ describe('Test scatter3d interactions:', function() {
195205
var order0 = [0, 0, 0, 0, 0, 1, 2];
196206

197207
function assertObjects(expected) {
198-
var scene = gd._fullLayout.scene;
208+
var fullLayout = gd._fullLayout;
209+
var scene = fullLayout && fullLayout.scene;
199210
var _scene = scene && scene._scene;
200211
var glplot = _scene && _scene.glplot;
201212
var objects = glplot && glplot.objects;
202213
console.log('assertObjects debug:',
214+
'fullLayout:', !!fullLayout,
203215
'scene:', !!scene,
204216
'_scene:', !!_scene,
205217
'glplot:', !!glplot,
206218
'objects:', objects,
207219
'objects type:', Object.prototype.toString.call(objects)
208220
);
221+
if(!objects) {
222+
fail('assertObjects: glplot.objects is not available (fullLayout=' + !!fullLayout +
223+
', scene=' + !!scene + ', _scene=' + !!_scene + ', glplot=' + !!glplot + ')');
224+
return;
225+
}
209226
var actual = objects.map(function(o) {
210227
return o._trace.data.index;
211228
});
@@ -248,6 +265,7 @@ describe('Test scatter3d interactions:', function() {
248265
.then(function() {
249266
assertObjects(order0);
250267
})
268+
.then(cleanup, cleanup)
251269
.then(done, done.fail);
252270
});
253271

0 commit comments

Comments
 (0)