1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { DiagramComponent } from './diagram.component';
describe('DiagramComponent', () => {
let component: DiagramComponent;
let fixture: ComponentFixture<DiagramComponent>;
beforeEach(
async(() => {
TestBed.configureTestingModule({
declarations: [DiagramComponent]
}).compileComponents();
})
);
beforeEach(() => {
fixture = TestBed.createComponent(DiagramComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should check on change check maxLengthLeft', () => {
component.list = [
{
name1: 'node1dsvsdsvd',
name2: 'node2',
p1: 'Stream_publish_0',
p2: 'capability'
},
{
name1: 'node33',
name2: 'node2555',
p1: 'requirement2',
p2: 'capability11'
},
{
name1: 'namber4',
name2: 'namber3',
p1: 'requirement3',
p2: 'capability4'
}
];
component.ngOnChanges();
expect(component.maxLengthLeft).toBe(16);
});
it('should check on change check maxLengthRight', () => {
component.list = [
{
name1: 'node1dsvsdsvd',
name2: 'node2',
p1: 'Stream_publish_0',
p2: 'capability'
},
{
name1: 'node33',
name2: 'node2555',
p1: 'requirement2',
p2: 'capability11'
},
{
name1: 'namber4',
name2: 'namber3',
p1: 'requirement3',
p2: 'capability4'
}
];
component.ngOnChanges();
expect(component.maxLengthRight).toBe(12);
});
it('should check on change check maxWidth', () => {
component.list = [
{
name1: 'node1dsvsdsvd',
name2: 'node2',
p1: 'Stream_publish_0',
p2: 'capability'
},
{
name1: 'node33',
name2: 'node2555',
p1: 'requirement2',
p2: 'capability11'
},
{
name1: 'namber4',
name2: 'namber3',
p1: 'requirement3',
p2: 'capability4'
}
];
component.ngOnChanges();
// expect(component.maxWidth).toBe(550);
});
});
|