File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,13 @@ def turbo_page_requires_reload
43
43
provide :head , turbo_page_requires_reload_tag
44
44
end
45
45
46
+ # Configure whether to use the View Transitions API when navigating to a new page.
47
+ # See +turbo_use_view_transition_tag+.
48
+ def turbo_use_view_transition
49
+ provide :head , turbo_use_view_transition_tag
50
+ end
51
+
52
+
46
53
# See +turbo_page_requires_reload+.
47
54
def turbo_page_requires_reload_tag
48
55
tag . meta ( name : "turbo-visit-control" , content : "reload" )
@@ -83,5 +90,10 @@ def turbo_refresh_scroll_tag(scroll = :reset)
83
90
raise ArgumentError , "Invalid scroll option '#{ scroll } '" unless scroll . in? ( %i[ reset preserve ] )
84
91
tag . meta ( name : "turbo-refresh-scroll" , content : scroll )
85
92
end
93
+
94
+ # See +turbo_use_view_transition+.
95
+ def turbo_use_view_transition_tag
96
+ tag . meta ( name : "view-transition" , content : "same-origin" )
97
+ end
86
98
end
87
99
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ class Turbo::DriveHelperTest < ActionDispatch::IntegrationTest
16
16
assert_match ( /<meta name="turbo-refresh-method" content="morph">/ , @response . body )
17
17
assert_match ( /<meta name="turbo-refresh-scroll" content="preserve">/ , @response . body )
18
18
end
19
+
20
+ test "using view transition" do
21
+ get trays_path
22
+ assert_match ( /<meta name="view-transition" content="same-origin">/ , @response . body )
23
+ end
19
24
end
20
25
21
26
class Turbo ::DriverHelperUnitTest < ActionView ::TestCase
Original file line number Diff line number Diff line change 1
1
<% turbo_exempts_page_from_cache %>
2
2
<% turbo_page_requires_reload %>
3
3
<%= turbo_refreshes_with method: :morph, scroll: :preserve %>
4
+ <%= turbo_use_view_transition %>
4
5
5
6
< p > Not in the cache!</ p >
You can’t perform that action at this time.
0 commit comments