chore(tests): add test for selections and empty graphs

This commit is contained in:
moklick
2019-10-23 17:21:20 +02:00
parent 1879ba1e4e
commit 75d8eba097
3 changed files with 72 additions and 9 deletions
+18 -2
View File
@@ -15,7 +15,7 @@ describe('Basic Graph Rendering', () => {
expect(gridStroke).to.equal('#eee');
});
it('selects a node', () => {
it('selects a node by click', () => {
cy.get('.react-flow__node:first').click().should('have.class', 'selected');
});
@@ -24,7 +24,7 @@ describe('Basic Graph Rendering', () => {
cy.get('.react-flow__node:first').should('not.have.class', 'selected');
});
it('selects an edge', () => {
it('selects an edge by click', () => {
cy.get('.react-flow__edge:first').click().should('have.class', 'selected');
});
@@ -33,6 +33,22 @@ describe('Basic Graph Rendering', () => {
cy.get('.react-flow__edge:first').should('not.have.class', 'selected');
});
it('selects one node with a selection', () => {
cy.get('body')
.type('{shift}', { release: false })
.get('.react-flow__selectionpane')
.trigger('mousedown', 'topLeft', { which: 1, force: true })
.trigger('mousemove', 800, 75, { which: 1 })
.trigger('mouseup', 'bottomRight', { force: true })
.get('.react-flow__node')
.first()
.should('have.class', 'selected')
.get('.react-flow__node')
.last()
.should('have.not.class', 'selected')
.get('.react-flow__nodesselection-rect');
});
it('selects all nodes', () => {
cy.get('body')
.type('{shift}', { release: false })