11var Gl3d = require ( '@src/plots/gl3d' ) ;
2- var Plots = require ( '@src/plots/plots' ) ;
32
43var tinycolor = require ( 'tinycolor2' ) ;
54var Color = require ( '@src/components/color' ) ;
@@ -14,9 +13,7 @@ describe('Test Gl3d layout defaults', function() {
1413 var supplyLayoutDefaults = Gl3d . supplyLayoutDefaults ;
1514
1615 beforeEach ( function ( ) {
17- layoutOut = {
18- _has : Plots . _hasPlotType
19- } ;
16+ layoutOut = { _basePlotModules : [ 'gl3d' ] } ;
2017
2118 // needs a scene-ref in a trace in order to be detected
2219 fullData = [ { type : 'scatter3d' , scene : 'scene' } ] ;
@@ -174,8 +171,13 @@ describe('Test Gl3d layout defaults', function() {
174171 expect ( layoutOut . scene . dragmode )
175172 . toBe ( 'orbit' , 'to user layout val if valid and 3d only' ) ;
176173
174+ layoutIn = { scene : { } , dragmode : 'invalid' } ;
175+ supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
176+ expect ( layoutOut . scene . dragmode )
177+ . toBe ( 'turntable' , 'to turntable if invalid and 3d only' ) ;
178+
177179 layoutIn = { scene : { } , dragmode : 'orbit' } ;
178- layoutOut . _basePlotModules = [ { name : 'cartesian' } ] ;
180+ layoutOut . _basePlotModules . push ( { name : 'cartesian' } ) ;
179181 supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
180182 expect ( layoutOut . scene . dragmode )
181183 . toBe ( 'turntable' , 'to default if not 3d only' ) ;
@@ -202,8 +204,13 @@ describe('Test Gl3d layout defaults', function() {
202204 expect ( layoutOut . scene . hovermode )
203205 . toBe ( false , 'to user layout val if valid and 3d only' ) ;
204206
207+ layoutIn = { scene : { } , hovermode : 'invalid' } ;
208+ supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
209+ expect ( layoutOut . scene . hovermode )
210+ . toBe ( 'closest' , 'to closest if invalid and 3d only' ) ;
211+
205212 layoutIn = { scene : { } , hovermode : false } ;
206- layoutOut . _basePlotModules = [ { name : 'cartesian' } ] ;
213+ layoutOut . _basePlotModules . push ( { name : 'cartesian' } ) ;
207214 supplyLayoutDefaults ( layoutIn , layoutOut , fullData ) ;
208215 expect ( layoutOut . scene . hovermode )
209216 . toBe ( 'closest' , 'to default if not 3d only' ) ;
0 commit comments