diff --git a/__tests__/integration/components/tooltip/tooltip-1.ts b/__tests__/integration/components/tooltip/tooltip-1.ts index 547f6cd6c..1c6a672ae 100644 --- a/__tests__/integration/components/tooltip/tooltip-1.ts +++ b/__tests__/integration/components/tooltip/tooltip-1.ts @@ -40,7 +40,7 @@ export const Tooltip1 = () => { document.getElementsByTagName('body')[0].appendChild(tooltip.HTMLTooltipElement); group.addEventListener('mousemove', (e: any) => { - tooltip.position = [e.offsetX, e.offsetY]; + tooltip.show(e.offsetX, e.offsetY); }); group.addEventListener('mouseenter', (e: any) => { tooltip.show(e.offsetX, e.offsetY); diff --git a/__tests__/integration/components/tooltip/tooltip-10.ts b/__tests__/integration/components/tooltip/tooltip-10.ts index 1d9eb7b87..19eca14f3 100644 --- a/__tests__/integration/components/tooltip/tooltip-10.ts +++ b/__tests__/integration/components/tooltip/tooltip-10.ts @@ -36,19 +36,20 @@ export const Tooltip10 = () => { { value: 1.2312323, name: '第四项', index: 1, color: 'green' }, { value: 1.2312323, name: '第五项', index: 1, color: 'blue' }, ], + enterable: true, }, }) ); document.getElementsByTagName('body')[0].appendChild(tooltip.HTMLTooltipElement); group.addEventListener('mousemove', (e: any) => { - tooltip.position = [e.offsetX, e.offsetY]; + tooltip.show(e.offsetX, e.offsetY); }); group.addEventListener('mouseenter', (e: any) => { tooltip.show(e.offsetX, e.offsetY); }); - group.addEventListener('mouseleave', () => { - tooltip.hide(); + group.addEventListener('mouseleave', (e: any) => { + tooltip.hide(e.clientX, e.clientY); }); return group; diff --git a/__tests__/integration/components/tooltip/tooltip-2.ts b/__tests__/integration/components/tooltip/tooltip-2.ts index 605ffe0b3..df2e3dbd3 100644 --- a/__tests__/integration/components/tooltip/tooltip-2.ts +++ b/__tests__/integration/components/tooltip/tooltip-2.ts @@ -56,26 +56,15 @@ export const Tooltip2 = () => { ); document.getElementsByTagName('body')[0].appendChild(tooltip.HTMLTooltipElement); - let isPointerInTooltip = false; group.addEventListener('mousemove', (e: any) => { - tooltip.position = [e.offsetX, e.offsetY]; - }); - tooltip.getContainer().addEventListener('mouseenter', () => { - isPointerInTooltip = true; - }); - tooltip.getContainer().addEventListener('mouseleave', () => { - isPointerInTooltip = false; + tooltip.show(e.offsetX, e.offsetY); }); group.addEventListener('mouseenter', () => { tooltip.show(); }); - group.addEventListener('mouseleave', () => { - timeout(() => { - if (!isPointerInTooltip) { - tooltip.hide(); - } - }); + group.addEventListener('mouseleave', (e: any) => { + tooltip.hide(e.clientX, e.clientY); }); return group; }; diff --git a/__tests__/integration/components/tooltip/tooltip-3.ts b/__tests__/integration/components/tooltip/tooltip-3.ts index 837f16ba0..b4e7f25e2 100644 --- a/__tests__/integration/components/tooltip/tooltip-3.ts +++ b/__tests__/integration/components/tooltip/tooltip-3.ts @@ -38,7 +38,7 @@ export const Tooltip3 = () => { document.getElementsByTagName('body')[0].appendChild(tooltip.HTMLTooltipElement); group.addEventListener('mousemove', (e: any) => { - tooltip.position = [e.offsetX, e.offsetY]; + tooltip.show(e.offsetX, e.offsetY); }); group.addEventListener('mouseenter', () => { tooltip.show(); diff --git a/__tests__/integration/components/tooltip/tooltip-4.ts b/__tests__/integration/components/tooltip/tooltip-4.ts index f4fc0dc51..429c5b54b 100644 --- a/__tests__/integration/components/tooltip/tooltip-4.ts +++ b/__tests__/integration/components/tooltip/tooltip-4.ts @@ -45,13 +45,13 @@ export const Tooltip4 = () => { document.getElementsByTagName('body')[0].appendChild(tooltip.HTMLTooltipElement); group.addEventListener('mousemove', (e: any) => { - tooltip.position = [e.offsetX, e.offsetY]; + tooltip.show(e.offsetX, e.offsetY); }); group.addEventListener('mouseenter', () => { tooltip.show(); }); - group.addEventListener('mouseleave', () => { - tooltip.hide(); + group.addEventListener('mouseleave', (e: any) => { + tooltip.hide(e.offsetX, e.offsetY); }); return group; }; diff --git a/__tests__/integration/components/tooltip/tooltip-5.tsx b/__tests__/integration/components/tooltip/tooltip-5.tsx index 099cd2517..2770bf0d4 100644 --- a/__tests__/integration/components/tooltip/tooltip-5.tsx +++ b/__tests__/integration/components/tooltip/tooltip-5.tsx @@ -43,7 +43,7 @@ export const Tooltip5 = () => { document.getElementsByTagName('body')[0].appendChild(tooltip.HTMLTooltipElement); group.addEventListener('mousemove', (e: any) => { - tooltip.position = [e.offsetX, e.offsetY]; + tooltip.show(e.offsetX, e.offsetY); }); group.addEventListener('mouseenter', () => { tooltip.show(); diff --git a/__tests__/integration/components/tooltip/tooltip-6.tsx b/__tests__/integration/components/tooltip/tooltip-6.tsx index 6bba5897b..10ed4c4e9 100644 --- a/__tests__/integration/components/tooltip/tooltip-6.tsx +++ b/__tests__/integration/components/tooltip/tooltip-6.tsx @@ -37,7 +37,7 @@ export const Tooltip6 = () => { document.getElementsByTagName('body')[0].appendChild(tooltip.HTMLTooltipElement); group.addEventListener('mousemove', (e: any) => { - tooltip.position = [e.offsetX, e.offsetY]; + tooltip.show(e.offsetX, e.offsetY); /** 1: 通过 React 渲染Tooltip节点 */ // ReactDOM.render( //