@@ -26,8 +26,6 @@ function createReactEventComponent({
2626 onMount,
2727 onUnmount,
2828 onOwnershipChange,
29- allowMultipleHostChildren,
30- allowEventHooks,
3129} ) {
3230 const testEventResponder = {
3331 displayName : 'TestEventComponent' ,
@@ -39,8 +37,6 @@ function createReactEventComponent({
3937 onMount,
4038 onUnmount,
4139 onOwnershipChange,
42- allowMultipleHostChildren : allowMultipleHostChildren || false ,
43- allowEventHooks : allowEventHooks || true ,
4440 } ;
4541
4642 return React . unstable_createEvent ( testEventResponder ) ;
@@ -822,133 +818,6 @@ describe('DOMEventResponderSystem', () => {
822818 expect ( container . innerHTML ) . toBe ( '<button>Click me!</button>' ) ;
823819 } ) ;
824820
825- it ( 'should warn if multiple host components are detected without allowMultipleHostChildren' , ( ) => {
826- const EventComponent = createReactEventComponent ( {
827- targetEventTypes : [ ] ,
828- onEvent : ( ) => { } ,
829- allowMultipleHostChildren : false ,
830- } ) ;
831-
832- const Test = ( ) => (
833- < EventComponent >
834- < div />
835- < div />
836- </ EventComponent >
837- ) ;
838-
839- expect ( ( ) => {
840- ReactDOM . render ( < Test /> , container ) ;
841- } ) . toWarnDev (
842- 'Warning: A "<TestEventComponent>" event component cannot contain multiple host children.' ,
843- ) ;
844-
845- function Component ( ) {
846- return < div /> ;
847- }
848-
849- const Test2 = ( ) => (
850- < EventComponent >
851- < div />
852- < Component />
853- </ EventComponent >
854- ) ;
855-
856- expect ( ( ) => {
857- ReactDOM . render ( < Test2 /> , container ) ;
858- } ) . toWarnDev (
859- 'Warning: A "<TestEventComponent>" event component cannot contain multiple host children.' ,
860- ) ;
861- } ) ;
862-
863- it ( 'should handle suspended nodes correctly when detecting host components without allowMultipleHostChildren' , ( ) => {
864- const EventComponent = createReactEventComponent ( {
865- targetEventTypes : [ ] ,
866- onEvent : ( ) => { } ,
867- allowMultipleHostChildren : false ,
868- } ) ;
869-
870- function SuspendedComponent ( ) {
871- throw Promise . resolve ( ) ;
872- }
873-
874- function Component ( ) {
875- return (
876- < React . Fragment >
877- < div />
878- < SuspendedComponent />
879- </ React . Fragment >
880- ) ;
881- }
882-
883- const Test = ( ) => (
884- < EventComponent >
885- < React . Suspense fallback = { < div > Loading...</ div > } >
886- < Component />
887- </ React . Suspense >
888- </ EventComponent >
889- ) ;
890-
891- ReactDOM . render ( < Test /> , container ) ;
892-
893- function Component2 ( ) {
894- return (
895- < React . Fragment >
896- < SuspendedComponent />
897- </ React . Fragment >
898- ) ;
899- }
900-
901- const Test2 = ( ) => (
902- < EventComponent >
903- < React . Suspense
904- fallback = {
905- < React . Fragment >
906- < div />
907- < div />
908- </ React . Fragment >
909- } >
910- < Component2 />
911- </ React . Suspense >
912- </ EventComponent >
913- ) ;
914-
915- expect ( ( ) => {
916- ReactDOM . render ( < Test2 /> , container ) ;
917- } ) . toWarnDev (
918- 'Warning: A "<TestEventComponent>" event component cannot contain multiple host children.' ,
919- ) ;
920- } ) ;
921-
922- it ( 'should not warn if multiple host components are detected with allowMultipleHostChildren' , ( ) => {
923- const EventComponent = createReactEventComponent ( {
924- targetEventTypes : [ ] ,
925- onEvent : ( ) => { } ,
926- allowMultipleHostChildren : true ,
927- } ) ;
928-
929- const Test = ( ) => (
930- < EventComponent >
931- < div />
932- < div />
933- </ EventComponent >
934- ) ;
935-
936- ReactDOM . render ( < Test /> , container ) ;
937-
938- function Component ( ) {
939- return < div /> ;
940- }
941-
942- const Test2 = ( ) => (
943- < EventComponent >
944- < div />
945- < Component />
946- </ EventComponent >
947- ) ;
948-
949- ReactDOM . render ( < Test2 /> , container ) ;
950- } ) ;
951-
952821 it ( 'should work with event component hooks' , ( ) => {
953822 const buttonRef = React . createRef ( ) ;
954823 const eventLogs = [ ] ;
0 commit comments