Skip to content

Commit 81a10f8

Browse files
authored
Fix ci issues (#5839)
* fix: undefined tooltip element (#5835) * fix: ci failed linting * fix: ci failed test chart show and hide * fix: ci failed test allow sufficient animation time * fix: ci increase setTimeout duration for animate test * Revert "fix: ci failed test chart show and hide" This reverts commit d8c52d1. * fix: override chart show and hide method
1 parent 52a5955 commit 81a10f8

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

src/chart/chart.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ export default class Chart extends View {
138138
this.wrapperElement = null;
139139
}
140140

141+
public show() {
142+
this.visible = true;
143+
this.changeVisible(true);
144+
}
145+
146+
public hide() {
147+
this.visible = false;
148+
this.changeVisible(false);
149+
}
150+
141151
/**
142152
* 显示或隐藏图表
143153
* @param visible 是否可见,true 表示显示,false 表示隐藏

src/chart/controller/tooltip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export default class Tooltip extends Controller<TooltipOption> {
323323
if (this.point) {
324324
this.showTooltip(this.point);
325325
}
326-
326+
327327
if (this.tooltip) {
328328
// #2279 修复resize之后tooltip越界的问题
329329
// 确保tooltip已经创建的情况下
@@ -653,7 +653,7 @@ export default class Tooltip extends Controller<TooltipOption> {
653653
if (record) {
654654
const elementId = geometry.getElementId(record);
655655
const element = geometry.elementsMap[elementId];
656-
if (geometry.type === 'heatmap' || (element && element.visible)) {
656+
if (geometry.type === 'heatmap' || (element && element.visible)) {
657657
// Heatmap 没有 Element
658658
// 如果图形元素隐藏了,怎不再 tooltip 上展示相关数据
659659
const items = getTooltipItems(record, geometry, title);

src/chart/view.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ export class View extends Base {
984984
* @returns 维度字段的 Attribute 数组
985985
*/
986986
public getLegendAttributes(): Attribute[] {
987-
return (flatten(this.geometries.map((g: Geometry) => g.getGroupAttributes())) as unknown) as Attribute[];
987+
return flatten(this.geometries.map((g: Geometry) => g.getGroupAttributes())) as unknown as Attribute[];
988988
}
989989

990990
/**
@@ -1002,7 +1002,7 @@ export class View extends Base {
10021002
* @returns G.Canvas 画布实例。
10031003
*/
10041004
public getCanvas(): ICanvas {
1005-
return ((this.getRootView() as unknown) as Chart).canvas;
1005+
return (this.getRootView() as unknown as Chart).canvas;
10061006
}
10071007

10081008
/**

src/facet/facet.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,9 @@ export abstract class Facet<C extends FacetCfg<FacetData> = FacetCfg<FacetData>,
153153
*/
154154
private createFacetViews(): View[] {
155155
// 使用分面数据 创建分面 view
156-
return this.facets.map(
157-
(facet): View => {
158-
return this.facetToView(facet);
159-
}
160-
);
156+
return this.facets.map((facet): View => {
157+
return this.facetToView(facet);
158+
});
161159
}
162160

163161
/**

src/util/scale.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { firstValue, get, isEmpty, isNil, isNumber, isString, valuesOfKey } from
22
import { getScale, Scale } from '../dependents';
33
import { LooseObject, ScaleOption } from '../interface';
44

5-
const dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]+)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
5+
const dateRegex =
6+
/^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]+)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
67

78
/**
89
* 获取字段对应数据的类型

tests/bugs/pie-update-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('Pie update animation', () => {
4343
});
4444
expect(commands).toEqual(['M', 'L', 'A', 'L', 'Z']);
4545
done();
46-
}, 600);
46+
}, 1000);
4747
});
4848

4949
it('recheck', () => {
@@ -162,6 +162,6 @@ describe('Pie update animation', () => {
162162
expect(labelContainer.getCount()).toBe(1);
163163

164164
done();
165-
}, 500);
165+
}, 1000);
166166
});
167167
});

tests/unit/animate/index-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('Animate', () => {
154154
expect(isNumberEqual(rect.attr('width'), 150)).toBeTruthy();
155155
expect(isNumberEqual(rect.attr('height'), 150)).toBeTruthy();
156156
done();
157-
}, 450);
157+
}, 1000);
158158
});
159159

160160
it('doGroupAppearAnimate', (done) => {
@@ -183,7 +183,7 @@ describe('Animate', () => {
183183
setTimeout(() => {
184184
expect(group.attr('matrix')).toEqual([1, 0, 0, 0, 1, 0, 0, 0, 1]);
185185
done();
186-
}, 550);
186+
}, 1000);
187187
});
188188

189189
afterEach(() => {

0 commit comments

Comments
 (0)