@@ -217,6 +217,46 @@ describe('Bar.supplyDefaults', function() {
217217 expect ( traceOut . insidetextfont . size ) . toBe ( 20 ) ;
218218 } ) ;
219219
220+ it ( 'should set cliponaxis to false when text has value and textposition is outside' , function ( ) {
221+ traceIn = {
222+ y : [ 1 , 2 , 3 ] ,
223+ text : [ 'A' , 'B' , 'C' ] ,
224+ textposition : 'outside'
225+ } ;
226+ supplyDefaults ( traceIn , traceOut , defaultColor , { } ) ;
227+ expect ( traceOut . cliponaxis ) . toBe ( false ) ;
228+ } ) ;
229+
230+ it ( 'should set cliponaxis to default (true) when text is not provided' , function ( ) {
231+ traceIn = {
232+ y : [ 1 , 2 , 3 ] ,
233+ textposition : 'outside'
234+ } ;
235+ supplyDefaults ( traceIn , traceOut , defaultColor , { } ) ;
236+ expect ( traceOut . cliponaxis ) . toBe ( true ) ;
237+ } ) ;
238+
239+ it ( 'should set cliponaxis to default (true) when textposition is not outside' , function ( ) {
240+ traceIn = {
241+ y : [ 1 , 2 , 3 ] ,
242+ text : [ 'A' , 'B' , 'C' ] ,
243+ textposition : 'inside'
244+ } ;
245+ supplyDefaults ( traceIn , traceOut , defaultColor , { } ) ;
246+ expect ( traceOut . cliponaxis ) . toBe ( true ) ;
247+ } ) ;
248+
249+ it ( 'should respect explicit cliponaxis setting even with text and outside position' , function ( ) {
250+ traceIn = {
251+ y : [ 1 , 2 , 3 ] ,
252+ text : [ 'A' , 'B' , 'C' ] ,
253+ textposition : 'outside' ,
254+ cliponaxis : true
255+ } ;
256+ supplyDefaults ( traceIn , traceOut , defaultColor , { } ) ;
257+ expect ( traceOut . cliponaxis ) . toBe ( true ) ;
258+ } ) ;
259+
220260 it ( 'should inherit layout.calendar' , function ( ) {
221261 traceIn = {
222262 x : [ 1 , 2 , 3 ] ,
0 commit comments