diff --git a/packages/heatmap/tests/HeatMap.test.tsx b/packages/heatmap/tests/HeatMap.test.tsx index 3f5596bee3..943863b289 100644 --- a/packages/heatmap/tests/HeatMap.test.tsx +++ b/packages/heatmap/tests/HeatMap.test.tsx @@ -176,6 +176,104 @@ describe('interactivity', () => { expect(onClick).not.toHaveBeenCalled() }) }) + + describe('active/inactive', () => { + it('should support single cell hover target', () => { + const wrapper = mount( + + ) + + const hoveredCell = wrapper.find(`g[data-testid='cell.B.Y']`) + hoveredCell.simulate('mouseenter') + + const activeCellIds = ['B.Y'] + dataPoints.forEach(datum => { + const cell = wrapper.find(`g[data-testid='cell.${datum.id}']`).parent() + if (activeCellIds.includes(datum.id)) { + expect(cell.prop('opacity').get()).toEqual(1) + } else { + expect(cell.prop('opacity').get()).toEqual(0) + } + }) + }) + + it('should support row hover target', () => { + const wrapper = mount( + + ) + + const hoveredCell = wrapper.find(`g[data-testid='cell.B.Y']`) + hoveredCell.simulate('mouseenter') + + const activeCellIds = ['B.X', 'B.Y', 'B.Z'] + dataPoints.forEach(datum => { + const cell = wrapper.find(`g[data-testid='cell.${datum.id}']`).parent() + if (activeCellIds.includes(datum.id)) { + expect(cell.prop('opacity').get()).toEqual(1) + } else { + expect(cell.prop('opacity').get()).toEqual(0) + } + }) + }) + + it('should support column hover target', () => { + const wrapper = mount( + + ) + + const hoveredCell = wrapper.find(`g[data-testid='cell.B.Y']`) + hoveredCell.simulate('mouseenter') + + const activeCellIds = ['A.Y', 'B.Y', 'C.Y'] + dataPoints.forEach(datum => { + const cell = wrapper.find(`g[data-testid='cell.${datum.id}']`).parent() + if (activeCellIds.includes(datum.id)) { + expect(cell.prop('opacity').get()).toEqual(1) + } else { + expect(cell.prop('opacity').get()).toEqual(0) + } + }) + }) + + it('should support rowColumn hover target', () => { + const wrapper = mount( + + ) + + const hoveredCell = wrapper.find(`g[data-testid='cell.B.Y']`) + hoveredCell.simulate('mouseenter') + + const activeCellIds = ['B.X', 'B.Y', 'B.Z', 'A.Y', 'C.Y'] + dataPoints.forEach(datum => { + const cell = wrapper.find(`g[data-testid='cell.${datum.id}']`).parent() + if (activeCellIds.includes(datum.id)) { + expect(cell.prop('opacity').get()).toEqual(1) + } else { + expect(cell.prop('opacity').get()).toEqual(0) + } + }) + }) + }) }) }) }) diff --git a/packages/network/tests/Network.test.tsx b/packages/network/tests/Network.test.tsx index cd3ac96c31..e34cee3f54 100644 --- a/packages/network/tests/Network.test.tsx +++ b/packages/network/tests/Network.test.tsx @@ -496,7 +496,7 @@ describe('annotations', () => { const annotatedNode = wrapper.find(`circle[data-testid='node.${annotatedNodeId}']`) const [nodeX, nodeY] = Array.from( - annotatedNode.prop('transform').match(/translate\(([0-9.]+),([0-9.]+)\)/) + annotatedNode.prop('transform').match(/translate\(([0-9.]+),([0-9.]+)\)/)! ) .slice(1) .map(Number)