refactor(inactivemode): no pointer events for nodes and edges closes #218

This commit is contained in:
moklick
2020-05-13 11:09:22 +02:00
parent 3ce3472dc5
commit 1cc4e2676d
7 changed files with 59 additions and 48 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ describe('Empty Flow Rendering', () => {
});
it('uses lock view control', () => {
cy.get('.react-flow__controls-interactive').click();
cy.get('.react-flow__controls-interactive');
});
it('renders an empty mini map', () => {
+4 -26
View File
@@ -9,11 +9,13 @@ describe('Inactive Graph Rendering', () => {
});
it('tries to select a node by click', () => {
cy.get('.react-flow__node:first').click().should('have.not.class', 'selected');
const pointerEvents = Cypress.$('.react-flow__node:first').css('pointer-events');
expect(pointerEvents).to.equal('none');
});
it('tries to select an edge by click', () => {
cy.get('.react-flow__edge:first').click().should('have.not.class', 'selected');
const pointerEvents = Cypress.$('.react-flow__edge:first').css('pointer-events');
expect(pointerEvents).to.equal('none');
});
it('tries to do a selection', () => {
@@ -22,30 +24,6 @@ describe('Inactive Graph Rendering', () => {
cy.get('body').type('{shift}', { release: true });
});
it('tries to drag a node', () => {
const styleBeforeDrag = Cypress.$('.react-flow__node:first').css('transform');
cy.drag('.react-flow__node:first', { x: 500, y: 25 }).then(($el) => {
const styleAfterDrag = $el.css('transform');
expect(styleBeforeDrag).to.equal(styleAfterDrag);
});
});
it('tries to connect nodes', () => {
cy.get('.react-flow__node')
.contains('Node 3')
.find('.react-flow__handle.source')
.trigger('mousedown', { which: 1 });
cy.get('.react-flow__node')
.contains('Node 4')
.find('.react-flow__handle.target')
.trigger('mousemove')
.trigger('mouseup', { force: true });
cy.get('.react-flow__edge').should('have.length', 2);
});
it('toggles interactive mode', () => {
cy.get('.react-flow__interactive').click();
});