File tree 3 files changed +28
-1
lines changed
3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -92,8 +92,9 @@ export class Navigator {
92
92
this . view . clearSnapshotCache ( )
93
93
}
94
94
95
+ const action = this . getActionForFormSubmission ( formSubmission )
95
96
const { statusCode } = fetchResponse
96
- const visitOptions = { response : { statusCode, responseHTML } }
97
+ const visitOptions = { action , response : { statusCode, responseHTML } }
97
98
this . proposeVisit ( fetchResponse . location , visitOptions )
98
99
}
99
100
}
Original file line number Diff line number Diff line change @@ -37,6 +37,18 @@ <h1>Navigation</h1>
37
37
< p > < a id ="same-origin-replace-link " href ="/src/tests/fixtures/one.html " data-turbo-action ="replace "> Same-origin data-turbo-action=replace link</ a > </ p >
38
38
< p > < form id ="same-origin-replace-form-get " action ="/src/tests/fixtures/one.html " data-turbo-action ="replace "> < button > Same-origin data-turbo-action=replace form</ button > </ form > </ p >
39
39
< p > < form id ="same-origin-replace-form-submitter-get " action ="/src/tests/fixtures/one.html "> < button data-turbo-action ="replace "> Same-origin data-turbo-action=replace form</ button > </ form > </ p >
40
+ < p >
41
+ < form id ="same-origin-replace-form-post " method ="post " action ="/__turbo/redirect " data-turbo-action ="replace ">
42
+ < input type ="hidden " name ="path " value ="/src/tests/fixtures/one.html ">
43
+ < button > Same-origin form[method="post"][data-turbo-action=replace]</ button >
44
+ </ form >
45
+ </ p >
46
+ < p >
47
+ < form id ="same-origin-replace-form-submitter-post " method ="post " action ="/__turbo/redirect ">
48
+ < input type ="hidden " name ="path " value ="/src/tests/fixtures/one.html ">
49
+ < button data-turbo-action ="replace "> Same-origin form[method="post"] button[data-turbo-action=replace]</ button >
50
+ </ form >
51
+ </ p >
40
52
< p > < a id ="same-origin-false-link " href ="/src/tests/fixtures/one.html " data-turbo ="false "> Same-origin data-turbo=false link</ a > </ p >
41
53
< p data-turbo ="false "> < a id ="same-origin-unannotated-link-inside-false-container " href ="/src/tests/fixtures/one.html "> Same-origin unannotated link inside data-turbo=false container</ a > </ p >
42
54
< p data-turbo ="false "> < a id ="same-origin-true-link-inside-false-container " href ="/src/tests/fixtures/one.html " data-turbo ="true "> Same-origin data-turbo=true link inside data-turbo=false container</ a > </ p >
Original file line number Diff line number Diff line change @@ -77,6 +77,20 @@ export class NavigationTests extends TurboDriveTestCase {
77
77
this . assert . equal ( await this . visitAction , "replace" )
78
78
}
79
79
80
+ async "test following a same-origin POST form[data-turbo-action=replace]" ( ) {
81
+ this . clickSelector ( "#same-origin-replace-form-post button" )
82
+ await this . nextBody
83
+ this . assert . equal ( await this . pathname , "/src/tests/fixtures/one.html" )
84
+ this . assert . equal ( await this . visitAction , "replace" )
85
+ }
86
+
87
+ async "test following a same-origin POST form button[data-turbo-action=replace]" ( ) {
88
+ this . clickSelector ( "#same-origin-replace-form-submitter-post button" )
89
+ await this . nextBody
90
+ this . assert . equal ( await this . pathname , "/src/tests/fixtures/one.html" )
91
+ this . assert . equal ( await this . visitAction , "replace" )
92
+ }
93
+
80
94
async "test following a same-origin data-turbo=false link" ( ) {
81
95
this . clickSelector ( "#same-origin-false-link" )
82
96
await this . nextBody
You can’t perform that action at this time.
0 commit comments