@@ -144,7 +144,7 @@ describe('Bar.supplyDefaults', function() {
144
144
} ) ;
145
145
} ) ;
146
146
147
- describe ( 'heatmap calc / setPositions' , function ( ) {
147
+ describe ( 'bar calc / setPositions' , function ( ) {
148
148
'use strict' ;
149
149
150
150
beforeAll ( function ( ) {
@@ -697,6 +697,47 @@ describe('Bar.setPositions', function() {
697
697
expect ( gd . calcdata [ 1 ] [ 0 ] . placeholder ) . toBe ( true ) ;
698
698
expect ( gd . calcdata [ 1 ] [ 0 ] . t . barwidth ) . toBeUndefined ( ) ;
699
699
} ) ;
700
+
701
+ it ( 'works with log axes (grouped bars)' , function ( ) {
702
+ var gd = mockBarPlot ( [
703
+ { y : [ 1 , 10 , 1e10 , - 1 ] } ,
704
+ { y : [ 2 , 20 , 2e10 , - 2 ] }
705
+ ] , {
706
+ yaxis : { type : 'log' } ,
707
+ barmode : 'group'
708
+ } ) ;
709
+
710
+ var ya = gd . _fullLayout . yaxis ;
711
+ expect ( Axes . getAutoRange ( ya ) ) . toBeCloseToArray ( [ - 0.572 , 10.873 ] , undefined , '(ya.range)' ) ;
712
+ } ) ;
713
+
714
+ it ( 'works with log axes (stacked bars)' , function ( ) {
715
+ var gd = mockBarPlot ( [
716
+ { y : [ 1 , 10 , 1e10 , - 1 ] } ,
717
+ { y : [ 2 , 20 , 2e10 , - 2 ] }
718
+ ] , {
719
+ yaxis : { type : 'log' } ,
720
+ barmode : 'stack'
721
+ } ) ;
722
+
723
+ var ya = gd . _fullLayout . yaxis ;
724
+ expect ( Axes . getAutoRange ( ya ) ) . toBeCloseToArray ( [ - 0.582 , 11.059 ] , undefined , '(ya.range)' ) ;
725
+ } ) ;
726
+
727
+ it ( 'works with log axes (normalized bars)' , function ( ) {
728
+ // strange case... but it should work!
729
+ var gd = mockBarPlot ( [
730
+ { y : [ 1 , 10 , 1e10 , - 1 ] } ,
731
+ { y : [ 2 , 20 , 2e10 , - 2 ] }
732
+ ] , {
733
+ yaxis : { type : 'log' } ,
734
+ barmode : 'stack' ,
735
+ barnorm : 'percent'
736
+ } ) ;
737
+
738
+ var ya = gd . _fullLayout . yaxis ;
739
+ expect ( Axes . getAutoRange ( ya ) ) . toBeCloseToArray ( [ 1.496 , 2.027 ] , undefined , '(ya.range)' ) ;
740
+ } ) ;
700
741
} ) ;
701
742
702
743
describe ( 'A bar plot' , function ( ) {
0 commit comments