33 */
44
55/* eslint-disable react/no-string-refs */
6+
67import React , { Fragment , Component } from 'react' ;
78import { createRenderer } from 'react-test-renderer/shallow' ;
89import { mount } from 'enzyme' ;
@@ -284,7 +285,6 @@ describe('reactElementToJSXString(ReactElement)', () => {
284285
285286 it ( 'reactElementToJSXString(<div z="3" a="1" b="2"/>, {sortProps: false})' , ( ) => {
286287 /* eslint react/jsx-sort-props: 0 */
287-
288288 expect (
289289 reactElementToJSXString ( < div z = "3" a = "1" b = "2" /> , {
290290 sortProps : false ,
@@ -692,7 +692,6 @@ describe('reactElementToJSXString(ReactElement)', () => {
692692 ) ;
693693 }
694694 }
695-
696695 MyDecorator . displayName = `${ ComposedComponent . name } -Decorated` ;
697696 return MyDecorator ;
698697 }
@@ -963,20 +962,20 @@ describe('reactElementToJSXString(ReactElement)', () => {
963962 '<This should take precedence />'
964963 ) ;
965964 } ) ;
965+
966966 // maxInlineAttributesLineLength tests
967967 // Validate two props will stay inline if their length is less than the option
968-
969968 it ( 'reactElementToJSXString(<div aprop="1" bprop="2" />, { maxInlineAttributesLineLength: 100 }))' , ( ) => {
970969 expect (
971970 reactElementToJSXString ( < div aprop = "1" bprop = "2" /> , {
972971 maxInlineAttributesLineLength : 100 ,
973972 } )
974973 ) . toEqual ( '<div aprop="1" bprop="2" />' ) ;
975974 } ) ;
975+
976976 // Validate one prop will go to new line if length is greater than option. One prop is a special case since
977977 // the old logic operated on whether or not two or more attributes were present. Making sure this overrides
978978 // that older logic
979-
980979 it ( 'reactElementToJSXString(<div aprop="1"/>, { maxInlineAttributesLineLength: 5 }))' , ( ) => {
981980 expect (
982981 reactElementToJSXString ( < div aprop = "1" /> , {
@@ -986,8 +985,8 @@ describe('reactElementToJSXString(ReactElement)', () => {
986985 aprop="1"
987986/>` ) ;
988987 } ) ;
989- // Validate two props will go be multiline if their length is greater than the given option
990988
989+ // Validate two props will go be multiline if their length is greater than the given option
991990 it ( 'reactElementToJSXString(<div aprop="1" bprop="2" />, { maxInlineAttributesLineLength: 10 }))' , ( ) => {
992991 expect (
993992 reactElementToJSXString ( < div aprop = "1" bprop = "2" /> , {
@@ -998,9 +997,9 @@ describe('reactElementToJSXString(ReactElement)', () => {
998997 bprop="2"
999998/>` ) ;
1000999 } ) ;
1000+
10011001 // Same tests as above but with elements that have children. The closing braces for elements with children and without children
10021002 // run through different code paths so we have both sets of test to specify the behavior of both when this option is present
1003-
10041003 it ( 'reactElementToJSXString(<div aprop="1" bprop="2">content</div>, { maxInlineAttributesLineLength: 100 }))' , ( ) => {
10051004 expect (
10061005 reactElementToJSXString (
@@ -1045,8 +1044,8 @@ describe('reactElementToJSXString(ReactElement)', () => {
10451044 content
10461045</div>` ) ;
10471046 } ) ;
1048- // Multi-level inline attribute test
10491047
1048+ // Multi-level inline attribute test
10501049 it ( 'reactElementToJSXString(<div><div>content</div></div>, { maxInlineAttributesLineLength: 24 }))' , ( ) => {
10511050 expect (
10521051 reactElementToJSXString (
@@ -1080,9 +1079,7 @@ describe('reactElementToJSXString(ReactElement)', () => {
10801079
10811080 it ( 'sends the original fn to functionValue' , ( ) => {
10821081 const fn = ( ) => { } ;
1083-
10841082 const functionValue = ( receivedFn ) => expect ( receivedFn ) . toBe ( fn ) ;
1085-
10861083 reactElementToJSXString ( < div fn = { fn } /> , {
10871084 functionValue,
10881085 } ) ;
@@ -1159,7 +1156,9 @@ describe('reactElementToJSXString(ReactElement)', () => {
11591156 } }
11601157 />
11611158 ) ;
1159+
11621160 const insideString = reactElementToJSXString ( inside ) ;
1161+
11631162 return (
11641163 < div >
11651164 { insideString }
@@ -1285,7 +1284,6 @@ describe('reactElementToJSXString(ReactElement)', () => {
12851284
12861285 it ( 'should stringify `Suspense` correctly' , ( ) => {
12871286 const Spinner = ( ) => null ;
1288-
12891287 const ProfilePage = ( ) => null ;
12901288
12911289 expect (
@@ -1318,7 +1316,6 @@ describe('reactElementToJSXString(ReactElement)', () => {
13181316
13191317 it ( 'should stringify `Contex.Provider` correctly' , ( ) => {
13201318 const Ctx = React . createContext ( ) ;
1321-
13221319 const App = ( ) => { } ;
13231320
13241321 expect (
@@ -1351,7 +1348,6 @@ describe('reactElementToJSXString(ReactElement)', () => {
13511348
13521349 it ( 'should stringify `Contex.Consumer` correctly' , ( ) => {
13531350 const Ctx = React . createContext ( ) ;
1354-
13551351 const Button = ( ) => null ;
13561352
13571353 expect (
0 commit comments