mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Added Test for ColourMapper.reset()
This commit is contained in:
parent
3ccd7a5b7b
commit
a7d9d161cb
|
@ -96,10 +96,21 @@
|
||||||
expect(c1).not.toEqual(c2);
|
expect(c1).not.toEqual(c2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to manually reset the returned colours', function() {
|
||||||
|
var c1 = mapper.getColour("1"),
|
||||||
|
c2 = mapper.getColour("2"),
|
||||||
|
c3;
|
||||||
|
|
||||||
|
mapper.reset();
|
||||||
|
|
||||||
|
c3 = mapper.getColour("3");
|
||||||
|
|
||||||
|
expect(c1).toEqual(c3);
|
||||||
|
});
|
||||||
|
|
||||||
it('should return 20 different colours and than restart', function() {
|
it('should return 20 different colours and than restart', function() {
|
||||||
var colours = [],
|
var colours = [],
|
||||||
i, j;
|
i, j, cNew;
|
||||||
colours.push(mapper.getColour("1"));
|
colours.push(mapper.getColour("1"));
|
||||||
colours.push(mapper.getColour("2"));
|
colours.push(mapper.getColour("2"));
|
||||||
colours.push(mapper.getColour("3"));
|
colours.push(mapper.getColour("3"));
|
||||||
|
@ -120,12 +131,13 @@
|
||||||
colours.push(mapper.getColour("18"));
|
colours.push(mapper.getColour("18"));
|
||||||
colours.push(mapper.getColour("19"));
|
colours.push(mapper.getColour("19"));
|
||||||
colours.push(mapper.getColour("20"));
|
colours.push(mapper.getColour("20"));
|
||||||
|
cNew = mapper.getColour("21");
|
||||||
for (i = 0; i < colours.length; i++) {
|
for (i = 0; i < colours.length; i++) {
|
||||||
for (j = i; j < colours.length; j++) {
|
for (j = i; j < colours.length; j++) {
|
||||||
expect(colours[i]).not.toEqual(colours[j]);
|
expect(colours[i]).not.toEqual(colours[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
expect(colours[0]).toEqual(cNew);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue