From d60b241f34a59f61c8887a74b50ce34e4482e78a Mon Sep 17 00:00:00 2001 From: plainheart Date: Sun, 29 Sep 2024 10:30:32 +0800 Subject: [PATCH] test(sankey): tweak test case --- test/sankey.html | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/test/sankey.html b/test/sankey.html index 558dc4af37..7b6205d108 100644 --- a/test/sankey.html +++ b/test/sankey.html @@ -182,8 +182,16 @@ require([ 'echarts', ], function (echarts) { - + var title = 'The sankey chart should be rendered without any error in console when `**nodes**` or `**links**` is set as `**undefined**`'; var option = { + title: { + text: title, + top: 'center', + left: 'center', + textStyle: { + overflow: 'break' + } + }, series: [{ type: 'sankey', layout: 'none', @@ -194,12 +202,21 @@ } var chart = testHelper.create(echarts, 'main3', { - title: 'The sankey chart should be rendered without any error in console when `**nodes**` or `**links**` is set as `**undefined**`', - option: option + title, + option }); - if (chart) { - window.addEventListener('resize', chart.resize); - } + var resizeChart = function () { + chart.resize(); + chart.setOption({ + title: { + textStyle: { + width: chart.getWidth() * 0.8 + } + } + }); + }; + resizeChart(); + window.addEventListener('resize', resizeChart); });