blob: 54b3dbed245819564414a0eae2c633dc76e9ffde (
plain)
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
|
import {async} from "@angular/core/testing";
import {ComponentInstanceNodesStyle} from "./component-instances-nodes-style";
describe('component instance nodes style component', () => {
beforeEach(
async(() => {
const createElement = document.createElement.bind(document);
document.createElement = (tagName) => {
if (tagName === 'canvas') {
return {
getContext: () => ({
font: "",
measureText: (x) => ({width: x.length})
}),
};
}
return createElement(tagName);
};
})
);
it('verify getGraphDisplayName for String.length smaller than 67 chars', () => {
let inputString = 'SomeText';
let expectedRes = inputString;
let res = ComponentInstanceNodesStyle.getGraphDisplayName(inputString);
expect(res).toBe(expectedRes);
});
it('verify getGraphDisplayName for String.length greater than 67 chars', () => {
let inputString = 'AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDDDDDDDDDDEEEEEEEEEEFFFFFFFFFFGGGGGGGGGG12345678';
let expectedRes = 'AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDDDDDDDDDDEEEEEEEEEEFFFFFFFFF...';
let res = ComponentInstanceNodesStyle.getGraphDisplayName(inputString);
expect(res).toBe(expectedRes);
});
}
|