@@ -2694,28 +2694,35 @@ describe('Cartesian taces with zindex', function() {
2694
2694
. then ( done , done . fail ) ;
2695
2695
} ) ;
2696
2696
2697
- it ( 'should display bar traces in ascending order' , function ( done ) {
2698
- Plotly . newPlot ( gd , fig ( barData ) )
2699
- . then ( function ( ) {
2700
- var data = gd . _fullData ;
2701
- assertZIndices ( data , barData ) ;
2702
- var tracesData = d3SelectAll ( 'g[class^="barlayer"]' ) ;
2703
- assertZIndicesSorted ( tracesData [ 0 ] ) ;
2704
- } )
2705
- . then ( function ( ) {
2706
- return Plotly . restyle ( gd , 'barmode' , 'overlay' ) ;
2707
- } )
2708
- . then ( function ( ) {
2709
- var tracesData = d3SelectAll ( 'g[class^="barlayer"]' ) ;
2710
- assertZIndicesSorted ( tracesData [ 0 ] ) ;
2711
- } )
2712
- . then ( function ( ) {
2713
- return Plotly . restyle ( gd , 'barmode' , 'stack' ) ;
2714
- } )
2715
- . then ( function ( ) {
2716
- var tracesData = d3SelectAll ( 'g[class^="barlayer"]' ) ;
2717
- assertZIndicesSorted ( tracesData [ 0 ] ) ;
2718
- } )
2719
- . then ( done , done . fail ) ;
2697
+ [ 'bar' , 'waterfall' , 'funnel' ] . forEach ( function ( traceType ) {
2698
+ it ( 'should display ' + traceType + ' traces in ascending order' , function ( done ) {
2699
+ var _Data = [
2700
+ { x : [ 1 , 2 ] , y : [ 2 , 4 ] , type : traceType } ,
2701
+ { x : [ 1 , 2 ] , y : [ 4 , 2 ] , type : traceType , zindex : - 10 }
2702
+ ] ;
2703
+ var _Class = 'g[class^="' + traceType + 'layer"]' ;
2704
+ Plotly . newPlot ( gd , fig ( _Data ) )
2705
+ . then ( function ( ) {
2706
+ var data = gd . _fullData ;
2707
+ assertZIndices ( data , _Data ) ;
2708
+ var tracesData = d3SelectAll ( _Class ) ;
2709
+ assertZIndicesSorted ( tracesData [ 0 ] ) ;
2710
+ } )
2711
+ . then ( function ( ) {
2712
+ return Plotly . restyle ( gd , 'barmode' , 'overlay' ) ;
2713
+ } )
2714
+ . then ( function ( ) {
2715
+ var tracesData = d3SelectAll ( _Class ) ;
2716
+ assertZIndicesSorted ( tracesData [ 0 ] ) ;
2717
+ } )
2718
+ . then ( function ( ) {
2719
+ return Plotly . restyle ( gd , 'barmode' , 'stack' ) ;
2720
+ } )
2721
+ . then ( function ( ) {
2722
+ var tracesData = d3SelectAll ( _Class ) ;
2723
+ assertZIndicesSorted ( tracesData [ 0 ] ) ;
2724
+ } )
2725
+ . then ( done , done . fail ) ;
2726
+ } ) ;
2720
2727
} ) ;
2721
2728
} ) ;
0 commit comments