1
- var PlotlyInternal = require ( '@src/plotly ' ) ;
1
+ var Plotly = require ( '@lib ' ) ;
2
2
3
3
var hasWebGLSupport = require ( '../assets/has_webgl_support' ) ;
4
4
@@ -18,7 +18,7 @@ describe('date axis', function() {
18
18
afterEach ( destroyGraphDiv ) ;
19
19
20
20
it ( 'should use the fancy gl-vis/gl-scatter2d' , function ( ) {
21
- PlotlyInternal . plot ( gd , [ {
21
+ Plotly . plot ( gd , [ {
22
22
type : 'scattergl' ,
23
23
'marker' : {
24
24
'color' : 'rgb(31, 119, 180)' ,
@@ -38,11 +38,13 @@ describe('date axis', function() {
38
38
expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
39
39
40
40
// 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 ) ;
42
44
} ) ;
43
45
44
46
it ( 'should use the fancy gl-vis/gl-scatter2d once again' , function ( ) {
45
- PlotlyInternal . plot ( gd , [ {
47
+ Plotly . plot ( gd , [ {
46
48
type : 'scattergl' ,
47
49
'marker' : {
48
50
'color' : 'rgb(31, 119, 180)' ,
@@ -62,11 +64,13 @@ describe('date axis', function() {
62
64
expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
63
65
64
66
// 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 ) ;
66
70
} ) ;
67
71
68
72
it ( 'should now use the non-fancy gl-vis/gl-scatter2d' , function ( ) {
69
- PlotlyInternal . plot ( gd , [ {
73
+ Plotly . plot ( gd , [ {
70
74
type : 'scattergl' ,
71
75
mode : 'markers' , // important, as otherwise lines are assumed (which needs fancy)
72
76
x : [ new Date ( '2016-10-10' ) , new Date ( '2016-10-11' ) ] ,
@@ -78,11 +82,13 @@ describe('date axis', function() {
78
82
expect ( gd . _fullData [ 0 ] . type ) . toBe ( 'scattergl' ) ;
79
83
expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
80
84
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 ) ;
82
88
} ) ;
83
89
84
90
it ( 'should use the non-fancy gl-vis/gl-scatter2d with string dates' , function ( ) {
85
- PlotlyInternal . plot ( gd , [ {
91
+ Plotly . plot ( gd , [ {
86
92
type : 'scattergl' ,
87
93
mode : 'markers' , // important, as otherwise lines are assumed (which needs fancy)
88
94
x : [ '2016-10-10' , '2016-10-11' ] ,
@@ -94,6 +100,8 @@ describe('date axis', function() {
94
100
expect ( gd . _fullData [ 0 ] . type ) . toBe ( 'scattergl' ) ;
95
101
expect ( gd . _fullData [ 0 ] . _module . basePlotModule . name ) . toBe ( 'gl2d' ) ;
96
102
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 ) ;
98
106
} ) ;
99
107
} ) ;
0 commit comments