File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,31 @@ See the [Testing Rails Applications](https://guides.rubyonrails.org/testing.html
258
258
259
259
If you run a single file's tests (` bin/rails test test/models/user_test.rb ` ), ` test:prepare ` will not run before it.
260
260
261
+ ### Import syntax from ` @rails/ujs ` is modified
262
+
263
+ Starting from Rails 7.1, the syntax for importing modules from ` @rails/ujs ` is modified. Rails no longer supports the
264
+ direct import of a module from ` @rails/ujs ` .
265
+
266
+ For example, attempting to import a function from the library will fail:
267
+
268
+ \` ``
269
+ import { fileInputSelector } from "@rails/ujs "
270
+ #=> export 'fileInputSelector' (imported as 'fileInputSelector') was not found in '@rails/ujs ' (possible exports: default)
271
+ \` ``
272
+
273
+ In Rails 7.1, users should first import the Rails object directly from ` @rails/ujs ` .
274
+ Users can then import specific modules from the Rails object.
275
+
276
+ An example of imports in Rails 7.1 is shown below:
277
+
278
+ ``` javascript
279
+ import Rails from " @rails/ujs"
280
+ // Alias the method
281
+ const fileInputSelector = Rails .fileInputSelector
282
+ // Alternatively, reference it from the Rails object where it is used
283
+ Rails .fileInputSelector (... )
284
+ ```
285
+
261
286
### ` ActionView::TestCase#rendered ` no longer returns a ` String `
262
287
263
288
Starting from Rails 7.1, ` ActionView::TestCase#rendered ` returns an object that
You can’t perform that action at this time.
0 commit comments