1
- import { $GF , GFDrawioTools , GFTimer , GFVariables } from '../src/globals_class' ;
1
+ import { $GF , GFTimer , GFVariables } from '../src/globals_class' ;
2
+ import { GFDrawio } from '../src/drawio_base' ;
2
3
3
4
const $scope = require ( '$scope' ) ;
4
5
const templateSrv = { } ;
5
6
const dashboard = { } ;
6
7
const ctrl = require ( 'ctrl' ) ;
7
8
const $gf = $GF . create ( $scope , templateSrv , dashboard , ctrl ) ;
8
- const xmlGraph =
9
- '<mxGraphModel dx="1073" dy="521" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="arrow-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;jettySize=auto;orthogonalLoop=1;strokeWidth=4;shadow=1;" parent="1" source="shape-grafana" target="shape-love" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell><object label="Grafana" href="www.google.fr" id="shape-grafana"><mxCell style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;shadow=1;" parent="1" vertex="1"><mxGeometry x="10" y="10" width="120" height="60" as="geometry"/></mxCell></object><mxCell id="arrow-2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;jettySize=auto;orthogonalLoop=1;strokeWidth=4;shadow=1;" parent="1" source="shape-love" target="shape-mxgraph" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="shape-love" value="loves" style="triangle;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;shadow=1;" parent="1" vertex="1"><mxGeometry x="210" width="60" height="80" as="geometry"/></mxCell><mxCell id="shape-mxgraph" value="mxGraph" style="ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;shadow=1;" parent="1" vertex="1"><mxGeometry x="340" width="120" height="80" as="geometry"/></mxCell><mxCell id="text-grafana" value="MyText : TextVal" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1"><mxGeometry x="9" y="50" width="120" height="20" as="geometry"/></mxCell><mxCell id="text-arrow1" value="Text 2" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1"><mxGeometry x="150" y="20" width="40" height="20" as="geometry"/></mxCell><mxCell id="text-arrow2" value="Text 3" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1"><mxGeometry x="280" y="20" width="40" height="20" as="geometry"/></mxCell><mxCell id="text-mxgraph" value="Text 4" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1"><mxGeometry x="380" y="50" width="40" height="20" as="geometry"/></mxCell></root></mxGraphModel>' ;
10
- const compGraph =
11
- '7ZfBcpswEIafxsdkANnYPiZO6h6akzttepTRAkoF65FlA336SiAMCnbGnnHSmUwvtvZfLYhvdyUYkUVWLiXdpE/IQIwCj5Uj8jAKAt+bEv1nlKpRJoHfCInkzE7qhBX/A22kVXecwdaZqBCF4htXjDDPIVKORqXEwp0Wo3DvuqGJvaPXCauIChhM+8mZSht1Fkw7/SvwJG3v7IfzxpPRdrK98DalDIueRB5HZCERVTPKygUIA6/l0sR9OeE9LExCrs4JqGnc2LCtqtonBKYf2JooVYoJ5lQ8duq9xF3OwFzG01aqMqGHvh5CydVzb/zLTLmdWOuhtBG1UbVGrmT13Dd6UcbswmqrjXsBpSpbH3SnUEvdar8hbuw6tkri70OuxkZpwRv3kFpLBHcyskh0xAZuEkljmlNbdFQmoPpugXtofIZg71oW/xIwA/0EeoIEQRXfuyVFbWUmh3ld8vTA5q82cf1iajvwBF2DaMKW/dWlEuJGLoriNkFMBNzGsnG2BTB4KrdOeiXRJdwgK1KuYLWhNZ1Ct7lbBDEXYoECZR1L4hjCKDokoudh0/na885OyB6kgvJNroddpomoXLPo+tVvmzDt9WroXZwIbdpcvNVjwf8eO7fHuiYaNlhWJuZM+aAeG+Ty9QL3VOzs1Y24HSRZSU7zpM7mZS0DPpvA9FjLzMMpoeE7tMyxJgmP9Mjs8h45AdLJZo+lfXMYtowQ+oy/HKZGOWPjYzBnwZqE7wGTjM/cca5BU69JuUdTD+ZT9V27tTYid/rXGD+oGFaqmeRAdGHlmMMrslaigie5NiNNC7R+byhx/bp0Zx0ZZ+xkC7ib3BXIz52Nf3JmGoJrpaHe7v1BFmwOhsfAp+HuT9wjNxiSH787+OAUePJ5wR+2kH8E/tQubsmPPy958or8kc3mSuS12X0V1r7etzV5/As=' ;
12
9
13
10
describe ( 'Test Global $GF utils' , ( ) => {
14
11
describe ( 'utils ID' , ( ) => {
@@ -20,31 +17,15 @@ describe('Test Global $GF utils', () => {
20
17
} ) ;
21
18
} ) ;
22
19
23
- // Test if encode/decode data from draw.io works
24
- describe ( 'Encode/Decode' , ( ) => {
25
- test ( 'Should Decode' , ( ) => {
26
- expect ( GFDrawioTools . decode ( compGraph ) ) . toBe ( xmlGraph ) ;
27
- } ) ;
28
- test ( 'Should Encode' , ( ) => {
29
- expect ( GFDrawioTools . encode ( xmlGraph ) ) . toBe ( compGraph ) ;
30
- } ) ;
31
- test ( 'Showld Isencoded' , ( ) => {
32
- expect ( GFDrawioTools . isEncoded ( compGraph ) ) . toBeTruthy ( ) ;
33
- } ) ;
34
- test ( 'Showld ! Isencoded' , ( ) => {
35
- expect ( GFDrawioTools . isEncoded ( xmlGraph ) ) . toBeFalsy ( ) ;
36
- } ) ;
37
- } ) ;
38
-
39
20
// Test if eval javascript works
40
21
describe ( 'Secure Eval' , ( ) => {
41
22
let variables ;
42
- beforeAll ( ( ) => {
23
+ beforeAll ( ( ) => {
43
24
variables = GFVariables . create ( ) ;
44
- } )
45
- afterAll ( ( ) => {
25
+ } ) ;
26
+ afterAll ( ( ) => {
46
27
variables = GFVariables . create ( ) ;
47
- } )
28
+ } ) ;
48
29
it ( 'should be enable to understand Math Lib' , ( ) => {
49
30
expect ( variables . eval ( 'Math.random()' ) ) . toBeGreaterThan ( 0 ) ;
50
31
expect ( variables . eval ( 'Math.random() * 100' ) ) . toBeLessThanOrEqual ( 101 ) ;
@@ -57,14 +38,14 @@ describe('Test Global $GF utils', () => {
57
38
// Test if globalvariables
58
39
describe ( 'Variables' , ( ) => {
59
40
let variables , key , value , text_entry , text_result ;
60
- beforeEach ( ( ) => {
41
+ beforeEach ( ( ) => {
61
42
key = '_value' ;
62
43
value = 12345 ;
63
44
text_entry = 'My text is ${_value} at this time' ;
64
45
text_result = 'My text is 12345 at this time' ;
65
46
variables = GFVariables . create ( ) ;
66
47
} ) ;
67
- beforeEach ( ( ) => {
48
+ beforeEach ( ( ) => {
68
49
variables . clear ( ) ;
69
50
} ) ;
70
51
test ( 'Should be not null' , ( ) => {
@@ -199,7 +180,7 @@ describe('Test Global $GF utils', () => {
199
180
pr . then ( ( ) => {
200
181
expect ( step ) . toBe ( 1 ) ;
201
182
expect ( myTimer . isFinished ( ) ) . toBeTruthy ( ) ;
202
- } )
183
+ } ) ;
203
184
} ) ;
204
185
test . skip ( 'start with wait' , async ( ) => {
205
186
myTimer . addStep ( fn . bind ( this ) , stepTime ) ;
0 commit comments