File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -844,6 +844,25 @@ public void InputRadioGroupWorksWithMutatingSetter()
844
844
Browser . Equal ( "False" , ( ) => tuesday . GetDomProperty ( "checked" ) ) ;
845
845
}
846
846
847
+ [ Theory ]
848
+ [ InlineData ( 0 ) ]
849
+ [ InlineData ( 2 ) ]
850
+ public void InputRadioGroupWorksWithParentImplementingIHandleEvent ( int n )
851
+ {
852
+ Browser . Url = new UriBuilder ( Browser . Url ) { Query = ( $ "?n={ n } ") } . ToString ( ) ;
853
+ var appElement = Browser . MountTestComponent < InputRadioParentImplementsIHandleEvent > ( ) ;
854
+ var zero = appElement . FindElement ( By . Id ( "inputradiogroup-parent-ihandle-event-0" ) ) ;
855
+ var one = appElement . FindElement ( By . Id ( "inputradiogroup-parent-ihandle-event-1" ) ) ;
856
+
857
+ Browser . Equal ( n == 0 ? "True" : "False" , ( ) => zero . GetDomProperty ( "checked" ) ) ;
858
+ Browser . Equal ( "False" , ( ) => one . GetDomProperty ( "checked" ) ) ;
859
+
860
+ // Observe that the value can be mutated by the setter, and this shows up in the DOM
861
+ one . Click ( ) ;
862
+ Browser . Equal ( "False" , ( ) => zero . GetDomProperty ( "checked" ) ) ;
863
+ Browser . Equal ( "True" , ( ) => one . GetDomProperty ( "checked" ) ) ;
864
+ }
865
+
847
866
[ Fact ]
848
867
public void InputSelectWorksWithMutatingSetter ( )
849
868
{
Original file line number Diff line number Diff line change
1
+ @using Microsoft .AspNetCore .Components .Forms
2
+ @implements IHandleEvent
3
+
4
+ <InputRadioGroup @bind-Value =" N" >
5
+ <InputRadio id =" inputradiogroup-parent-ihandle-event-0" Value =" 0" />
6
+ <InputRadio id =" inputradiogroup-parent-ihandle-event-1" Value =" 1" />
7
+ </InputRadioGroup >
8
+
9
+ @code {
10
+
11
+ [SupplyParameterFromQuery (Name = " n" )] int ? N { get ; set ; }
12
+
13
+ Task IHandleEvent .HandleEventAsync (EventCallbackWorkItem callback , object arg ) => callback .InvokeAsync (arg );
14
+ }
Original file line number Diff line number Diff line change 49
49
<option value =" BasicTestApp.FormsTest.InputRangeComponent" >Input range</option >
50
50
<option value =" BasicTestApp.FormsTest.InputsWithoutEditForm" >Inputs without EditForm</option >
51
51
<option value =" BasicTestApp.FormsTest.InputsWithMutatingSetters" >Inputs with mutating setters</option >
52
+ <option value =" BasicTestApp.FormsTest.InputRadioParentImplementsIHandleEvent" >Input Radio Parent Implements IHandleEvent</option >
52
53
<option value =" BasicTestApp.NavigateOnSubmit" >Navigate to submit</option >
53
54
<option value =" BasicTestApp.GlobalizationBindCases" >Globalization Bind Cases</option >
54
55
<option value =" BasicTestApp.GracefulTermination" >Graceful Termination</option >
You can’t perform that action at this time.
0 commit comments