@@ -35,7 +35,6 @@ public void CanDispatchToTheDefaultForm(bool suppressEnhancedNavigation)
35
35
{
36
36
Url = "forms/default-form" ,
37
37
FormCssSelector = "form" ,
38
- ExpectedActionValue = null ,
39
38
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
40
39
} ;
41
40
DispatchToFormCore ( dispatchToForm ) ;
@@ -50,7 +49,6 @@ public void CanBindParameterToTheDefaultForm(bool suppressEnhancedNavigation)
50
49
{
51
50
Url = "forms/default-form-bound-parameter" ,
52
51
FormCssSelector = "form" ,
53
- ExpectedActionValue = null ,
54
52
InputFieldId = "Parameter" ,
55
53
InputFieldCssSelector = "input[name=Parameter]" ,
56
54
InputFieldValue = "stranger" ,
@@ -68,7 +66,7 @@ public void MultipleParametersMultipleFormsDoNotConflict(bool suppressEnhancedNa
68
66
{
69
67
Url = "forms/multiple-forms-bound-parameter-no-conflicts" ,
70
68
FormCssSelector = "form[name=bind-integer]" ,
71
- ExpectedActionValue = "forms/multiple-forms-bound-parameter-no-conflicts?handler= bind-integer" ,
69
+ ExpectedHandlerValue = "bind-integer" ,
72
70
InputFieldId = "Id" ,
73
71
InputFieldCssSelector = "form[name=bind-integer] input[name=Id]" ,
74
72
InputFieldValue = "abc" ,
@@ -94,7 +92,7 @@ public void MultipleParametersMultipleFormsBindsToCorrectForm(bool suppressEnhan
94
92
{
95
93
Url = "forms/multiple-forms-bound-parameter-no-conflicts" ,
96
94
FormCssSelector = "form[name=bind-guid]" ,
97
- ExpectedActionValue = "forms/multiple-forms-bound-parameter-no-conflicts?handler= bind-guid" ,
95
+ ExpectedHandlerValue = "bind-guid" ,
98
96
SubmitButtonId = "send-guid" ,
99
97
UpdateFormAction = ( ) =>
100
98
{
@@ -121,7 +119,6 @@ public void CanBindMultipleParametersToTheDefaultForm(bool suppressEnhancedNavig
121
119
{
122
120
Url = "forms/default-form-bound-multiple-primitive-parameters" ,
123
121
FormCssSelector = "form" ,
124
- ExpectedActionValue = null ,
125
122
UpdateFormAction = ( ) =>
126
123
{
127
124
Browser . Exists ( By . CssSelector ( "input[name=Parameter]" ) ) . Clear ( ) ;
@@ -147,7 +144,6 @@ public void CanChangeFormParameterNames(bool suppressEnhancedNavigation)
147
144
{
148
145
Url = "forms/default-form-bound-multiple-primitive-parameters-changed-names" ,
149
146
FormCssSelector = "form" ,
150
- ExpectedActionValue = null ,
151
147
UpdateFormAction = ( ) =>
152
148
{
153
149
Browser . Exists ( By . CssSelector ( "input[name=UpdatedParameter]" ) ) . Clear ( ) ;
@@ -173,7 +169,6 @@ public void CanDisplayErrorsFromMultipleParametersToTheDefaultForm(bool suppress
173
169
{
174
170
Url = "forms/default-form-bound-multiple-primitive-parameters" ,
175
171
FormCssSelector = "form" ,
176
- ExpectedActionValue = null ,
177
172
UpdateFormAction = ( ) =>
178
173
{
179
174
Browser . Exists ( By . CssSelector ( "input[name=Parameter]" ) ) . Clear ( ) ;
@@ -211,7 +206,6 @@ public void CanHandleBindingErrorsBindParameterToTheDefaultForm(bool suppressEnh
211
206
{
212
207
Url = "forms/default-form-bound-primitive-parameter" ,
213
208
FormCssSelector = "form" ,
214
- ExpectedActionValue = null ,
215
209
InputFieldId = "Parameter" ,
216
210
InputFieldCssSelector = "input[name=Parameter]" ,
217
211
InputFieldValue = "abc" ,
@@ -651,7 +645,7 @@ public void CanHandleBindingErrorsBindParameterToNamedForm(bool suppressEnhanced
651
645
{
652
646
Url = "forms/named-form-bound-primitive-parameter" ,
653
647
FormCssSelector = "form[name=named-form-handler]" ,
654
- ExpectedActionValue = "forms/named-form-bound-primitive-parameter?handler= named-form-handler" ,
648
+ ExpectedHandlerValue = "named-form-handler" ,
655
649
InputFieldId = "Parameter" ,
656
650
InputFieldCssSelector = "input[name=Parameter]" ,
657
651
InputFieldValue = "abc" ,
@@ -680,7 +674,6 @@ public void CanReadFormValuesDuringOnInitialized(bool suppressEnhancedNavigation
680
674
Url = "forms/default-form-with-body-on-initialized" ,
681
675
FormCssSelector = "form" ,
682
676
InputFieldValue = "stranger" ,
683
- ExpectedActionValue = null ,
684
677
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
685
678
} ;
686
679
DispatchToFormCore ( dispatchToForm ) ;
@@ -695,7 +688,7 @@ public void CanDispatchToNamedForm(bool suppressEnhancedNavigation)
695
688
{
696
689
Url = "forms/named-form" ,
697
690
FormCssSelector = "form" ,
698
- ExpectedActionValue = "forms/named-form?handler= named-form-handler" ,
691
+ ExpectedHandlerValue = "named-form-handler" ,
699
692
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
700
693
} ;
701
694
DispatchToFormCore ( dispatchToForm ) ;
@@ -710,7 +703,7 @@ public void CanBindFormValueFromNamedFormWithBody(bool suppressEnhancedNavigatio
710
703
{
711
704
Url = "forms/named-form-bound-parameter" ,
712
705
FormCssSelector = "form" ,
713
- ExpectedActionValue = "forms/named-form-bound-parameter?handler= named-form-handler" ,
706
+ ExpectedHandlerValue = "named-form-handler" ,
714
707
InputFieldId = "Parameter" ,
715
708
InputFieldCssSelector = "input[name=Parameter]" ,
716
709
InputFieldValue = "stranger" ,
@@ -728,7 +721,7 @@ public void CanDispatchToNamedFormInNestedContext(bool suppressEnhancedNavigatio
728
721
{
729
722
Url = "forms/nested-named-form" ,
730
723
FormCssSelector = "form" ,
731
- ExpectedActionValue = "forms/nested-named-form?handler= parent-context.named-form-handler" ,
724
+ ExpectedHandlerValue = "parent-context.named-form-handler" ,
732
725
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
733
726
} ;
734
727
DispatchToFormCore ( dispatchToForm ) ;
@@ -743,7 +736,7 @@ public void CanBindFormValueFromNestedNamedFormWithBody(bool suppressEnhancedNav
743
736
{
744
737
Url = "forms/nested-named-form-bound-parameter" ,
745
738
FormCssSelector = "form" ,
746
- ExpectedActionValue = "forms/nested-named-form-bound-parameter?handler= parent-context.named-form-handler" ,
739
+ ExpectedHandlerValue = "parent-context.named-form-handler" ,
747
740
InputFieldId = "Parameter" ,
748
741
InputFieldCssSelector = "input[name=Parameter]" ,
749
742
InputFieldValue = "stranger" ,
@@ -761,7 +754,6 @@ public void CanDispatchToFormDefinedInNonPageComponent(bool suppressEnhancedNavi
761
754
{
762
755
Url = "forms/form-defined-inside-component" ,
763
756
FormCssSelector = "form" ,
764
- ExpectedActionValue = null ,
765
757
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
766
758
} ;
767
759
DispatchToFormCore ( dispatchToForm ) ;
@@ -774,7 +766,6 @@ public void CannotRenderAmbiguousForms()
774
766
{
775
767
Url = "forms/ambiguous-forms" ,
776
768
FormCssSelector = "form" ,
777
- ExpectedActionValue = null ,
778
769
DispatchEvent = false ,
779
770
ShouldCauseInternalServerError = true ,
780
771
} ;
@@ -788,7 +779,6 @@ public void CanDispatchToFormRenderedAsynchronously()
788
779
{
789
780
Url = "forms/async-rendered-form" ,
790
781
FormCssSelector = "form" ,
791
- ExpectedActionValue = null
792
782
} ;
793
783
DispatchToFormCore ( dispatchToForm ) ;
794
784
}
@@ -800,7 +790,6 @@ public void FormThatDisappearsBeforeQuiesceDoesNotBind()
800
790
{
801
791
Url = "forms/disappears-before-dispatching" ,
802
792
FormCssSelector = "form" ,
803
- ExpectedActionValue = null ,
804
793
SubmitButtonId = "test-send" ,
805
794
ShouldCauseInternalServerError = true ,
806
795
} ;
@@ -860,7 +849,6 @@ public void FormNoAntiforgeryReturnBadRequest(bool suppressEnhancedNavigation)
860
849
{
861
850
Url = "forms/no-antiforgery" ,
862
851
FormCssSelector = "form" ,
863
- ExpectedActionValue = null ,
864
852
ShouldCauseBadRequest = true ,
865
853
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
866
854
} ;
@@ -876,7 +864,6 @@ public void FormAntiforgeryCheckDisabledOnPage(bool suppressEnhancedNavigation)
876
864
{
877
865
Url = "forms/disable-antiforgery-check" ,
878
866
FormCssSelector = "form" ,
879
- ExpectedActionValue = null ,
880
867
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
881
868
} ;
882
869
DispatchToFormCore ( dispatchToForm ) ;
@@ -889,7 +876,6 @@ public void FormCanAddAntiforgeryAfterTheResponseHasStarted()
889
876
{
890
877
Url = "forms/antiforgery-after-response-started" ,
891
878
FormCssSelector = "form" ,
892
- ExpectedActionValue = null ,
893
879
SuppressEnhancedNavigation = true ,
894
880
} ;
895
881
DispatchToFormCore ( dispatchToForm ) ;
@@ -904,7 +890,6 @@ public void FormElementWithAntiforgery(bool suppressEnhancedNavigation)
904
890
{
905
891
Url = "forms/form-element-antiforgery" ,
906
892
FormCssSelector = "form" ,
907
- ExpectedActionValue = null ,
908
893
SuppressEnhancedNavigation = suppressEnhancedNavigation ,
909
894
} ;
910
895
DispatchToFormCore ( dispatchToForm ) ;
@@ -951,10 +936,12 @@ private void DispatchToFormCore(DispatchToForm dispatch)
951
936
952
937
Browser . Exists ( By . Id ( dispatch . Ready ) ) ;
953
938
var form = Browser . Exists ( By . CssSelector ( dispatch . FormCssSelector ) ) ;
954
- var formTarget = form . GetAttribute ( "action" ) ;
955
- var actionValue = form . GetDomAttribute ( "action" ) ;
956
- Assert . Equal ( dispatch . ExpectedTarget , formTarget ) ;
957
- Assert . Equal ( dispatch . ExpectedActionValue , actionValue ) ;
939
+
940
+ if ( dispatch . ExpectedHandlerValue != null )
941
+ {
942
+ var handlerInput = form . FindElement ( By . CssSelector ( "input[type=hidden][name=handler]" ) ) ;
943
+ Assert . Equal ( dispatch . ExpectedHandlerValue , handlerInput . GetAttribute ( "value" ) ) ;
944
+ }
958
945
959
946
if ( ! dispatch . DispatchEvent )
960
947
{
@@ -1023,7 +1010,7 @@ private void DispatchToFormCore(DispatchToForm dispatch)
1023
1010
{
1024
1011
// Verify the same form element is still in the page
1025
1012
// We wouldn't be allowed to read the attribute if the element is stale
1026
- Assert . Equal ( dispatch . ExpectedTarget , form . GetAttribute ( "action " ) ) ;
1013
+ Assert . Equal ( "post" , form . GetAttribute ( "method " ) ) ;
1027
1014
}
1028
1015
}
1029
1016
}
@@ -1040,11 +1027,9 @@ public DispatchToForm(FormWithParentBindingContextTest test) : this()
1040
1027
public string SubmitPassId = "pass" ;
1041
1028
public string Ready = "ready" ;
1042
1029
public string FormCssSelector ;
1043
- public string ExpectedActionValue ;
1030
+ public string ExpectedHandlerValue ;
1044
1031
public string InputFieldValue ;
1045
1032
1046
- public string ExpectedTarget => $ "{ Base } /{ ExpectedActionValue ?? Url } ";
1047
-
1048
1033
public bool DispatchEvent { get ; internal set ; } = true ;
1049
1034
1050
1035
public string SubmitButtonId { get ; internal set ; } = "send" ;
0 commit comments