Skip to content

Commit

Permalink
Fix ci issues (#5839)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
thejasonxie authored Nov 27, 2023
1 parent 52a5955 commit 81a10f8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 14 deletions.
10 changes: 10 additions & 0 deletions src/chart/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ export default class Chart extends View {
this.wrapperElement = null;
}

public show() {
this.visible = true;
this.changeVisible(true);
}

public hide() {
this.visible = false;
this.changeVisible(false);
}

/**
* 显示或隐藏图表
* @param visible 是否可见,true 表示显示,false 表示隐藏
Expand Down
4 changes: 2 additions & 2 deletions src/chart/controller/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export default class Tooltip extends Controller<TooltipOption> {
if (this.point) {
this.showTooltip(this.point);
}

if (this.tooltip) {
// #2279 修复resize之后tooltip越界的问题
// 确保tooltip已经创建的情况下
Expand Down Expand Up @@ -653,7 +653,7 @@ export default class Tooltip extends Controller<TooltipOption> {
if (record) {
const elementId = geometry.getElementId(record);
const element = geometry.elementsMap[elementId];
if (geometry.type === 'heatmap' || (element && element.visible)) {
if (geometry.type === 'heatmap' || (element && element.visible)) {
// Heatmap 没有 Element
// 如果图形元素隐藏了,怎不再 tooltip 上展示相关数据
const items = getTooltipItems(record, geometry, title);
Expand Down
4 changes: 2 additions & 2 deletions src/chart/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ export class View extends Base {
* @returns 维度字段的 Attribute 数组
*/
public getLegendAttributes(): Attribute[] {
return (flatten(this.geometries.map((g: Geometry) => g.getGroupAttributes())) as unknown) as Attribute[];
return flatten(this.geometries.map((g: Geometry) => g.getGroupAttributes())) as unknown as Attribute[];
}

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

/**
Expand Down
8 changes: 3 additions & 5 deletions src/facet/facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,9 @@ export abstract class Facet<C extends FacetCfg<FacetData> = FacetCfg<FacetData>,
*/
private createFacetViews(): View[] {
// 使用分面数据 创建分面 view
return this.facets.map(
(facet): View => {
return this.facetToView(facet);
}
);
return this.facets.map((facet): View => {
return this.facetToView(facet);
});
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/util/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { firstValue, get, isEmpty, isNil, isNumber, isString, valuesOfKey } from
import { getScale, Scale } from '../dependents';
import { LooseObject, ScaleOption } from '../interface';

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]))?$/;
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]))?$/;

/**
* 获取字段对应数据的类型
Expand Down
4 changes: 2 additions & 2 deletions tests/bugs/pie-update-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Pie update animation', () => {
});
expect(commands).toEqual(['M', 'L', 'A', 'L', 'Z']);
done();
}, 600);
}, 1000);
});

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

done();
}, 500);
}, 1000);
});
});
4 changes: 2 additions & 2 deletions tests/unit/animate/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe('Animate', () => {
expect(isNumberEqual(rect.attr('width'), 150)).toBeTruthy();
expect(isNumberEqual(rect.attr('height'), 150)).toBeTruthy();
done();
}, 450);
}, 1000);
});

it('doGroupAppearAnimate', (done) => {
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('Animate', () => {
setTimeout(() => {
expect(group.attr('matrix')).toEqual([1, 0, 0, 0, 1, 0, 0, 0, 1]);
done();
}, 550);
}, 1000);
});

afterEach(() => {
Expand Down

0 comments on commit 81a10f8

Please sign in to comment.