Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Collapse #83

Merged
merged 20 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3a88c08
First iteration of the node collapser
svipatov Jun 29, 2018
e22a0e5
Cleaned up the code a bit
Jun 29, 2018
93ba502
Put helpers where they belong (which is graph.helpers.js)
Jul 1, 2018
2b97e8e
Added a helper for getting the cardinality of a node.
Jul 1, 2018
5b6bb8f
Added config parameter for collapsible feature
svipatov Jul 3, 2018
6cafef1
Separated the functional that returns a partial state of d3Links and …
svipatov Jul 3, 2018
78a1717
Added JSDoc's and removed default config of leaf nodes.
svipatov Jul 3, 2018
108cb57
Checking for the existence of defined onClickNode callback
svipatov Jul 3, 2018
7ce030e
Added collapsible config
svipatov Jul 3, 2018
9aab33d
Cleaned up the code a bit
svipatov Jun 29, 2018
bd6046e
Put helpers where they belong (which is graph.helpers.js)
svipatov Jul 1, 2018
038edea
Added a helper for getting the cardinality of a node.
svipatov Jul 1, 2018
b2d8618
Added config parameter for collapsible feature
svipatov Jul 3, 2018
2ef8cc2
Separated the functional that returns a partial state of d3Links and …
svipatov Jul 3, 2018
9aa917e
Added JSDoc's and removed default config of leaf nodes.
svipatov Jul 3, 2018
a1b7eff
Checking for the existence of defined onClickNode callback
svipatov Jul 3, 2018
93238fc
Added collapsible config
svipatov Jul 3, 2018
07ded39
Added a functional test for the graph, corrected small.data.js becaus…
svipatov Jul 20, 2018
d0f7485
Merge branch 'feature/node-collapse' of https://github.com/svipatov/r…
svipatov Jul 20, 2018
7dde3b0
Reverted small.data.js changes and corrected id matching
svipatov Jul 20, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions cypress/integration/graph.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const SANDBOX_URL = Cypress.env('SANDBOX_URL');

const NodePO = require('../page-objects/node.po');
const LinkPO = require('../page-objects/link.po');
const SandboxPO = require('../page-objects/sandbox.po');
let nodes = require('./../../sandbox/data/default').nodes.map(({ id }) => id);

Expand Down Expand Up @@ -109,3 +110,37 @@ describe('[rd3g-graph] graph tests', function() {
});
});
});

describe('when clicking a node', function() {
before(function() {
this.sandboxPO = new SandboxPO();
// visit sandbox
cy.visit(`${SANDBOX_URL}?data=small`);
// sleep 2 seconds
cy.wait(2000);
// pause the graph
this.sandboxPO.pauseGraph();

cy.contains('collapsible').scrollIntoView();
this.sandboxPO.getFieldInput('collapsible').click();

this.node1PO = new NodePO(1);
this.node2PO = new NodePO(2);
this.link12PO = new LinkPO(0);
});

it('should collapse leaf nodes', function() {
const line = this.link12PO.getLine();

// Check the leaf node & link is present
this.node2PO.getPath().should('be.visible');
line.should('be.visible');

// Click 'Node 1' in order to collapse the leafs
this.node1PO.getPath().click();

// Check the leaf node & link is no longer visible
this.node2PO.getPath().should('not.be.visible');
line.should('not.be.visible');
});
});
2 changes: 1 addition & 1 deletion cypress/page-objects/sandbox.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
function SandboxPO() {
// whitelist checkbox inputs
this.checkboxes = ['node.renderLabel', 'staticGraph'];
this.checkboxes = ['node.renderLabel', 'staticGraph', 'collapsible'];

// actions
this.fullScreenMode = () => cy.get('.container__graph > :nth-child(1) > :nth-child(1)');
Expand Down
Loading