diff --git a/__tests__/integration/api-chart-on-component-click.spec.ts b/__tests__/integration/api-chart-on-component-click.spec.ts index 80baa1f499..36f88fb223 100644 --- a/__tests__/integration/api-chart-on-component-click.spec.ts +++ b/__tests__/integration/api-chart-on-component-click.spec.ts @@ -30,7 +30,9 @@ describe('chart.on', () => { await finished; const [fired, resolve] = createPromise(); chart.on(`legend-category-item-marker:${ChartEvent.CLICK}`, resolve); - dispatchFirstShapeEvent(canvas, 'legend-category-item-marker', 'click', { detail: 1 }); + dispatchFirstShapeEvent(canvas, 'legend-category-item-marker', 'click', { + detail: 1, + }); await fired; }); @@ -38,7 +40,9 @@ describe('chart.on', () => { await finished; const [fired, resolve] = createPromise(); chart.on(`legend-category-item-label:${ChartEvent.CLICK}`, resolve); - dispatchFirstShapeEvent(canvas, 'legend-category-item-label', 'click', { detail: 1 }); + dispatchFirstShapeEvent(canvas, 'legend-category-item-label', 'click', { + detail: 1, + }); await fired; }); diff --git a/__tests__/plots/api/chart-on-component-click.ts b/__tests__/plots/api/chart-on-component-click.ts index ad1999836a..cd6cc4cd5c 100644 --- a/__tests__/plots/api/chart-on-component-click.ts +++ b/__tests__/plots/api/chart-on-component-click.ts @@ -12,8 +12,8 @@ const componentNames = [ // tick 'axis-tick-item', // axis label - 'axis-label-item' -] + 'axis-label-item', +]; export function chartOnComponentClick(context) { const { container, canvas } = context; @@ -47,9 +47,9 @@ export function chartOnComponentClick(context) { chart.on('component:click', () => console.log('click component')); - componentNames.forEach(name => { + componentNames.forEach((name) => { chart.on(`${name}:click`, () => console.log(`click ${name}`)); - }) + }); const finished = chart.render(); diff --git a/src/interaction/event.ts b/src/interaction/event.ts index bdc903cdd8..5cbfcc6e61 100644 --- a/src/interaction/event.ts +++ b/src/interaction/event.ts @@ -23,12 +23,12 @@ function maybeRoot(node, rootOf) { // For extended component function maybeComponentRoot(node) { - return maybeRoot(node, node => node.className === 'component'); + return maybeRoot(node, (node) => node.className === 'component'); } // For extended shape. function maybeElementRoot(node) { - return maybeRoot(node, node => node.className === 'element'); + return maybeRoot(node, (node) => node.className === 'element'); } function bubblesEvent(eventType, view, emitter, predicate = (event) => true) { @@ -64,7 +64,7 @@ function bubblesEvent(eventType, view, emitter, predicate = (event) => true) { emitter.emit(`element:${eventType}`, e1); emitter.emit(`${markType}:${eventType}`, e1); } else { - const e1 = {...e, nativeEvent: true }; + const e1 = { ...e, nativeEvent: true }; emitter.emit(`component:${eventType}`, e1); emitter.emit(`${className}:${eventType}`, e1); }