chore(test): cleanup
This commit is contained in:
@@ -92,7 +92,7 @@ describe('Basic Flow Rendering', { testIsolation: false }, () => {
|
|||||||
it('drags a node', () => {
|
it('drags a node', () => {
|
||||||
const styleBeforeDrag = Cypress.$('.react-flow__node:first').css('transform');
|
const styleBeforeDrag = Cypress.$('.react-flow__node:first').css('transform');
|
||||||
|
|
||||||
cy.drag('.react-flow__node:first', { x: 500, y: 25 }).then(($el: any) => {
|
cy.drag('.react-flow__node:first', { x: 10, y: 10 }).then(($el: any) => {
|
||||||
const styleAfterDrag = $el.css('transform');
|
const styleAfterDrag = $el.css('transform');
|
||||||
expect(styleBeforeDrag).to.not.equal(styleAfterDrag);
|
expect(styleBeforeDrag).to.not.equal(styleAfterDrag);
|
||||||
});
|
});
|
||||||
@@ -103,7 +103,7 @@ describe('Basic Flow Rendering', { testIsolation: false }, () => {
|
|||||||
cy.get('html').realPress('Backspace');
|
cy.get('html').realPress('Backspace');
|
||||||
|
|
||||||
cy.get('.react-flow__node').should('have.length', 3);
|
cy.get('.react-flow__node').should('have.length', 3);
|
||||||
cy.get('.react-flow__edge').should('have.length', 1);
|
cy.get('.react-flow__edge').should('have.length', 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('connects nodes', () => {
|
it('connects nodes', () => {
|
||||||
@@ -120,14 +120,14 @@ describe('Basic Flow Rendering', { testIsolation: false }, () => {
|
|||||||
.trigger('mouseup', { force: true, button: 0 });
|
.trigger('mouseup', { force: true, button: 0 });
|
||||||
|
|
||||||
cy.get('.react-flow__edge').as('edge');
|
cy.get('.react-flow__edge').as('edge');
|
||||||
cy.get('@edge').should('have.length', 3);
|
cy.get('@edge').should('have.length', 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('removes an edge', () => {
|
it('removes an edge', () => {
|
||||||
cy.get('.react-flow__edge:first').click();
|
cy.get('.react-flow__edge:first').click();
|
||||||
cy.get('html').realPress('Backspace');
|
cy.get('html').realPress('Backspace');
|
||||||
|
|
||||||
cy.get('.react-flow__edge').should('have.length', 1);
|
cy.get('.react-flow__edge').should('have.length', 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('drags the pane', () => {
|
it('drags the pane', () => {
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ const initialNodes: Node[] = [
|
|||||||
data: { label: 'Node 4' },
|
data: { label: 'Node 4' },
|
||||||
position: { x: 400, y: 200 },
|
position: { x: 400, y: 200 },
|
||||||
className: 'light',
|
className: 'light',
|
||||||
connectable: false,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -129,6 +128,7 @@ const BasicFlow = () => {
|
|||||||
selectNodesOnDrag={false}
|
selectNodesOnDrag={false}
|
||||||
elevateEdgesOnSelect
|
elevateEdgesOnSelect
|
||||||
elevateNodesOnSelect={false}
|
elevateNodesOnSelect={false}
|
||||||
|
nodeDragThreshold={0}
|
||||||
>
|
>
|
||||||
<Background variant={BackgroundVariant.Dots} />
|
<Background variant={BackgroundVariant.Dots} />
|
||||||
<MiniMap />
|
<MiniMap />
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const DragHandleFlow = () => {
|
|||||||
edges={edges}
|
edges={edges}
|
||||||
nodeTypes={nodeTypes}
|
nodeTypes={nodeTypes}
|
||||||
onNodeClick={onNodeClick}
|
onNodeClick={onNodeClick}
|
||||||
|
nodeDragThreshold={0}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const onNodeClick = (_: ReactMouseEvent, node: Node) => console.log('click', nod
|
|||||||
const onEdgeClick = (_: ReactMouseEvent, edge: Edge) => console.log('click', edge);
|
const onEdgeClick = (_: ReactMouseEvent, edge: Edge) => console.log('click', edge);
|
||||||
const onPaneClick = (event: ReactMouseEvent) => console.log('onPaneClick', event);
|
const onPaneClick = (event: ReactMouseEvent) => console.log('onPaneClick', event);
|
||||||
const onPaneScroll = (event?: WheelEvent) => console.log('onPaneScroll', event);
|
const onPaneScroll = (event?: WheelEvent) => console.log('onPaneScroll', event);
|
||||||
const onPaneContextMenu = (event: ReactMouseEvent) => console.log('onPaneContextMenu', event);
|
const onPaneContextMenu = (event: ReactMouseEvent | MouseEvent) => console.log('onPaneContextMenu', event);
|
||||||
const onMoveEnd = (_: TouchEvent | MouseEvent | null, viewport: Viewport) => console.log('onMoveEnd', viewport);
|
const onMoveEnd = (_: TouchEvent | MouseEvent | null, viewport: Viewport) => console.log('onMoveEnd', viewport);
|
||||||
|
|
||||||
const InteractionFlow = () => {
|
const InteractionFlow = () => {
|
||||||
@@ -80,6 +80,7 @@ const InteractionFlow = () => {
|
|||||||
onPaneClick={captureZoomClick ? onPaneClick : undefined}
|
onPaneClick={captureZoomClick ? onPaneClick : undefined}
|
||||||
onPaneScroll={captureZoomScroll ? onPaneScroll : undefined}
|
onPaneScroll={captureZoomScroll ? onPaneScroll : undefined}
|
||||||
onPaneContextMenu={captureZoomClick ? onPaneContextMenu : undefined}
|
onPaneContextMenu={captureZoomClick ? onPaneContextMenu : undefined}
|
||||||
|
nodeDragThreshold={0}
|
||||||
onMoveEnd={onMoveEnd}
|
onMoveEnd={onMoveEnd}
|
||||||
>
|
>
|
||||||
<MiniMap />
|
<MiniMap />
|
||||||
|
|||||||
Reference in New Issue
Block a user