@@ -209,6 +209,30 @@ describe('<Node />', () => {
209209 expect ( nodeComponent . find ( '.nodeNameBase' ) . prop ( 'style' ) ) . toBe ( fixture . node . name ) ;
210210 } ) ;
211211
212+ describe ( 'Node Element' , ( ) => {
213+ // TODO: DEPRECATE in v2
214+ it ( 'renders legacy `<circle />` if `props.circleRadius` is defined' , ( ) => {
215+ const props = { ...mockProps , circleRadius : 99 } ;
216+ const renderedComponent = shallow ( < Node { ...props } /> ) ;
217+
218+ expect ( renderedComponent . find ( 'circle' ) . length ) . toBe ( 1 ) ;
219+ expect ( renderedComponent . find ( 'circle' ) . prop ( 'r' ) ) . toBe ( 99 ) ;
220+ } ) ;
221+
222+ it ( 'renders the appropriate SVG element if `props.nodeSvgShape` is defined' , ( ) => {
223+ const props = { ...mockProps , nodeSvgShape : { shape : 'rect' , shapeProps : { y : 123 } } } ;
224+ const renderedComponent = shallow ( < Node { ...props } /> ) ;
225+ expect ( renderedComponent . find ( 'rect' ) . length ) . toBe ( 1 ) ;
226+ expect ( renderedComponent . find ( 'rect' ) . prop ( 'y' ) ) . toBe ( 123 ) ;
227+ } ) ;
228+
229+ it ( 'renders nothing if `nodeSvgShape.shape` is set to `none`' , ( ) => {
230+ const props = { ...mockProps , nodeSvgShape : { shape : 'none' } } ;
231+ const renderedComponent = shallow ( < Node { ...props } /> ) ;
232+ expect ( renderedComponent . instance ( ) . renderNodeElement ( { } ) ) . toBe ( null ) ;
233+ } ) ;
234+ } ) ;
235+
212236 describe ( 'Node Label' , ( ) => {
213237 it ( 'renders a SvgTextElement by default' , ( ) => {
214238 const renderedComponent = shallow ( < Node { ...mockProps } /> ) ;
@@ -223,15 +247,6 @@ describe('<Node />', () => {
223247 } ) ;
224248 } ) ;
225249
226- // TODO: DEPRECATE in v2
227- it ( 'falls back to legacy `<circle />` prop only if `circleRadius` is defined' , ( ) => {
228- const props = { ...mockProps , circleRadius : 99 } ;
229- const renderedComponent = shallow ( < Node { ...props } /> ) ;
230-
231- expect ( renderedComponent . find ( 'circle' ) . length ) . toBe ( 1 ) ;
232- expect ( renderedComponent . find ( 'circle' ) . prop ( 'r' ) ) . toBe ( 99 ) ;
233- } ) ;
234-
235250 // TODO: Find a way to meaningfully test `componentWillLeave`
236251
237252 // it('regresses to its parent coords when unmounting/leaving', () => {
0 commit comments