You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/12/26 07:34:17 UTC
[incubator-echarts-examples] branch next updated: fix some test
issues
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-examples.git
The following commit(s) were added to refs/heads/next by this push:
new 9c93e36 fix some test issues
9c93e36 is described below
commit 9c93e36dfdbdd1c6e18eebbc4d6bcf6c7acddd4e
Author: pissang <bm...@gmail.com>
AuthorDate: Sat Dec 26 15:34:03 2020 +0800
fix some test issues
---
public/data/sankey-vertical.js | 3 ---
test/main.js | 41 ++++++++++++++++++++++++++++++------
test/{template.html => preview.html} | 3 +++
test/template.html | 2 ++
4 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/public/data/sankey-vertical.js b/public/data/sankey-vertical.js
index eb76f8e..9abcad7 100644
--- a/public/data/sankey-vertical.js
+++ b/public/data/sankey-vertical.js
@@ -6,9 +6,6 @@ difficulty: 1
*/
option = {
- color: [
- '#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'
- ],
tooltip: {
trigger: 'item',
triggerOn: 'mousemove'
diff --git a/test/main.js b/test/main.js
index 89e1693..314b726 100644
--- a/test/main.js
+++ b/test/main.js
@@ -20,6 +20,25 @@ const RUN_CODE_DIR = `${TMP_DIR}/tests`;
const BUNDLE_DIR = `${TMP_DIR}/bundles`;
const SCREENSHOTS_DIR = `${TMP_DIR}/screenshots`;
+const TEMPLATE_CODE = `
+echarts.registerPreprocessor(function (option) {
+ option.animation = false;
+ if (option.series) {
+ if (!(option.series instanceof Array)) {
+ option.series = [option.series];
+ }
+ option.series.forEach(function (seriesOpt) {
+ if (seriesOpt.type === 'graph') {
+ seriesOpt.force = seriesOpt.force || {};
+ seriesOpt.force.layoutAnimation = false;
+ }
+ seriesOpt.progressive = 1e5;
+ seriesOpt.animation = false;
+ });
+ }
+});
+`
+
async function prepare() {
fse.removeSync(TMP_DIR);
fse.removeSync(RUN_CODE_DIR);
@@ -49,8 +68,15 @@ async function buildRunCode() {
'CanvasRenderer'
]);
+ if (deps.includes('MapChart') || deps.includes('GeoComponent')) {
+ console.warn(chalk.yellow('Ignored map tests.'));
+ }
+
const legacyCode = `
${buildLegacyPartialImportCode(deps, true)}
+
+${TEMPLATE_CODE}
+
const ROOT_PATH = 'public';
const app = {};
@@ -59,11 +85,14 @@ var option;
${jsCode}
-myChart.setOption(option);
+option && myChart.setOption(option);
`;
// TODO: TS is mainly for type checking of option currently.
const tsCode = `
${buildPartialImportCode(deps, true)}
+
+${TEMPLATE_CODE}
+
const ROOT_PATH = 'public';
const app: any = {};
@@ -72,7 +101,7 @@ var option: ECOption;
${jsCode}
-myChart.setOption(option);
+option && myChart.setOption(option);
`;
const testName = nodePath.basename(fileName, '.json');
const tsFile = nodePath.join(RUN_CODE_DIR, testName + '.ts');
@@ -184,7 +213,7 @@ function webpackBundle(entry, result) {
})
}
-function esbuildBundle(entry, result) {
+function esbuildBundle(entry, result, minify) {
const echartsResolvePlugin = {
name: 'echarts-resolver',
@@ -202,10 +231,10 @@ function esbuildBundle(entry, result) {
return esbuild.build({
entryPoints: entry,
bundle: true,
- minify: true,
+ minify: minify,
plugins: [echartsResolvePlugin],
define: {
- 'process.env.NODE_ENV': JSON.stringify('production')
+ 'process.env.NODE_ENV': JSON.stringify(minify ? 'production' : 'development')
},
outdir: BUNDLE_DIR
});
@@ -218,7 +247,7 @@ async function bundle(entryFiles, result) {
// }
// await bundleSingle(entry, result);
for (let file of entryFiles) {
- await esbuildBundle([file], result);
+ await esbuildBundle([file], result, false);
console.log(chalk.green(`Bundled ${file}`));
}
}
diff --git a/test/template.html b/test/preview.html
similarity index 62%
copy from test/template.html
copy to test/preview.html
index 7d02bec..fb94486 100644
--- a/test/template.html
+++ b/test/preview.html
@@ -3,6 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js"></script>
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/dat.gui@0.6.5/build/dat.gui.min.js"></script>
<title>Test Container</title>
</head>
<body>
@@ -20,5 +22,6 @@
}
</style>
<div id="main"></div>
+ <script src="tmp/bundles/graph-grid.js"></script>
</body>
</html>
\ No newline at end of file
diff --git a/test/template.html b/test/template.html
index 7d02bec..71c3b5b 100644
--- a/test/template.html
+++ b/test/template.html
@@ -3,6 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js"></script>
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/dat.gui@0.6.5/build/dat.gui.min.js"></script>
<title>Test Container</title>
</head>
<body>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org