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