blob: 45e3a62fd6e1cd1b86019ccf7e38cd678111e4b7 [file] [log] [blame]
const { removeCodeAndComment } = require('../src/util');
const { detectEnglish } = require('../src/translator');
const str = `
### What problem does this feature solve?
I wish to show chemical structure / latex formula or some other complex content in a tooltip canvas.
I have the function (based on zrender) to draw these objects and I wish there is an API hooker to help me.
An extra AJAX request may be required to fetch the more data during the render.
### What does the proposed API look like?
\`\`\`
tooltip: {
size: [150, 50], // The tooltip size prepared for render
onRender: function (
data, // The data of the selected point
render, // The echart/zrender object to draw on
boundRect // The bound rectangle to draw in
) {
axios.get("/some.api?id=" data["id"]).then(function (response) {
// Do some drawing code here.
})
}
}
\`\`\`
<!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
<!-- This issue is in English. DO NOT REMOVE -->`;
const str2 = `
### What problem does this feature solve?
比如 series-line.itemStyle. color 可以是一个函数,于是就可以动态修改每一个折线点的颜色。能不能让series-line.lineStyle. color 也可以是一个函数,这样就能动态修改每一小段折线的颜色,或者将它隐藏起来。
### What does the proposed API look like?
series-line.lineStyle. color 可以是一个函数,能动态修改每一小段折线的颜色,或者将它隐藏起来。
<!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->`;
const str3 = `Export types for formatter callback params`;
describe('translator and language test', () => {
it('The language should be English', () => {
const c = removeCodeAndComment(str);
expect(detectEnglish(c)).toEqual(true);
});
it('The language should be not English', () => {
const c = removeCodeAndComment(str2);
expect(detectEnglish(c)).toEqual(false);
});
it('The language should be English', () => {
const c = removeCodeAndComment(str3);
expect(detectEnglish(c)).toEqual(true);
});
});