refactor(userselection): use store for handling updates

This commit is contained in:
moklick
2020-04-20 13:20:51 +02:00
parent 75d51ecc03
commit 6354aa4330
21 changed files with 9614 additions and 6636 deletions
+9 -20
View File
@@ -5,34 +5,27 @@ describe('Inactive Graph Rendering', () => {
cy.get('.react-flow__renderer');
cy.get('.react-flow__node').should('have.length', 4);
cy.get('.react-flow__edge').should('have.length', 2);
cy.get('.react-flow__node')
.children('div')
.children('.react-flow__handle');
cy.get('.react-flow__node').children('div').children('.react-flow__handle');
});
it('tries to select a node by click', () => {
cy.get('.react-flow__node:first')
.click()
.should('have.not.class', 'selected');
cy.get('.react-flow__node:first').click().should('have.not.class', 'selected');
});
it('tries to select an edge by click', () => {
cy.get('.react-flow__edge:first')
.click()
.should('have.not.class', 'selected');
cy.get('.react-flow__edge:first').click().should('have.not.class', 'selected');
});
it('tries to do a selection', () => {
cy.get('body')
.type('{shift}', { release: false })
.get('.react-flow__selectionpane')
.should('not.exist');
cy.get('body').type('{shift}', { release: false }).get('.react-flow__selectionpane').should('not.exist');
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 => {
cy.drag('.react-flow__node:first', { x: 500, y: 25 }).then(($el) => {
const styleAfterDrag = $el.css('transform');
expect(styleBeforeDrag).to.equal(styleAfterDrag);
});
@@ -58,14 +51,10 @@ describe('Inactive Graph Rendering', () => {
});
it('selects a node by click', () => {
cy.get('.react-flow__node:first')
.click()
.should('have.class', 'selected');
cy.get('.react-flow__node:first').click().should('have.class', 'selected');
});
it('selects an edge by click', () => {
cy.get('.react-flow__edge:first')
.click()
.should('have.class', 'selected');
cy.get('.react-flow__edge:first').click().should('have.class', 'selected');
});
});