Skip to content

Commit c57feca

Browse files
E2E test updates
1 parent 0602840 commit c57feca

File tree

3 files changed

+11
-73
lines changed

3 files changed

+11
-73
lines changed

src/Components/test/E2ETest/ServerRenderingTests/FormHandlingTests/FormWithParentBindingContextTest.cs

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -768,32 +768,15 @@ public void CanDispatchToFormDefinedInNonPageComponent(bool suppressEnhancedNavi
768768
}
769769

770770
[Fact]
771-
public void CanRenderAmbiguousForms()
771+
public void CannotRenderAmbiguousForms()
772772
{
773773
var dispatchToForm = new DispatchToForm(this)
774774
{
775775
Url = "forms/ambiguous-forms",
776776
FormCssSelector = "form",
777777
ExpectedActionValue = null,
778-
DispatchEvent = false
779-
};
780-
DispatchToFormCore(dispatchToForm);
781-
}
782-
783-
[Theory]
784-
[InlineData(true)]
785-
[InlineData(false)]
786-
public void DispatchingToAmbiguousFormFails(bool suppressEnhancedNavigation)
787-
{
788-
var dispatchToForm = new DispatchToForm(this)
789-
{
790-
Url = "forms/ambiguous-forms",
791-
FormCssSelector = "form",
792-
ExpectedActionValue = null,
793-
DispatchEvent = true,
794-
SubmitButtonId = "send-second",
778+
DispatchEvent = false,
795779
ShouldCauseInternalServerError = true,
796-
SuppressEnhancedNavigation = suppressEnhancedNavigation,
797780
};
798781
DispatchToFormCore(dispatchToForm);
799782
}
@@ -824,19 +807,6 @@ public void FormThatDisappearsBeforeQuiesceDoesNotBind()
824807
DispatchToFormCore(dispatchToForm);
825808
}
826809

827-
[Fact]
828-
public void ChangingComponentsToDispatchBeforeQuiesceDoesNotBind()
829-
{
830-
var dispatchToForm = new DispatchToForm(this)
831-
{
832-
Url = "forms/switching-components-does-not-bind",
833-
FormCssSelector = "form",
834-
ExpectedActionValue = null,
835-
ShouldCauseInternalServerError = true,
836-
};
837-
DispatchToFormCore(dispatchToForm);
838-
}
839-
840810
[Fact]
841811
public async Task CanPostFormsWithStreamingRenderingAsync()
842812
{
@@ -972,6 +942,13 @@ private void DispatchToFormCore(DispatchToForm dispatch)
972942

973943
GoTo(dispatch.Url);
974944

945+
if (!dispatch.DispatchEvent && dispatch.ShouldCauseInternalServerError)
946+
{
947+
// Chrome's built-in error UI for a 500 response when there's no response content
948+
Browser.Exists(By.Id("main-frame-error"));
949+
return;
950+
}
951+
975952
Browser.Exists(By.Id(dispatch.Ready));
976953
var form = Browser.Exists(By.CssSelector(dispatch.FormCssSelector));
977954
var formTarget = form.GetAttribute("action");

src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/AmbiguousForms.razor

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,8 @@
33

44
<h2>Ambiguous forms</h2>
55

6-
<EditForm EditContext="_editContext" method="POST" OnValidSubmit="() => _submitted = true">
7-
<input id="send" type="submit" value="Send" />
6+
<EditForm Model="this" method="POST" OnValidSubmit="() => {}">
87
</EditForm>
98

10-
<EditForm EditContext="_editContext" method="POST" OnValidSubmit="() => _submitted = true">
11-
<input id="send-second" type="submit" value="Send" />
9+
<EditForm Model="this" method="POST" OnValidSubmit="() => {}">
1210
</EditForm>
13-
14-
@if (_submitted)
15-
{
16-
<p id="pass">Form submitted!</p>
17-
}
18-
19-
@code{
20-
bool _submitted = false;
21-
EditContext _editContext = new EditContext(new object());
22-
}

src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/SwitchingDispatchedComponentsDoesNotBind.razor

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)