@@ -36,6 +36,7 @@ describe('<Link />', () => {
3636 jest . spyOn ( Link . prototype , 'drawDiagonalPath' ) ;
3737 jest . spyOn ( Link . prototype , 'drawElbowPath' ) ;
3838 jest . spyOn ( Link . prototype , 'drawStraightPath' ) ;
39+ jest . spyOn ( Link . prototype , 'drawStepPath' ) ;
3940 jest . spyOn ( Link . prototype , 'applyOpacity' ) ;
4041 jest . spyOn ( pathFuncs , 'testPathFunc' ) ;
4142
@@ -70,13 +71,15 @@ describe('<Link />', () => {
7071 const diagonalComponent = shallow ( < Link { ...mockProps } /> ) ;
7172 const elbowComponent = shallow ( < Link { ...mockProps } pathFunc = "elbow" /> ) ;
7273 const straightComponent = shallow ( < Link { ...mockProps } pathFunc = "straight" /> ) ;
74+ const stepComponent = shallow ( < Link { ...mockProps } pathFunc = "step" /> ) ;
7375 shallow ( < Link { ...mockProps } pathFunc = { pathFuncs . testPathFunc } /> ) ;
7476
7577 expect ( diagonalComponent . instance ( ) . drawDiagonalPath ) . toHaveBeenCalled ( ) ;
7678 expect ( elbowComponent . instance ( ) . drawElbowPath ) . toHaveBeenCalled ( ) ;
7779 expect ( straightComponent . instance ( ) . drawStraightPath ) . toHaveBeenCalled ( ) ;
80+ expect ( stepComponent . instance ( ) . drawStepPath ) . toHaveBeenCalled ( ) ;
7881 expect ( pathFuncs . testPathFunc ) . toHaveBeenCalled ( ) ;
79- expect ( Link . prototype . drawPath ) . toHaveBeenCalledTimes ( 4 ) ;
82+ expect ( Link . prototype . drawPath ) . toHaveBeenCalledTimes ( 5 ) ;
8083 } ) ;
8184
8285 it ( 'returns an appropriate elbowPath according to `props.orientation`' , ( ) => {
@@ -111,6 +114,18 @@ describe('<Link />', () => {
111114 ) ;
112115 } ) ;
113116
117+ it ( 'return an appropriate stepPath according to `props.orientation`' , ( ) => {
118+ const { source, target } = linkData ;
119+ const deltaY = target . y - source . y ;
120+
121+ expect ( Link . prototype . drawStepPath ( linkData , 'horizontal' ) ) . toBe (
122+ `M${ source . y } ,${ source . x } H${ source . y + deltaY / 2 } V${ target . x } H${ target . y } ` ,
123+ ) ;
124+ expect ( Link . prototype . drawStepPath ( linkData , 'vertical' ) ) . toBe (
125+ `M${ source . x } ,${ source . y } V${ source . y + deltaY / 2 } H${ target . x } V${ target . y } ` ,
126+ ) ;
127+ } ) ;
128+
114129 it ( 'fades in once it has been mounted' , ( ) => {
115130 const fixture = 1 ;
116131 const renderedComponent = mount ( < Link { ...mockProps } /> ) ;
0 commit comments