File tree 2 files changed +52
-0
lines changed
E2ETest/ServerExecutionTests
testassets/Components.TestServer/RazorComponents/Pages 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -64,4 +64,20 @@ public void CanPerformStreamingRendering()
64
64
Browser . FindElement ( By . Id ( "end-response-link" ) ) . Click ( ) ;
65
65
Browser . Equal ( "Finished" , ( ) => getStatusText ( ) . Text ) ;
66
66
}
67
+
68
+ [ Fact ]
69
+ public void CanPerformFormPostWithStreamedResponses ( )
70
+ {
71
+ Navigate ( $ "{ ServerPathBase } /form-streaming") ;
72
+
73
+ // Initial "waiting" state
74
+ var submit = Browser . Exists ( By . CssSelector ( "input[type=submit]" ) ) ;
75
+ var getStatusText = ( ) => Browser . Exists ( By . Id ( "status" ) ) ;
76
+ Assert . Equal ( "" , getStatusText ( ) . Text ) ;
77
+
78
+ submit . Click ( ) ;
79
+
80
+ Assert . Equal ( "Processing form..." , getStatusText ( ) . Text ) ;
81
+ Assert . Equal ( "Completed" , getStatusText ( ) . Text ) ;
82
+ }
67
83
}
Original file line number Diff line number Diff line change
1
+ @page " /form-streaming"
2
+ @using Microsoft .AspNetCore .Components .Forms
3
+ @attribute [StreamRendering(true)]
4
+
5
+ <h1 >Streaming Rendering</h1 >
6
+
7
+ @* This just sets the context for the binding, this happens normally inside RouteView *@
8
+ <CascadingModelBinder Name =" /form-streaming" >
9
+ <EditForm id =" process" method =" POST" OnValidSubmit =" ProcessForm" >
10
+ <input type =" submit" value =" Process form" />
11
+ </EditForm >
12
+ </CascadingModelBinder >
13
+
14
+ <p id =" status" >
15
+ @if (_processing )
16
+ {
17
+ <text >Processing form .. .</text >
18
+ }
19
+ else if (_done )
20
+ {
21
+ <text >Completed </text >
22
+ }
23
+ </p >
24
+
25
+ @code {
26
+ bool _processing = false ;
27
+ bool _done = false ;
28
+
29
+ private async Task ProcessForm ()
30
+ {
31
+ _processing = true ;
32
+ await Task .Yield ();
33
+ _processing = false ;
34
+ _done = true ;
35
+ }
36
+ }
You can’t perform that action at this time.
0 commit comments