File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -107,3 +107,34 @@ find . -type f -name '*.scala' -exec perl -pi -e '
107107 s/\bReactTestUtils2\b/ReactTestUtils/g;
108108' {} +
109109```
110+
111+ ### ` Simulate ` , ` SimEvent ` , ` Simulation `
112+
113+ React has removed ` Simulate ` as of React v19. It is deprecated in React v18.
114+
115+ React now recommends using [ React Testing Library] ( https://testing-library.com/react ) instead.
116+ There is no Scala.js facade for it, and even if there was it wouldn't be a drop-in replacement.
117+
118+ As a band-aid solution, there is now a new scalajs-react module called ` testing_library-dom `
119+ that builds on ` @testing-library/dom ` and
120+ provides a subset of ` Simulate ` , ` SimEvent ` , ` Simulation ` under the
121+ ` japgolly.scalajs.react.testing_library.dom ` package.
122+
123+ Unfortunately some types of events like ` Simulate.change ` do not fire and thus have been removed from the API.
124+
125+ Add this to your sbt:
126+
127+ ``` scala
128+ libraryDependencies += " com.github.japgolly.scalajs-react" %%% " testing_library-dom" % " 3.0.0" % Test
129+
130+ jsDependencies += " org.webjars.npm" % " testing-library__dom" % " 10.4.1" /
131+ " dom.umd.js" commonJSName " TestingLibraryDom" % Test
132+ ```
133+
134+ and to use it:
135+
136+ ``` scala
137+ import japgolly .scalajs .react .testing_library .dom .Simulate
138+
139+ // Simulate.click(domNode)
140+ ```
You can’t perform that action at this time.
0 commit comments