@@ -59,7 +59,7 @@ describe('Test mesh3d', function() {
59
59
} ) ;
60
60
} ) ;
61
61
62
- describe ( 'dimension and expected visibility tests' , function ( ) {
62
+ describe ( 'dimension and expected visibility check and cell/position tests' , function ( ) {
63
63
var gd ;
64
64
65
65
beforeEach ( function ( ) {
@@ -76,6 +76,14 @@ describe('Test mesh3d', function() {
76
76
expect ( gd . _fullData [ 0 ] . visible ) . toBe ( exp , msg ) ;
77
77
}
78
78
79
+ function assertPositions ( exp , msg ) {
80
+ expect ( gd . _fullLayout . scene . _scene . glplot . objects [ 0 ] . positions . length !== undefined ) . toBe ( exp , msg ) ;
81
+ }
82
+
83
+ function assertCells ( exp , msg ) {
84
+ expect ( gd . _fullLayout . scene . _scene . glplot . objects [ 0 ] . cells . length !== undefined ) . toBe ( exp , msg ) ;
85
+ }
86
+
79
87
it ( '@gl mesh3d should be visible when the indices are not integer' , function ( done ) {
80
88
Plotly . plot ( gd , [ {
81
89
x : [ 0 , 1 , 0.5 , 0.5 ] ,
@@ -89,6 +97,12 @@ describe('Test mesh3d', function() {
89
97
. then ( function ( ) {
90
98
assertVisibility ( true , 'to be visible' ) ;
91
99
} )
100
+ . then ( function ( ) {
101
+ assertPositions ( true , 'not to be false' ) ;
102
+ } )
103
+ . then ( function ( ) {
104
+ assertCells ( true , 'not to be false' ) ;
105
+ } )
92
106
. catch ( failTest )
93
107
. then ( done ) ;
94
108
} ) ;
@@ -106,6 +120,12 @@ describe('Test mesh3d', function() {
106
120
. then ( function ( ) {
107
121
assertVisibility ( true , 'to be visible' ) ;
108
122
} )
123
+ . then ( function ( ) {
124
+ assertPositions ( true , 'not to be false' ) ;
125
+ } )
126
+ . then ( function ( ) {
127
+ assertCells ( true , 'not to be false' ) ;
128
+ } )
109
129
. catch ( failTest )
110
130
. then ( done ) ;
111
131
} ) ;
@@ -123,6 +143,12 @@ describe('Test mesh3d', function() {
123
143
. then ( function ( ) {
124
144
assertVisibility ( true , 'to be visible' ) ;
125
145
} )
146
+ . then ( function ( ) {
147
+ assertPositions ( true , 'not to be false' ) ;
148
+ } )
149
+ . then ( function ( ) {
150
+ assertCells ( true , 'not to be false' ) ;
151
+ } )
126
152
. catch ( failTest )
127
153
. then ( done ) ;
128
154
} ) ;
@@ -140,6 +166,12 @@ describe('Test mesh3d', function() {
140
166
. then ( function ( ) {
141
167
assertVisibility ( true , 'to be visible' ) ;
142
168
} )
169
+ . then ( function ( ) {
170
+ assertPositions ( true , 'not to be false' ) ;
171
+ } )
172
+ . then ( function ( ) {
173
+ assertCells ( true , 'not to be false' ) ;
174
+ } )
143
175
. catch ( failTest )
144
176
. then ( done ) ;
145
177
} ) ;
@@ -157,6 +189,34 @@ describe('Test mesh3d', function() {
157
189
. then ( function ( ) {
158
190
assertVisibility ( true , 'to be visible' ) ;
159
191
} )
192
+ . then ( function ( ) {
193
+ assertPositions ( true , 'not to be false' ) ;
194
+ } )
195
+ . then ( function ( ) {
196
+ assertCells ( true , 'not to be false' ) ;
197
+ } )
198
+ . catch ( failTest )
199
+ . then ( done ) ;
200
+ } ) ;
201
+
202
+ it ( '@gl mesh3d should be visible when values are passed in string format' , function ( done ) {
203
+ Plotly . plot ( gd , [ {
204
+ x : [ '0' , '1' , '0.5' , '0.5' ] ,
205
+ y : [ '0' , '0.5' , '1' , '0.5' ] ,
206
+ z : [ '0' , '0.5' , '0.5' , '1' ] ,
207
+ i : [ '0' , '0' , '0' , '1' ] ,
208
+ j : [ '1' , '1' , '2' , '2' ] ,
209
+ k : [ '2' , '3' , '3' , '3' ] ,
210
+ type : 'mesh3d'
211
+ } ] ) . then ( function ( ) {
212
+ assertVisibility ( true , 'not to be visible' ) ;
213
+ } )
214
+ . then ( function ( ) {
215
+ assertPositions ( true , 'not to be false' ) ;
216
+ } )
217
+ . then ( function ( ) {
218
+ assertCells ( true , 'not to be false' ) ;
219
+ } )
160
220
. catch ( failTest )
161
221
. then ( done ) ;
162
222
} ) ;
@@ -174,6 +234,12 @@ describe('Test mesh3d', function() {
174
234
. then ( function ( ) {
175
235
assertVisibility ( true , 'to be visible' ) ;
176
236
} )
237
+ . then ( function ( ) {
238
+ assertPositions ( true , 'not to be false' ) ;
239
+ } )
240
+ . then ( function ( ) {
241
+ assertCells ( true , 'not to be false' ) ;
242
+ } )
177
243
. catch ( failTest )
178
244
. then ( done ) ;
179
245
} ) ;
@@ -188,11 +254,17 @@ describe('Test mesh3d', function() {
188
254
. then ( function ( ) {
189
255
assertVisibility ( true , 'to be visible' ) ;
190
256
} )
257
+ . then ( function ( ) {
258
+ assertPositions ( true , 'not to be false' ) ;
259
+ } )
260
+ . then ( function ( ) {
261
+ assertCells ( true , 'not to be false' ) ;
262
+ } )
191
263
. catch ( failTest )
192
264
. then ( done ) ;
193
265
} ) ;
194
266
195
- it ( '@gl mesh3d should be visible when the vertex array are empty' , function ( done ) {
267
+ it ( '@gl mesh3d should be visible when the vertex arrays are empty' , function ( done ) {
196
268
Plotly . plot ( gd , [ {
197
269
x : [ ] ,
198
270
y : [ ] ,
@@ -202,21 +274,22 @@ describe('Test mesh3d', function() {
202
274
. then ( function ( ) {
203
275
assertVisibility ( true , 'not to be visible' ) ;
204
276
} )
277
+ . then ( function ( ) {
278
+ assertPositions ( true , 'not to be false' ) ;
279
+ } )
280
+ . then ( function ( ) {
281
+ assertCells ( true , 'not to be false' ) ;
282
+ } )
205
283
. catch ( failTest )
206
284
. then ( done ) ;
207
285
} ) ;
208
286
209
- it ( '@gl mesh3d should be visible when values are passed in string format ' , function ( done ) {
287
+ it ( '@gl mesh3d should be invisible when the vertex arrays missing ' , function ( done ) {
210
288
Plotly . plot ( gd , [ {
211
- x : [ '0' , '1' , '0.5' , '0.5' ] ,
212
- y : [ '0' , '0.5' , '1' , '0.5' ] ,
213
- z : [ '0' , '0.5' , '0.5' , '1' ] ,
214
- i : [ '0' , '0' , '0' , '1' ] ,
215
- j : [ '1' , '1' , '2' , '2' ] ,
216
- k : [ '2' , '3' , '3' , '3' ] ,
217
289
type : 'mesh3d'
218
- } ] ) . then ( function ( ) {
219
- assertVisibility ( true , 'not to be visible' ) ;
290
+ } ] )
291
+ . then ( function ( ) {
292
+ assertVisibility ( false , 'to be visible' ) ;
220
293
} )
221
294
. catch ( failTest )
222
295
. then ( done ) ;
0 commit comments