Skip to content

Commit

Permalink
refactor(examples): rename Advanced to CustomNodes, use func component
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Oct 22, 2019
1 parent bd60ad0 commit 0200591
Show file tree
Hide file tree
Showing 14 changed files with 2,293 additions and 287 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@ const BasicGraph = () => (
- `onMove`: move handler
- `nodeTypes`: object with node types
- `edgeTypes`: object with node types
- `style`: css style passed to the wrapper
- `connectionLineType`: connection line type = `straight` or `bezier`
- `connectionLineStyle`: connection style as svg attributes
- `deleteKeyCode`: delete key code
- `selectionKeyCode`: selection key code
- `showBackground`: boolean
- `backgroundGap`: gap size
- `backgroundColor`: color of dots or lines
- `backgroundType`: background type = `dots` or `lines`
- `snapToGrid`: boolean
- `snapGrid`: [x, y] array
- `deleteKeyCode`: default: `16`
- `selectionKeyCode`: default: `false`
- `showBackground`: default: `true`
- `backgroundGap`: gap size - default: `16`
- `backgroundColor`: color of dots or lines - default: `#eee`
- `backgroundType`: background type = `dots` or `lines` - default: `dots`
- `snapToGrid`: default: `false`
- `snapGrid`: [x, y] array - default: `[16, 16]`
- `onlyRenderVisibleNodes`: default: `true`

# Plugins

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/flow/basic.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Basic Flow Rendering', () => {
describe('Basic Graph Rendering', () => {
it('renders a flow with three nodes', () => {
cy.visit('/basic');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
describe('Advanced Flow Rendering', () => {
describe('Custom Nodes Graph Rendering', () => {
it('renders a flow with sone nodes', () => {
cy.visit('/');

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

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

it('renders a grid', () => {
Expand All @@ -31,7 +31,7 @@ describe('Advanced Flow Rendering', () => {
.should('not.have.class', 'valid')
.should('not.have.class', 'connecting');

cy.get('.react-flow__edge').should('have.length', 10);
cy.get('.react-flow__edge').should('have.length', 9);
});

it('tries to make invalid connection', () => {
Expand All @@ -50,6 +50,6 @@ describe('Advanced Flow Rendering', () => {
.trigger('mouseup', { force: true })
.should('not.have.class', 'connecting');

cy.get('.react-flow__edge').should('have.length', 10);
cy.get('.react-flow__edge').should('have.length', 9);
});
});
17 changes: 17 additions & 0 deletions cypress/integration/flow/empty.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('Empty Flow Rendering', () => {
it('renders an empty graph', () => {
cy.visit('/empty');

cy.get('.react-flow__renderer');
cy.get('.react-flow__node').should('not.exist');
cy.get('.react-flow__edge').should('not.exist');
});

it('renders a control panel', () => {
cy.get('.react-flow__controls');
});

it('renders a mini map', () => {
cy.get('.react-flow__minimap');
});
});

0 comments on commit 0200591

Please sign in to comment.