Skip to content

Commit

Permalink
refactor(examples): update custom node example, create rich example
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Oct 23, 2019
1 parent 5acfacb commit 6a4c43d
Show file tree
Hide file tree
Showing 30 changed files with 571 additions and 2,576 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ nodeTypes={{

You can now use type `special` for a node.
The `default`, `input` and `output` types will be still available except you overwrite one of them.
You can find an example of how to implement a custom node in [custom nodes example](example/src/CustomNodes).
You can find an example of how to implement a custom node in the [custom node example](example/src/CustomNode).


## Edges
Expand Down Expand Up @@ -200,7 +200,8 @@ const GraphWithControls = () => (

You can find all examples in the [example](example) folder. They are also deployt:

- [rich](https://react-flow.netlify.com/rich)
- [basic](https://react-flow.netlify.com/basic)
- [empty](https://react-flow.netlify.com/empty)
- [basic](https://react-flow.netlify.com/basic)
- [custom nodes](https://react-flow.netlify.com/)
- [inactive](https://react-flow.netlify.com/inactive)
- [custom node](https://react-flow.netlify.com/custom-node)
10 changes: 10 additions & 0 deletions cypress/integration/flow/custom-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('Custom Node Graph Rendering', () => {
it('renders a graph', () => {
cy.visit('/custom-node');

cy.get('.react-flow__renderer');

cy.get('.react-flow__node').should('have.length', 4);
cy.get('.react-flow__edge').should('have.length', 3);
});
});
55 changes: 0 additions & 55 deletions cypress/integration/flow/custom-nodes.js

This file was deleted.

17 changes: 17 additions & 0 deletions cypress/integration/flow/rich.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('Rich Graph Rendering', () => {
it('renders a graph', () => {
cy.visit('/');

cy.get('.react-flow__renderer');

cy.get('.react-flow__node').should('have.length', 6);
cy.get('.react-flow__edge').should('have.length', 5);
});

it('renders a grid', () => {
cy.get('.react-flow__grid');

const gridStroke = Cypress.$('.react-flow__grid path').attr('fill');
expect(gridStroke).to.equal('#888');
});
});

0 comments on commit 6a4c43d

Please sign in to comment.