1
0
Fork 0

GraphViewer: Added a test for communitynodes to display their size

This commit is contained in:
Michael Hackstein 2013-07-11 08:39:21 +02:00
parent 7ce2826825
commit 1a2c6a0596
2 changed files with 23 additions and 2 deletions

View File

@ -307,6 +307,7 @@ function AbstractAdapter(nodes, edges, descendant) {
});
commNode.x = nodesToRemove[0].x;
commNode.y = nodesToRemove[0].y;
commNode._size = community.length;
cachedCommunities[commId] = {};
cachedCommunities[commId].nodes = nodesToRemove;
cachedCommunities[commId].edges = [];

View File

@ -844,6 +844,28 @@
existNode(3);
});
it('should create proper attributes for the community', function() {
var n1, n2, n3, n4, n5, com;
spyOn(mockWrapper, "call").andCallFake(function(name) {
workerCB({
data: {
cmd: name,
result: [1, 2, 3, 4, 5]
}
});
});
n1 = adapter.insertNode({_id: 1});
n2 = adapter.insertNode({_id: 2});
n3 = adapter.insertNode({_id: 3});
n4 = adapter.insertNode({_id: 4});
n5 = adapter.insertNode({_id: 5});
adapter.setNodeLimit(2);
com = getCommunityNodes()[0];
expect(com.x).toBeDefined();
expect(com.y).toBeDefined();
expect(com._size).toEqual(5);
});
it('should not trigger getCommunity multiple times', function() {
spyOn(mockWrapper, "call").andCallFake(function(name) {
setTimeout(function() {
@ -1526,8 +1548,6 @@
});
describe('checking many child nodes', function() {
var adapter, mockReducer;