feat(tests): add tests

This commit is contained in:
moklick
2019-09-26 14:31:59 +02:00
parent 590d7c7db0
commit 7b3a90c6dc
9 changed files with 27 additions and 15 deletions
+16
View File
@@ -7,10 +7,18 @@ describe('Basic Flow Rendering', () => {
cy.get('.react-graph__edge').should('have.length', 2);
});
it('all nodes have handles', () => {
cy.get('.react-graph__node').children('div').children('.react-graph__handle');
});
it('selects a node', () => {
cy.get('.react-graph__node:first').click().should('have.class', 'selected');
});
it('selects an edge', () => {
cy.get('.react-graph__edge:first').click().should('have.class', 'selected');
});
it('drags a node', () => {
const styleBeforeDrag = Cypress.$('.react-graph__node:first').css('transform');
@@ -20,4 +28,12 @@ describe('Basic Flow Rendering', () => {
expect(styleBeforeDrag).to.not.equal(styleAfterDrag);
});
});
it('removes a node', () => {
cy.get('.react-graph__node:last').click();
cy.get('body').type('{backspace}');
cy.get('.react-graph__node').should('have.length', 2);
cy.get('.react-graph__edge').should('have.length', 1);
});
});