@@ -59,7 +59,7 @@ describe('Test mesh3d', function() {
5959 } ) ;
6060 } ) ;
6161
62- describe ( 'dimension and expected visibility tests' , function ( ) {
62+ describe ( 'dimension and expected visibility check and cell/position tests' , function ( ) {
6363 var gd ;
6464
6565 beforeEach ( function ( ) {
@@ -76,6 +76,14 @@ describe('Test mesh3d', function() {
7676 expect ( gd . _fullData [ 0 ] . visible ) . toBe ( exp , msg ) ;
7777 }
7878
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+
7987 it ( '@gl mesh3d should be visible when the indices are not integer' , function ( done ) {
8088 Plotly . plot ( gd , [ {
8189 x : [ 0 , 1 , 0.5 , 0.5 ] ,
@@ -89,6 +97,12 @@ describe('Test mesh3d', function() {
8997 . then ( function ( ) {
9098 assertVisibility ( true , 'to be visible' ) ;
9199 } )
100+ . then ( function ( ) {
101+ assertPositions ( true , 'not to be false' ) ;
102+ } )
103+ . then ( function ( ) {
104+ assertCells ( true , 'not to be false' ) ;
105+ } )
92106 . catch ( failTest )
93107 . then ( done ) ;
94108 } ) ;
@@ -106,6 +120,12 @@ describe('Test mesh3d', function() {
106120 . then ( function ( ) {
107121 assertVisibility ( true , 'to be visible' ) ;
108122 } )
123+ . then ( function ( ) {
124+ assertPositions ( true , 'not to be false' ) ;
125+ } )
126+ . then ( function ( ) {
127+ assertCells ( true , 'not to be false' ) ;
128+ } )
109129 . catch ( failTest )
110130 . then ( done ) ;
111131 } ) ;
@@ -123,6 +143,12 @@ describe('Test mesh3d', function() {
123143 . then ( function ( ) {
124144 assertVisibility ( true , 'to be visible' ) ;
125145 } )
146+ . then ( function ( ) {
147+ assertPositions ( true , 'not to be false' ) ;
148+ } )
149+ . then ( function ( ) {
150+ assertCells ( true , 'not to be false' ) ;
151+ } )
126152 . catch ( failTest )
127153 . then ( done ) ;
128154 } ) ;
@@ -140,6 +166,12 @@ describe('Test mesh3d', function() {
140166 . then ( function ( ) {
141167 assertVisibility ( true , 'to be visible' ) ;
142168 } )
169+ . then ( function ( ) {
170+ assertPositions ( true , 'not to be false' ) ;
171+ } )
172+ . then ( function ( ) {
173+ assertCells ( true , 'not to be false' ) ;
174+ } )
143175 . catch ( failTest )
144176 . then ( done ) ;
145177 } ) ;
@@ -157,6 +189,34 @@ describe('Test mesh3d', function() {
157189 . then ( function ( ) {
158190 assertVisibility ( true , 'to be visible' ) ;
159191 } )
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+ } )
160220 . catch ( failTest )
161221 . then ( done ) ;
162222 } ) ;
@@ -174,6 +234,12 @@ describe('Test mesh3d', function() {
174234 . then ( function ( ) {
175235 assertVisibility ( true , 'to be visible' ) ;
176236 } )
237+ . then ( function ( ) {
238+ assertPositions ( true , 'not to be false' ) ;
239+ } )
240+ . then ( function ( ) {
241+ assertCells ( true , 'not to be false' ) ;
242+ } )
177243 . catch ( failTest )
178244 . then ( done ) ;
179245 } ) ;
@@ -188,11 +254,17 @@ describe('Test mesh3d', function() {
188254 . then ( function ( ) {
189255 assertVisibility ( true , 'to be visible' ) ;
190256 } )
257+ . then ( function ( ) {
258+ assertPositions ( true , 'not to be false' ) ;
259+ } )
260+ . then ( function ( ) {
261+ assertCells ( true , 'not to be false' ) ;
262+ } )
191263 . catch ( failTest )
192264 . then ( done ) ;
193265 } ) ;
194266
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 ) {
196268 Plotly . plot ( gd , [ {
197269 x : [ ] ,
198270 y : [ ] ,
@@ -202,21 +274,22 @@ describe('Test mesh3d', function() {
202274 . then ( function ( ) {
203275 assertVisibility ( true , 'not to be visible' ) ;
204276 } )
277+ . then ( function ( ) {
278+ assertPositions ( true , 'not to be false' ) ;
279+ } )
280+ . then ( function ( ) {
281+ assertCells ( true , 'not to be false' ) ;
282+ } )
205283 . catch ( failTest )
206284 . then ( done ) ;
207285 } ) ;
208286
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 ) {
210288 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' ] ,
217289 type : 'mesh3d'
218- } ] ) . then ( function ( ) {
219- assertVisibility ( true , 'not to be visible' ) ;
290+ } ] )
291+ . then ( function ( ) {
292+ assertVisibility ( false , 'to be visible' ) ;
220293 } )
221294 . catch ( failTest )
222295 . then ( done ) ;
0 commit comments