Update packages and fix tests

This commit is contained in:
ziajka 2018-05-15 13:39:06 +02:00
parent 3ddc2ee550
commit e465be94b4
2 changed files with 776 additions and 1696 deletions

View File

@ -76,35 +76,36 @@ describe('InterfaceLabelsWidget', () => {
it('should draw interface labels', () => {
widget.draw(linksEnter);
const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('text.interface_label');
const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('g.interface_label_container');
expect(drew.nodes().length).toEqual(2);
const sourceInterface = drew.nodes()[0];
expect(sourceInterface.innerHTML).toEqual('Interface 1');
expect(sourceInterface.getAttribute('x')).toEqual('110');
expect(sourceInterface.getAttribute('y')).toEqual('237');
expect(sourceInterface.getAttribute('transform')).toEqual('rotate(5, 110, 220)');
expect(sourceInterface.getAttribute('style')).toEqual('font-size:12px');
expect(sourceInterface.getAttribute('class')).toContain('noselect');
expect(sourceInterface.getAttribute('transform')).toEqual('translate(110, 220) rotate(5, 110, 220)');
const sourceIntefaceRect = sourceInterface.firstChild;
expect(sourceIntefaceRect.getAttribute('class')).toEqual('interface_label_border');
const sourceIntefaceText = sourceInterface.children[1];
expect(sourceIntefaceText.getAttribute('class')).toEqual('interface_label noselect');
expect(sourceIntefaceText.getAttribute('style')).toEqual('font-size:12px');
const targetInterface = drew.nodes()[1];
expect(targetInterface.innerHTML).toEqual('Interface 2');
expect(targetInterface.getAttribute('x')).toEqual('270');
expect(targetInterface.getAttribute('y')).toEqual('377');
expect(targetInterface.getAttribute('transform')).toEqual('rotate(0, 270, 360)');
expect(targetInterface.getAttribute('style')).toEqual('');
expect(targetInterface.getAttribute('class')).toContain('noselect');
expect(targetInterface.getAttribute('transform')).toEqual('translate(270, 360) rotate(0, 270, 360)');
const targetIntefaceRect = targetInterface.firstChild;
expect(targetIntefaceRect.getAttribute('class')).toEqual('interface_label_border');
const targetIntefaceText = targetInterface.children[1];
expect(targetIntefaceText.getAttribute('class')).toEqual('interface_label noselect');
expect(targetIntefaceText.getAttribute('style')).toEqual('');
});
it('should draw interface label with class `selected` when selected', () => {
links[0].nodes[0].label.is_selected = true;
widget.draw(linksEnter);
const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('text.interface_label');
const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('g.interface_label_container');
const sourceInterface = drew.nodes()[0];
expect(sourceInterface.getAttribute('class')).toContain('selected');
});

2439
yarn.lock

File diff suppressed because it is too large Load Diff