From 9c35c07a0b6f72bafdee8f37744a35c5e967d86a Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 26 Mar 2019 10:06:18 +0100 Subject: [PATCH] bind-Value on EditText often results in the wrong thing (dotnet/aspnetcore-tooling#364) Updates the bindtaghelperdescriptorprovider to use the changed event property type name on the bound attribute instead of the value property type attribute.\n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/3009045206b969f4b5e5ffb0a34cee183a8e96a9 --- .../src/BindTagHelperDescriptorProvider.cs | 2 +- .../test/BindTagHelperDescriptorProviderTest.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs index cd1b335103..f055cc3bfd 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs @@ -437,7 +437,7 @@ namespace Microsoft.CodeAnalysis.Razor changeAttribute.Name); attribute.Name = "bind-" + valueAttribute.Name; - attribute.TypeName = valueAttribute.TypeName; + attribute.TypeName = changeAttribute.TypeName; attribute.IsEnum = valueAttribute.IsEnum; // WTE has a bug 15.7p1 where a Tag Helper without a display-name that looks like diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs index bb8025c2bc..0265459112 100644 --- a/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs @@ -122,11 +122,11 @@ namespace Test Assert.Equal("bind-MyProperty", attribute.Name); Assert.Equal("MyProperty", attribute.GetPropertyName()); - Assert.Equal("string Test.MyComponent.MyProperty", attribute.DisplayName); + Assert.Equal("System.Action Test.MyComponent.MyProperty", attribute.DisplayName); // Defined from the property type - Assert.Equal("System.String", attribute.TypeName); - Assert.True(attribute.IsStringProperty); + Assert.Equal("System.Action", attribute.TypeName); + Assert.False(attribute.IsStringProperty); Assert.False(attribute.IsBooleanProperty); Assert.False(attribute.IsEnum); } @@ -237,11 +237,11 @@ namespace Test Assert.Equal("bind-MyProperty", attribute.Name); Assert.Equal("MyProperty", attribute.GetPropertyName()); - Assert.Equal("string Test.MyComponent.MyProperty", attribute.DisplayName); + Assert.Equal("Microsoft.AspNetCore.Components.EventCallback Test.MyComponent.MyProperty", attribute.DisplayName); // Defined from the property type - Assert.Equal("System.String", attribute.TypeName); - Assert.True(attribute.IsStringProperty); + Assert.Equal("Microsoft.AspNetCore.Components.EventCallback", attribute.TypeName); + Assert.False(attribute.IsStringProperty); Assert.False(attribute.IsBooleanProperty); Assert.False(attribute.IsEnum); }