@centreon/ui 24.4.1-MON-34377-implement-tree-chart-on-centreon-ui.4 → 24.4.1-MON-34377-implement-tree-chart-on-centreon-ui.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "24.4.1-MON-34377-implement-tree-chart-on-centreon-ui.4",
3
+ "version": "24.4.1-MON-34377-implement-tree-chart-on-centreon-ui.5",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -163,7 +163,7 @@ describe('Zoom', () => {
163
163
  cy.makeSnapshot();
164
164
  });
165
165
 
166
- it('moves the view when the mouse is hover the minimap with the correspondiong button pressed down', () => {
166
+ it('moves the view when the mouse is hover the minimap with the corresponding button pressed down', () => {
167
167
  initialize({ showMinimap: true });
168
168
 
169
169
  cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
@@ -181,4 +181,23 @@ describe('Zoom', () => {
181
181
 
182
182
  cy.makeSnapshot();
183
183
  });
184
+
185
+ it('moves the view when the mouse is hover the content with the corresponding button pressed down', () => {
186
+ initialize({ showMinimap: true });
187
+
188
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
189
+ cy.get('svg').should('have.attr', 'height', '400');
190
+
191
+ cy.findByTestId('zoom-container')
192
+ .trigger('mousedown', 400, 200)
193
+ .trigger('mousemove', 600, 200);
194
+
195
+ cy.findByTestId('zoom-content').should(
196
+ 'have.attr',
197
+ 'transform',
198
+ 'matrix(1, 0, 0, 1, 200, 0)'
199
+ );
200
+
201
+ cy.makeSnapshot();
202
+ });
184
203
  });
@@ -94,6 +94,7 @@ const Zoom = ({
94
94
  <svg
95
95
  className={classes.svg}
96
96
  data-is-grabbing={isDragging}
97
+ data-testid="zoom-container"
97
98
  height={height}
98
99
  width={width}
99
100
  onMouseDown={dragStart(zoom)}
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useState } from 'react';
2
2
 
3
3
  import { Point, ProvidedZoom, Translate } from '@visx/zoom/lib/types';
4
- import { equals } from 'ramda';
4
+ import { equals, isNil } from 'ramda';
5
5
 
6
6
  import { localPoint } from './localPoint';
7
7
  import { ZoomState } from './models';
@@ -22,7 +22,7 @@ export const useZoom = (): UseZoomState => {
22
22
  const dragStart = useCallback(
23
23
  (zoom: ProvidedZoom<SVGSVGElement> & ZoomState) =>
24
24
  (e): void => {
25
- if (!equals(e.nativeEvent.which, 1)) {
25
+ if (!isNil(e.nativeEvent.which) && !equals(e.nativeEvent.which, 1)) {
26
26
  return;
27
27
  }
28
28
  const { translateX, translateY } = zoom.transformMatrix;