From dc40553a5f1168e539606659049e9dc9d372ffbd Mon Sep 17 00:00:00 2001 From: Victor Turansky Date: Fri, 6 Dec 2024 15:39:20 +0200 Subject: [PATCH] React 19. Remove missed test utils --- .../kotlin/react/dom/test/EventSimulator.kt | 26 ------ .../jsMain/kotlin/react/dom/test/Simulate.kt | 87 ------------------- .../src/jsMain/kotlin/react/dom/test/act.kt | 1 + .../jsMain/kotlin/react/dom/test/isElement.kt | 10 --- .../kotlin/react/dom/test/isElementOfType.kt | 14 --- .../react/dom/test/renderIntoDocument.kt | 14 --- 6 files changed, 1 insertion(+), 151 deletions(-) delete mode 100644 kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/EventSimulator.kt delete mode 100644 kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/Simulate.kt delete mode 100644 kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElement.kt delete mode 100644 kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElementOfType.kt delete mode 100644 kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/renderIntoDocument.kt diff --git a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/EventSimulator.kt b/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/EventSimulator.kt deleted file mode 100644 index d9eea875c6b5b..0000000000000 --- a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/EventSimulator.kt +++ /dev/null @@ -1,26 +0,0 @@ -package react.dom.test - -import js.objects.jso -import seskar.js.JsNative -import web.dom.Element -import web.events.EventInit - -sealed external interface EventSimulator { - @JsNative - operator fun invoke( - element: Element, /* | Component */ - ) - - @JsNative - operator fun invoke( - element: Element, /* | Component */ - options: O, - ) -} - -inline operator fun EventSimulator.invoke( - element: Element, /* | Component */ - block: O.() -> Unit, -) { - this(element, options = jso(block)) -} diff --git a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/Simulate.kt b/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/Simulate.kt deleted file mode 100644 index 6e5308b80840f..0000000000000 --- a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/Simulate.kt +++ /dev/null @@ -1,87 +0,0 @@ -@file:JsModule("react-dom/test-utils") - -package react.dom.test - -import web.animations.AnimationEventInit -import web.clipboard.ClipboardEventInit -import web.cssom.TransitionEventInit -import web.events.EventInit -import web.events.ProgressEventInit -import web.form.SubmitEventInit -import web.html.MediaEncryptedEventInit -import web.uievents.* - -/** - * Simulate an event dispatch on a DOM node with optional `eventData` event data. - * `Simulate` has a method for every event that React understands. - */ -external object Simulate { - val abort: EventSimulator - val animationEnd: EventSimulator - val animationIteration: EventSimulator - val animationStart: EventSimulator - val blur: EventSimulator - val canPlay: EventSimulator - val canPlayThrough: EventSimulator - val change: EventSimulator - val click: EventSimulator - val compositionEnd: EventSimulator - val compositionStart: EventSimulator - val compositionUpdate: EventSimulator - val contextMenu: EventSimulator - val copy: EventSimulator - val cut: EventSimulator - val doubleClick: EventSimulator - val drag: EventSimulator - val dragEnd: EventSimulator - val dragEnter: EventSimulator - val dragExit: EventSimulator - val dragLeave: EventSimulator - val dragOver: EventSimulator - val dragStart: EventSimulator - val drop: EventSimulator - val durationChange: EventSimulator - val emptied: EventSimulator - val encrypted: EventSimulator - val ended: EventSimulator - val error: EventSimulator - val focus: EventSimulator - val input: EventSimulator - val invalid: EventSimulator - val keyDown: EventSimulator - val keyPress: EventSimulator - val keyUp: EventSimulator - val load: EventSimulator - val loadStart: EventSimulator - val loadedData: EventSimulator - val loadedMetadata: EventSimulator - val mouseDown: EventSimulator - val mouseEnter: EventSimulator - val mouseLeave: EventSimulator - val mouseMove: EventSimulator - val mouseOut: EventSimulator - val mouseOver: EventSimulator - val mouseUp: EventSimulator - val paste: EventSimulator - val pause: EventSimulator - val play: EventSimulator - val playing: EventSimulator - val progress: EventSimulator - val rateChange: EventSimulator - val scroll: EventSimulator - val seeked: EventSimulator - val seeking: EventSimulator - val select: EventSimulator - val stalled: EventSimulator - val submit: EventSimulator - val suspend: EventSimulator - val timeUpdate: EventSimulator - val touchCancel: EventSimulator - val touchEnd: EventSimulator - val touchMove: EventSimulator - val touchStart: EventSimulator - val transitionEnd: EventSimulator - val volumeChange: EventSimulator - val waiting: EventSimulator - val wheel: EventSimulator -} diff --git a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/act.kt b/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/act.kt index 1b7ffa163c996..dc468e636ef04 100644 --- a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/act.kt +++ b/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/act.kt @@ -1,4 +1,5 @@ package react.dom.test + suspend fun act( block: () -> T, ): T { diff --git a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElement.kt b/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElement.kt deleted file mode 100644 index d680f74aec915..0000000000000 --- a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElement.kt +++ /dev/null @@ -1,10 +0,0 @@ -@file:JsModule("react-dom/test-utils") - -package react.dom.test - -/** - * Returns `true` if `element` is any React element. - */ -external fun isElement( - element: Any?, -): Boolean diff --git a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElementOfType.kt b/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElementOfType.kt deleted file mode 100644 index 11c05f6db463f..0000000000000 --- a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/isElementOfType.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:JsModule("react-dom/test-utils") - -package react.dom.test - -import react.ComponentType -import react.ReactElement - -/** - * Returns `true` if `element` is a React element whose type is of a React `type`. - */ -external fun isElementOfType( - element: ReactElement<*>, - type: ComponentType<*>, -): Boolean diff --git a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/renderIntoDocument.kt b/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/renderIntoDocument.kt deleted file mode 100644 index 5474c6f2f4cc5..0000000000000 --- a/kotlin-react-dom-test-utils/src/jsMain/kotlin/react/dom/test/renderIntoDocument.kt +++ /dev/null @@ -1,14 +0,0 @@ -@file:JsModule("react-dom/test-utils") - -package react.dom.test - -import react.ReactElement - -/** - * Render a React element into a detached DOM node in the document. - * - * __This function requires a DOM__. - */ -external fun renderIntoDocument( - element: ReactElement<*>, -)