From 686fb87b35b407b9880b02b8c60f41e302f9f61f Mon Sep 17 00:00:00 2001 From: David Lounsbrough Date: Mon, 28 Nov 2022 13:05:27 -0600 Subject: [PATCH 1/2] Fix y position on minimap --- packages/minimap/src/MiniMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/minimap/src/MiniMap.tsx b/packages/minimap/src/MiniMap.tsx index 890df176..722f1423 100644 --- a/packages/minimap/src/MiniMap.tsx +++ b/packages/minimap/src/MiniMap.tsx @@ -173,7 +173,7 @@ function MiniMap({ Date: Mon, 28 Nov 2022 13:58:28 -0600 Subject: [PATCH 2/2] Add assertion to cover path that I fixed --- examples/vite-app/cypress/e2e/minimap.cy.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/vite-app/cypress/e2e/minimap.cy.ts b/examples/vite-app/cypress/e2e/minimap.cy.ts index d6cb7d46..46a5a819 100644 --- a/examples/vite-app/cypress/e2e/minimap.cy.ts +++ b/examples/vite-app/cypress/e2e/minimap.cy.ts @@ -35,17 +35,20 @@ describe('Minimap Testing', () => { }); it('changes node position', () => { - const xPosBeforeDrag = Cypress.$('.react-flow__minimap-node:first').attr('x'); - const yPosBeforeDrag = Cypress.$('.react-flow__minimap-node:first').attr('y'); + const minimapNode = Cypress.$('.react-flow__minimap-node:first'); + + const xPosBeforeDrag = Number(minimapNode.attr('x')); + const yPosBeforeDrag = Number(minimapNode.attr('y')); cy.drag('.react-flow__node:first', { x: 500, y: 25 }) .wait(100) .then(() => { - const xPosAfterDrag = Cypress.$('.react-flow__minimap-node:first').attr('x'); - const yPosAfterDrag = Cypress.$('.react-flow__minimap-node:first').attr('y'); + const xPosAfterDrag = Number(minimapNode.attr('x')); + const yPosAfterDrag = Number(minimapNode.attr('y')); - expect(xPosBeforeDrag).to.not.equal(xPosAfterDrag); - expect(yPosBeforeDrag).to.not.equal(yPosAfterDrag); + expect(xPosAfterDrag).not.to.equal(xPosBeforeDrag); + expect(yPosAfterDrag).not.to.equal(yPosBeforeDrag); + expect(xPosAfterDrag - xPosBeforeDrag).to.be.greaterThan(yPosAfterDrag - yPosBeforeDrag); }); });