Skip to content

Commit

Permalink
Add test case related to #2231
Browse files Browse the repository at this point in the history
  • Loading branch information
josejulio authored and maxkfranz committed Dec 7, 2018
1 parent 9617803 commit 216b5fa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/core-graph-manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,27 @@ describe('Core graph manipulation', function(){
expect( cb ).to.equal(2);
});

it('cy.json() can remove all elements', function() {
// Issue #2231
var cb = 0;
cy.on('remove', function() { cb++ });

cy.json({
elements: {
nodes: [],
edges: []
}
});

expect( cy.$('#n1').length ).to.equal(0);
expect( cy.$('#n2').length ).to.equal(0);
expect( cy.$('#n3').length ).to.equal(0);
expect( cy.$('#n1n2').length ).to.equal(0);
expect( cy.$('#n2n3').length ).to.equal(0);

expect( cb ).to.equal(5); // 3 nodes and 2 edges
});

it('cy.json() removes parent', function(){
// clean up before test:
cy.elements().remove();
Expand Down

0 comments on commit 216b5fa

Please sign in to comment.