1- var PlotlyInternal = require ( '@src/plotly ' ) ;
1+ var Plotly = require ( '@lib ' ) ;
22
33var hasWebGLSupport = require ( '../assets/has_webgl_support' ) ;
44
@@ -18,7 +18,7 @@ describe('date axis', function() {
1818 afterEach ( destroyGraphDiv ) ;
1919
2020 it ( 'should use the fancy gl-vis/gl-scatter2d' , function ( ) {
21- PlotlyInternal . plot ( gd , [ {
21+ Plotly . plot ( gd , [ {
2222 type : 'scattergl' ,
2323 'marker' : {
2424 'color' : 'rgb(31, 119, 180)' ,
@@ -38,11 +38,13 @@ describe('date axis', function() {
3838 expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
3939
4040 // one way of check which renderer - fancy vs not - we're using
41- expect ( gd . _fullLayout . _plots . xy . _scene2d . glplot . objects [ 3 ] . pointCount ) . toBe ( 0 ) ;
41+ var objs = gd . _fullLayout . _plots . xy . _scene2d . glplot . objects ;
42+ expect ( objs . length ) . toEqual ( 2 ) ;
43+ expect ( objs [ 1 ] . points . length ) . toEqual ( 4 ) ;
4244 } ) ;
4345
4446 it ( 'should use the fancy gl-vis/gl-scatter2d once again' , function ( ) {
45- PlotlyInternal . plot ( gd , [ {
47+ Plotly . plot ( gd , [ {
4648 type : 'scattergl' ,
4749 'marker' : {
4850 'color' : 'rgb(31, 119, 180)' ,
@@ -62,11 +64,13 @@ describe('date axis', function() {
6264 expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
6365
6466 // one way of check which renderer - fancy vs not - we're using
65- expect ( gd . _fullLayout . _plots . xy . _scene2d . glplot . objects [ 3 ] . pointCount ) . toBe ( 0 ) ;
67+ var objs = gd . _fullLayout . _plots . xy . _scene2d . glplot . objects ;
68+ expect ( objs . length ) . toEqual ( 2 ) ;
69+ expect ( objs [ 1 ] . points . length ) . toEqual ( 4 ) ;
6670 } ) ;
6771
6872 it ( 'should now use the non-fancy gl-vis/gl-scatter2d' , function ( ) {
69- PlotlyInternal . plot ( gd , [ {
73+ Plotly . plot ( gd , [ {
7074 type : 'scattergl' ,
7175 mode : 'markers' , // important, as otherwise lines are assumed (which needs fancy)
7276 x : [ new Date ( '2016-10-10' ) , new Date ( '2016-10-11' ) ] ,
@@ -78,11 +82,13 @@ describe('date axis', function() {
7882 expect ( gd . _fullData [ 0 ] . type ) . toBe ( 'scattergl' ) ;
7983 expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
8084
81- expect ( gd . _fullLayout . _plots . xy . _scene2d . glplot . objects [ 3 ] . pointCount ) . toBe ( 2 ) ;
85+ var objs = gd . _fullLayout . _plots . xy . _scene2d . glplot . objects ;
86+ expect ( objs . length ) . toEqual ( 1 ) ;
87+ expect ( objs [ 0 ] . pointCount ) . toEqual ( 2 ) ;
8288 } ) ;
8389
8490 it ( 'should use the non-fancy gl-vis/gl-scatter2d with string dates' , function ( ) {
85- PlotlyInternal . plot ( gd , [ {
91+ Plotly . plot ( gd , [ {
8692 type : 'scattergl' ,
8793 mode : 'markers' , // important, as otherwise lines are assumed (which needs fancy)
8894 x : [ '2016-10-10' , '2016-10-11' ] ,
@@ -94,6 +100,8 @@ describe('date axis', function() {
94100 expect ( gd . _fullData [ 0 ] . type ) . toBe ( 'scattergl' ) ;
95101 expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
96102
97- expect ( gd . _fullLayout . _plots . xy . _scene2d . glplot . objects [ 3 ] . pointCount ) . toBe ( 2 ) ;
103+ var objs = gd . _fullLayout . _plots . xy . _scene2d . glplot . objects ;
104+ expect ( objs . length ) . toEqual ( 1 ) ;
105+ expect ( objs [ 0 ] . pointCount ) . toEqual ( 2 ) ;
98106 } ) ;
99107} ) ;
0 commit comments