11import * as React from 'react' ;
2- import * as go from 'gojs' ;
3- import { Diagram } from 'gojs' ;
2+ import {
3+ Diagram ,
4+ GraphObject ,
5+ Spot ,
6+ Node ,
7+ Shape ,
8+ TextBlock ,
9+ Group ,
10+ Panel ,
11+ Binding ,
12+ Placeholder ,
13+ Size ,
14+ LayeredDigraphLayout
15+ } from 'gojs' ;
416import { mount } from 'enzyme' ;
517import GojsDiagram , { GojsModel } from './GojsDiagram' ;
618import { ModelChangeEventType } from './modelChangeEvent' ;
@@ -30,44 +42,44 @@ describe('<GojsDiagram />', () => {
3042 } ;
3143
3244 const createDiagram = ( diagramId : string ) : Diagram => {
33- const $ = go . GraphObject . make ;
45+ const $ = GraphObject . make ;
3446
35- const myDiagram : Diagram = $ ( go . Diagram , diagramId , {
36- initialContentAlignment : go . Spot . LeftCenter
47+ const myDiagram : Diagram = $ ( Diagram , diagramId , {
48+ initialContentAlignment : Spot . LeftCenter
3749 } ) ;
3850
3951 myDiagram . nodeTemplate = $ (
40- go . Node ,
52+ Node ,
4153 'Auto' ,
42- $ ( go . Shape , 'RoundedRectangle' , { strokeWidth : 0 } , new go . Binding ( 'fill' , 'color' ) ) ,
43- $ ( go . TextBlock , { margin : 8 } , new go . Binding ( 'text' , 'key' ) ) ,
44- makePort ( portTo , go . Spot . LeftCenter , false , true ) ,
45- makePort ( portFrom , go . Spot . RightCenter , true , false )
54+ $ ( Shape , 'RoundedRectangle' , { strokeWidth : 0 } , new Binding ( 'fill' , 'color' ) ) ,
55+ $ ( TextBlock , { margin : 8 } , new Binding ( 'text' , 'key' ) ) ,
56+ makePort ( portTo , Spot . LeftCenter , false , true ) ,
57+ makePort ( portFrom , Spot . RightCenter , true , false )
4658 ) ;
4759
4860 myDiagram . groupTemplate = $ (
49- go . Group ,
61+ Group ,
5062 'Vertical' ,
5163 $ (
52- go . Panel ,
64+ Panel ,
5365 'Auto' ,
54- $ ( go . Shape , 'RoundedRectangle' , {
66+ $ ( Shape , 'RoundedRectangle' , {
5567 parameter1 : 14 ,
5668 fill : 'rgba(128,128,128,0.33)'
5769 } ) ,
58- $ ( go . Placeholder , { padding : 5 } )
70+ $ ( Placeholder , { padding : 5 } )
5971 ) ,
60- $ ( go . TextBlock , { alignment : go . Spot . Right , font : 'Bold 12pt Sans-Serif' } , new go . Binding ( 'text' , 'key' ) )
72+ $ ( TextBlock , { alignment : Spot . Right , font : 'Bold 12pt Sans-Serif' } , new Binding ( 'text' , 'key' ) )
6173 ) ;
6274
6375 return myDiagram ;
6476 } ;
6577
66- const makePort = ( name : string , spot : go . Spot , isOutput : boolean , isInput : boolean ) => {
67- const $ = go . GraphObject . make ;
68- return $ ( go . Shape , 'Circle' , {
78+ const makePort = ( name : string , spot : Spot , isOutput : boolean , isInput : boolean ) => {
79+ const $ = GraphObject . make ;
80+ return $ ( Shape , 'Circle' , {
6981 fill : 'black' ,
70- desiredSize : new go . Size ( 8 , 8 ) ,
82+ desiredSize : new Size ( 8 , 8 ) ,
7183 alignment : spot ,
7284 alignmentFocus : spot ,
7385 fromSpot : spot ,
@@ -83,7 +95,7 @@ describe('<GojsDiagram />', () => {
8395
8496 const updateDiagramProps = ( myDiagram : Diagram ) : void => {
8597 // The function could kept empty or we can add diagram properties that we wish to change. The reason to make this function user defined is to give more customization options to user. And also, its bit difficult to cover all the use cases of the charting library.
86- myDiagram . layout = go . GraphObject . make ( go . LayeredDigraphLayout , { direction : 90 } ) ;
98+ myDiagram . layout = GraphObject . make ( LayeredDigraphLayout , { direction : 90 } ) ;
8799 } ;
88100
89101 const myDiagramId = 'myDiagramId' ;
0 commit comments