@@ -68,8 +68,6 @@ describe('calculated data and points', function() {
68
68
69
69
describe ( 'domain alphanumerical category ordering' , function ( ) {
70
70
71
- // TODO augment test cases with selection on the DOM to ensure that ticks are there in proper order
72
-
73
71
it ( 'should output categories in ascending domain alphanumerical order' , function ( ) {
74
72
75
73
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , { xaxis : {
@@ -223,8 +221,6 @@ describe('calculated data and points', function() {
223
221
224
222
it ( 'should output categories in explicitly supplied order even if some missing categories were at the beginning or end of categorylist' , function ( ) {
225
223
226
- // The auto-range feature currently eliminates unutilized category ticks on the left/right edge
227
-
228
224
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , { xaxis : {
229
225
type : 'category' ,
230
226
categorymode : 'array' ,
@@ -236,6 +232,14 @@ describe('calculated data and points', function() {
236
232
expect ( gd . calcdata [ 0 ] [ 2 ] ) . toEqual ( jasmine . objectContaining ( { x : 6 , y : 12 } ) ) ;
237
233
expect ( gd . calcdata [ 0 ] [ 3 ] ) . toEqual ( jasmine . objectContaining ( { x : 1 , y : 13 } ) ) ;
238
234
expect ( gd . calcdata [ 0 ] [ 4 ] ) . toEqual ( jasmine . objectContaining ( { x : 4 , y : 14 } ) ) ;
235
+
236
+ // The auto-range feature currently eliminates unused category ticks on the left/right axis tails.
237
+ // The below test case reifies this current behavior, and checks proper order of categories kept.
238
+
239
+ var domTickTexts = Array . prototype . slice . call ( document . querySelectorAll ( 'g.xtick' ) )
240
+ . map ( function ( e ) { return e . __data__ . text ; } ) ;
241
+
242
+ expect ( domTickTexts ) . toEqual ( [ 'b' , 'x' , 'a' , 'd' , 'z' , 'e' , 'c' ] ) ; // y, q and k has no data points
239
243
} ) ;
240
244
241
245
it ( 'should output categories in explicitly supplied order even if some missing categories were at the beginning or end of categorylist' , function ( ) {
@@ -255,6 +259,11 @@ describe('calculated data and points', function() {
255
259
expect ( gd . calcdata [ 0 ] [ 2 ] ) . toEqual ( jasmine . objectContaining ( { x : 6 , y : 12 } ) ) ;
256
260
expect ( gd . calcdata [ 0 ] [ 3 ] ) . toEqual ( jasmine . objectContaining ( { x : 1 , y : 13 } ) ) ;
257
261
expect ( gd . calcdata [ 0 ] [ 4 ] ) . toEqual ( jasmine . objectContaining ( { x : 4 , y : 14 } ) ) ;
262
+
263
+ var domTickTexts = Array . prototype . slice . call ( document . querySelectorAll ( 'g.xtick' ) )
264
+ . map ( function ( e ) { return e . __data__ . text ; } ) ;
265
+
266
+ expect ( domTickTexts ) . toEqual ( [ 'y' , 'b' , 'x' , 'a' , 'd' , 'z' , 'e' , 'c' ] ) ; // q, k has no data; y is null
258
267
} ) ;
259
268
260
269
it ( 'should output categories in explicitly supplied order even if not all categories are present, and should interact with a null value orthogonally' , function ( ) {
0 commit comments