@@ -7,6 +7,7 @@ var Lib = require('@src/lib');
7
7
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
8
8
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
9
9
var selectButton = require ( '../assets/modebar_button' ) ;
10
+ var customMatchers = require ( '../assets/custom_matchers' ) ;
10
11
11
12
/*
12
13
* WebGL interaction test cases fail on the CircleCI
@@ -18,6 +19,10 @@ var selectButton = require('../assets/modebar_button');
18
19
describe ( 'Test plot structure' , function ( ) {
19
20
'use strict' ;
20
21
22
+ beforeEach ( function ( ) {
23
+ jasmine . addMatchers ( customMatchers ) ;
24
+ } ) ;
25
+
21
26
afterEach ( destroyGraphDiv ) ;
22
27
23
28
describe ( 'gl3d plots' , function ( ) {
@@ -148,7 +153,7 @@ describe('Test plot structure', function() {
148
153
149
154
describe ( 'buttons resetCameraDefault3d and resetCameraLastSave3d' , function ( ) {
150
155
// changes in scene objects are not instantaneous
151
- var DELAY = 1000 ;
156
+ var DELAY = 200 ;
152
157
153
158
it ( 'should update the scene camera' , function ( done ) {
154
159
var sceneLayout = gd . _fullLayout . scene ,
@@ -166,22 +171,22 @@ describe('Test plot structure', function() {
166
171
expect ( sceneLayout . camera . eye )
167
172
. toEqual ( { x : 0.1 , y : 0.1 , z : 1 } , 'does not change the layout objects' ) ;
168
173
expect ( scene . camera . eye )
169
- . toEqual ( [ 1.2500000000000002 , 1.25 , 1.25 ] ) ;
174
+ . toBeCloseToArray ( [ 1.25 , 1.25 , 1.25 ] , 4 ) ;
170
175
expect ( sceneLayout2 . camera . eye )
171
176
. toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } , 'does not change the layout objects' ) ;
172
177
expect ( scene2 . camera . eye )
173
- . toEqual ( [ 1.2500000000000002 , 1.25 , 1.25 ] ) ;
178
+ . toBeCloseToArray ( [ 1.25 , 1.25 , 1.25 ] , 4 ) ;
174
179
175
180
selectButton ( modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
176
181
setTimeout ( function ( ) {
177
182
expect ( sceneLayout . camera . eye )
178
183
. toEqual ( { x : 0.1 , y : 0.1 , z : 1 } , 'does not change the layout objects' ) ;
179
184
expect ( scene . camera . eye )
180
- . toEqual ( [ 0.10000000000000016 , 0.10000000000000016 , 1 ] ) ;
185
+ . toBeCloseToArray ( [ 0.1 , 0.1 , 1 ] , 4 ) ;
181
186
expect ( sceneLayout2 . camera . eye )
182
187
. toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } , 'does not change the layout objects' ) ;
183
188
expect ( scene2 . camera . eye )
184
- . toEqual ( [ 2.500000000000001 , 2.5000000000000004 , 2.5000000000000004 ] ) ;
189
+ . toBeCloseToArray ( [ 2.5 , 2.5 , 2.5 ] , 4 ) ;
185
190
186
191
done ( ) ;
187
192
} , DELAY ) ;
0 commit comments