Skip to content

Commit 57b2650

Browse files
committed
#29 ensure one call per scene, checking against correct callback argument values
1 parent ff1d418 commit 57b2650

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

test/jasmine/tests/gl_plot_interact_test.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,22 @@ describe('Test gl plot interactions', function() {
350350

351351
setTimeout(function() {
352352

353-
expect(relayoutCallback).toHaveBeenCalled(); // initiator: resetCameraDefault3d
353+
expect(relayoutCallback).toHaveBeenCalledTimes(2); // initiator: resetCameraDefault3d; 2 scenes
354354
expect(relayoutCallback).toHaveBeenCalledWith({
355355
scene: {
356356
eye: { x: 1.25, y: 1.25, z: 1.25 },
357357
center: { x: 0, y: 0, z: 0 },
358358
up: { x: 0, y: 0, z: 1 }
359359
}
360360
});
361+
expect(relayoutCallback).toHaveBeenCalledWith({
362+
scene2: {
363+
center: { x: 0, y: 0, z: 0 },
364+
eye: { x: 1.25, y: 1.25, z: 1.25 },
365+
up: { x: 0, y: 0, z: 1 }
366+
}
367+
});
368+
relayoutCallback.calls.reset();
361369

362370
expect(sceneLayout.camera.eye)
363371
.toEqual({x: 0.1, y: 0.1, z: 1}, 'does not change the layout objects');
@@ -372,14 +380,21 @@ describe('Test gl plot interactions', function() {
372380

373381
setTimeout(function() {
374382

375-
expect(relayoutCallback).toHaveBeenCalled(); // initiator: resetCameraLastSave3d
383+
expect(relayoutCallback).toHaveBeenCalledTimes(2); // initiator: resetCameraLastSave3d; 2 scenes
376384
expect(relayoutCallback).toHaveBeenCalledWith({
377385
scene: {
378-
eye: { x: 1.25, y: 1.25, z: 1.25 },
379386
center: { x: 0, y: 0, z: 0 },
387+
eye: { x: 0.1, y: 0.1, z: 1 },
388+
up: { x: 0, y: 0, z: 1 }
389+
}
390+
});
391+
expect(relayoutCallback).toHaveBeenCalledWith({
392+
scene2: {
393+
center: { x: 0, y: 0, z: 0 },
394+
eye: { x: 2.5, y: 2.5, z: 2.5 },
380395
up: { x: 0, y: 0, z: 1 }
381396
}
382-
}); // looks like there's no real saved data so it reverts to default
397+
});
383398

384399
expect(sceneLayout.camera.eye)
385400
.toEqual({x: 0.1, y: 0.1, z: 1}, 'does not change the layout objects');

0 commit comments

Comments
 (0)