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' ;
23
34const $scope = require ( '$scope' ) ;
45const templateSrv = { } ;
56const dashboard = { } ;
67const ctrl = require ( 'ctrl' ) ;
78const $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=' ;
129
1310describe ( 'Test Global $GF utils' , ( ) => {
1411 describe ( 'utils ID' , ( ) => {
@@ -20,31 +17,15 @@ describe('Test Global $GF utils', () => {
2017 } ) ;
2118 } ) ;
2219
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-
3920 // Test if eval javascript works
4021 describe ( 'Secure Eval' , ( ) => {
4122 let variables ;
42- beforeAll ( ( ) => {
23+ beforeAll ( ( ) => {
4324 variables = GFVariables . create ( ) ;
44- } )
45- afterAll ( ( ) => {
25+ } ) ;
26+ afterAll ( ( ) => {
4627 variables = GFVariables . create ( ) ;
47- } )
28+ } ) ;
4829 it ( 'should be enable to understand Math Lib' , ( ) => {
4930 expect ( variables . eval ( 'Math.random()' ) ) . toBeGreaterThan ( 0 ) ;
5031 expect ( variables . eval ( 'Math.random() * 100' ) ) . toBeLessThanOrEqual ( 101 ) ;
@@ -57,14 +38,14 @@ describe('Test Global $GF utils', () => {
5738 // Test if globalvariables
5839 describe ( 'Variables' , ( ) => {
5940 let variables , key , value , text_entry , text_result ;
60- beforeEach ( ( ) => {
41+ beforeEach ( ( ) => {
6142 key = '_value' ;
6243 value = 12345 ;
6344 text_entry = 'My text is ${_value} at this time' ;
6445 text_result = 'My text is 12345 at this time' ;
6546 variables = GFVariables . create ( ) ;
6647 } ) ;
67- beforeEach ( ( ) => {
48+ beforeEach ( ( ) => {
6849 variables . clear ( ) ;
6950 } ) ;
7051 test ( 'Should be not null' , ( ) => {
@@ -199,7 +180,7 @@ describe('Test Global $GF utils', () => {
199180 pr . then ( ( ) => {
200181 expect ( step ) . toBe ( 1 ) ;
201182 expect ( myTimer . isFinished ( ) ) . toBeTruthy ( ) ;
202- } )
183+ } ) ;
203184 } ) ;
204185 test . skip ( 'start with wait' , async ( ) => {
205186 myTimer . addStep ( fn . bind ( this ) , stepTime ) ;
0 commit comments