@@ -1031,6 +1031,53 @@ QUnit.test('Set the visualRange option by the different ways', function(assert)
10311031 assert . deepEqual ( chart . option ( 'valueAxis._customVisualRange' ) , { length : 2 } ) ;
10321032} ) ;
10331033
1034+ QUnit . test ( 'visualRangeUpdateMode change should not corrupt _customVisualRange causing incorrect visualRange on subsequent axis rerender (T1315301)' , function ( assert ) {
1035+ this . $container . css ( { width : '1000px' , height : '600px' } ) ;
1036+ const dataSource = [ {
1037+ arg : 1 ,
1038+ val : 4
1039+ } , {
1040+ arg : 2 ,
1041+ val : 5
1042+ } , {
1043+ arg : 5 ,
1044+ val : 7
1045+ } , {
1046+ arg : 8 ,
1047+ val : 3
1048+ } , {
1049+ arg : 11 ,
1050+ val : 8
1051+ } ] ;
1052+
1053+ const chart = this . createChart ( {
1054+ size : {
1055+ width : 1000 ,
1056+ height : 600
1057+ } ,
1058+ dataSource : dataSource ,
1059+ series : { type : 'bar' } ,
1060+ valueAxis : {
1061+ visualRangeUpdateMode : 'auto' ,
1062+ }
1063+ } ) ;
1064+
1065+ const initialVisualRange = chart . option ( 'valueAxis.visualRange' ) ;
1066+
1067+ chart . option ( 'valueAxis.visualRangeUpdateMode' , 'keep' ) ;
1068+
1069+ assert . strictEqual ( chart . option ( 'valueAxis.visualRangeUpdateMode' ) , 'keep' , 'visualRangeUpdateMode has changed to "keep"' ) ;
1070+ assert . deepEqual ( chart . option ( 'valueAxis.visualRange' ) , initialVisualRange , 'visualRange remains unchanged' ) ;
1071+ assert . deepEqual ( chart . option ( 'valueAxis._customVisualRange' ) , undefined , '_customVisualRange not set' ) ;
1072+
1073+ chart . option ( 'commonAxisSettings.title' , 'custom' ) ;
1074+
1075+ assert . strictEqual ( chart . option ( 'valueAxis.visualRangeUpdateMode' ) , 'keep' , 'visualRangeUpdateMode is still "keep" after rerender' ) ;
1076+ assert . strictEqual ( chart . option ( 'commonAxisSettings.title' ) , 'custom' , 'commonAxisSettings.title was successfully changed' ) ;
1077+ assert . deepEqual ( chart . option ( 'valueAxis.visualRange' ) , initialVisualRange , 'visualRange remains correct after axis rerender' ) ;
1078+ assert . deepEqual ( chart . option ( 'valueAxis._customVisualRange' ) , undefined , '_customVisualRange not set' ) ;
1079+ } ) ;
1080+
10341081QUnit . test ( 'Reload dataSource - visualRange option should be changed' , function ( assert ) {
10351082 this . $container . css ( { width : '1000px' , height : '600px' } ) ;
10361083 const visualRangeChanged = sinon . spy ( ) ;
0 commit comments