Ovilia commented on code in PR #20857: URL: https://github.com/apache/echarts/pull/20857#discussion_r2020627290
########## test/axis-break.html: ########## @@ -102,34 +123,58 @@ buttons: [{ text: 'Revert Break Axis', onclick: function (event) { - chart.dispatchAction({type: 'axisBreakRevert'}); + chart.dispatchAction({ + type: 'updateAxisBreak', + yAxisIndex: 'all', + breaks: initialAxisBreaks + }); } }, { - text: 'Expand Break Axis 100~2300', + text: 'Expand Break Axis ' + initialAxisBreaks[0].start + '~' + initialAxisBreaks[0].end, onclick: function (event) { chart.dispatchAction({ - type: 'axisBreakExpand', + type: 'updateAxisBreak', + yAxisIndex: 'all', breaks: [{ - start: 100, - end: 2300 + start: initialAxisBreaks[0].start, + end: initialAxisBreaks[0].end, + isExpanded: true, }] }); } }] }); - chart.on('axisBreakExpanded', function (params) { - console.log('axisBreakExpanded', params); - }); - - chart.on('axisBreakReverted', function (params) { - console.log('axisBreakReverted', params); - }); + if (chart) { + chart.on('axisBreakUpdated', function (params) { + console.log('axisBreakUpdated', params); + if (!params.breaks || params.breaks.length !== 1) { + throw new Error('test failed'); + } + if ( + !(params.breaks[0].start === initialAxisBreaks[0].start + && params.breaks[0].end === initialAxisBreaks[0].end + ) + && !(params.breaks[0].start === initialAxisBreaks[1].start + && params.breaks[0].end === initialAxisBreaks[1].end + ) + ) { + throw new Error('test failed'); + } + if (params.breaks[0].isExpanded !== true + && params.breaks[0].isExpanded !== false + ) { + throw new Error('test failed'); + } + if (params.yAxisIndex !== 0) { + throw new Error('test failed'); Review Comment: It's `'all'` when click the second button. I guess this assumpting only works when interacts with the chart, instead of clicking the button, right? Will it bring misunderstanding when running this test case in the future? Similar with the revert button. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org