-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): add invalid connection test
- Loading branch information
Showing
4 changed files
with
61 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
describe('Advanced Flow Rendering', () => { | ||
it('renders a flow with sone nodes', () => { | ||
cy.visit('/advanced.html'); | ||
|
||
cy.get('.react-flow__renderer'); | ||
|
||
cy.get('.react-flow__node').should('have.length', 9); | ||
cy.get('.react-flow__edge').should('have.length', 9); | ||
}); | ||
|
||
it('connects nodes', () => { | ||
cy.get('.react-flow__node') | ||
.contains('1 Tests') | ||
.find('.react-flow__handle.source') | ||
.trigger('mousedown', { which: 1 }); | ||
|
||
cy.get('.react-flow__node') | ||
.contains('7 output') | ||
.find('.react-flow__handle.target') | ||
.trigger('mousemove') | ||
.should('have.class', 'connecting') | ||
.should('have.class', 'valid') | ||
.trigger('mouseup', { force: true }) | ||
.should('not.have.class', 'valid') | ||
.should('not.have.class', 'connecting'); | ||
|
||
cy.get('.react-flow__edge').should('have.length', 10); | ||
}); | ||
|
||
it('tries to make invalid connection', () => { | ||
cy.get('.react-flow__node') | ||
.contains('write something') | ||
.parents('.react-flow__node') | ||
.find('.react-flow__handle.source') | ||
.trigger('mousedown', { which: 1 }); | ||
|
||
cy.get('.react-flow__node') | ||
.contains('5 Another node') | ||
.find('.react-flow__handle.target') | ||
.trigger('mousemove') | ||
.should('have.class', 'connecting') | ||
.should('not.have.class', 'valid') | ||
.trigger('mouseup', { force: true }) | ||
.should('not.have.class', 'connecting'); | ||
|
||
cy.get('.react-flow__edge').should('have.length', 10); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters