@@ -5,6 +5,7 @@ var Lib = require('@src/lib');
5
5
6
6
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
7
7
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
8
+ var customMatchers = require ( '../assets/custom_matchers' ) ;
8
9
9
10
10
11
describe ( 'Test plot structure' , function ( ) {
@@ -97,32 +98,44 @@ describe('Test plot structure', function() {
97
98
} ) ;
98
99
99
100
it ( 'should restore layout axes when they get deleted' , function ( done ) {
101
+ jasmine . addMatchers ( customMatchers ) ;
102
+
100
103
expect ( countScatterTraces ( ) ) . toEqual ( mock . data . length ) ;
101
104
expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
102
105
103
106
Plotly . relayout ( gd , { xaxis : null , yaxis : null } ) . then ( function ( ) {
104
107
expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
105
108
expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
109
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 4.79980 , 74.48580 ] , 4 ) ;
110
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 1.2662 , 17.67023 ] , 4 ) ;
106
111
107
112
return Plotly . relayout ( gd , 'xaxis' , null ) ;
108
113
} ) . then ( function ( ) {
109
114
expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
110
115
expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
116
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 4.79980 , 74.48580 ] , 4 ) ;
117
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 1.2662 , 17.67023 ] , 4 ) ;
111
118
112
119
return Plotly . relayout ( gd , 'xaxis' , { } ) ;
113
120
} ) . then ( function ( ) {
114
121
expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
115
122
expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
123
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 4.79980 , 74.48580 ] , 4 ) ;
124
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 1.2662 , 17.67023 ] , 4 ) ;
116
125
117
126
return Plotly . relayout ( gd , 'yaxis' , null ) ;
118
127
} ) . then ( function ( ) {
119
128
expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
120
129
expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
130
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 4.79980 , 74.48580 ] , 4 ) ;
131
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 1.2662 , 17.67023 ] , 4 ) ;
121
132
122
133
return Plotly . relayout ( gd , 'yaxis' , { } ) ;
123
134
} ) . then ( function ( ) {
124
135
expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
125
136
expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
137
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 4.79980 , 74.48580 ] , 4 ) ;
138
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 1.2662 , 17.67023 ] , 4 ) ;
126
139
127
140
done ( ) ;
128
141
} ) ;
0 commit comments