@@ -144,7 +144,7 @@ describe('Bar.supplyDefaults', function() {
144144 } ) ;
145145} ) ;
146146
147- describe ( 'heatmap calc / setPositions' , function ( ) {
147+ describe ( 'bar calc / setPositions' , function ( ) {
148148 'use strict' ;
149149
150150 beforeAll ( function ( ) {
@@ -697,6 +697,47 @@ describe('Bar.setPositions', function() {
697697 expect ( gd . calcdata [ 1 ] [ 0 ] . placeholder ) . toBe ( true ) ;
698698 expect ( gd . calcdata [ 1 ] [ 0 ] . t . barwidth ) . toBeUndefined ( ) ;
699699 } ) ;
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+ } ) ;
700741} ) ;
701742
702743describe ( 'A bar plot' , function ( ) {
0 commit comments