Skip to content

Commit 5e1157a

Browse files
Forms streamline (#49261)
1 parent 50f7ade commit 5e1157a

File tree

132 files changed

+1204
-1722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1204
-1722
lines changed

src/Components/Authorization/test/AuthorizeRouteViewTest.cs

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Diagnostics.CodeAnalysis;
54
using System.Security.Claims;
65
using Microsoft.AspNetCore.Authorization;
7-
using Microsoft.AspNetCore.Components.Binding;
86
using Microsoft.AspNetCore.Components.Rendering;
97
using Microsoft.AspNetCore.Components.RenderTree;
108
using Microsoft.AspNetCore.Components.Test.Helpers;
@@ -67,26 +65,10 @@ public void WhenAuthorized_RendersPageInsideLayout()
6765
edit =>
6866
{
6967
Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
70-
AssertFrame.Component<CascadingModelBinder>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
68+
AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
7169
},
7270
edit => AssertPrependText(batch, edit, "Layout ends here"));
7371

74-
var cascadingModelBinderDiff = batch.GetComponentDiffs<CascadingModelBinder>().Single();
75-
Assert.Collection(cascadingModelBinderDiff.Edits,
76-
edit =>
77-
{
78-
Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
79-
AssertFrame.Component<CascadingValue<ModelBindingContext>>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
80-
});
81-
82-
var cascadingValueDiff = batch.GetComponentDiffs<CascadingValue<ModelBindingContext>>().Single();
83-
Assert.Collection(cascadingValueDiff.Edits,
84-
edit =>
85-
{
86-
Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
87-
AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
88-
});
89-
9072
// Assert: renders page
9173
var pageDiff = batch.GetComponentDiffs<TestPageRequiringAuthorization>().Single();
9274
Assert.Collection(pageDiff.Edits,
@@ -120,26 +102,10 @@ public void AuthorizesWhenResourceIsSet()
120102
edit =>
121103
{
122104
Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
123-
AssertFrame.Component<CascadingModelBinder>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
105+
AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
124106
},
125107
edit => AssertPrependText(batch, edit, "Layout ends here"));
126108

127-
var cascadingModelBinderDiff = batch.GetComponentDiffs<CascadingModelBinder>().Single();
128-
Assert.Collection(cascadingModelBinderDiff.Edits,
129-
edit =>
130-
{
131-
Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
132-
AssertFrame.Component<CascadingValue<ModelBindingContext>>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
133-
});
134-
135-
var cascadingValueDiff = batch.GetComponentDiffs<CascadingValue<ModelBindingContext>>().Single();
136-
Assert.Collection(cascadingValueDiff.Edits,
137-
edit =>
138-
{
139-
Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
140-
AssertFrame.Component<TestPageRequiringAuthorization>(batch.ReferenceFrames[edit.ReferenceFrameIndex]);
141-
});
142-
143109
// Assert: renders page
144110
var pageDiff = batch.GetComponentDiffs<TestPageRequiringAuthorization>().Single();
145111
Assert.Collection(pageDiff.Edits,
@@ -327,8 +293,6 @@ public void WithoutCascadedAuthenticationState_WrapsOutputInCascadingAuthenticat
327293
component => Assert.IsType<CascadingValue<Task<AuthenticationState>>>(component),
328294
component => Assert.IsAssignableFrom<AuthorizeViewCore>(component),
329295
component => Assert.IsType<LayoutView>(component),
330-
component => Assert.IsType<CascadingModelBinder>(component),
331-
component => Assert.IsType<CascadingValue<ModelBindingContext>>(component),
332296
component => Assert.IsType<TestPageWithNoAuthorization>(component));
333297
}
334298

@@ -360,8 +324,6 @@ public void WithCascadedAuthenticationState_DoesNotWrapOutputInCascadingAuthenti
360324
// further CascadingAuthenticationState
361325
component => Assert.IsAssignableFrom<AuthorizeViewCore>(component),
362326
component => Assert.IsType<LayoutView>(component),
363-
component => Assert.IsType<CascadingModelBinder>(component),
364-
component => Assert.IsType<CascadingValue<ModelBindingContext>>(component),
365327
component => Assert.IsType<TestPageWithNoAuthorization>(component));
366328
}
367329

@@ -469,10 +431,4 @@ public TestNavigationManager()
469431
Initialize("https://localhost:85/subdir/", "https://localhost:85/subdir/path?query=value#hash");
470432
}
471433
}
472-
473-
private class TestFormValueSupplier : IFormValueSupplier
474-
{
475-
public bool CanBind(Type valueType, string formName = null) => false;
476-
public void Bind(FormValueSupplierContext context) { }
477-
}
478434
}

src/Components/Authorization/test/Microsoft.AspNetCore.Components.Authorization.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>

src/Components/Components/src/Binding/CascadingModelBinder.cs

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

src/Components/Components/src/Binding/CascadingModelBindingProvider.cs

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

0 commit comments

Comments
 (0)