diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/TestTagHelperDescriptors.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/TestTagHelperDescriptors.cs similarity index 99% rename from test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/TestTagHelperDescriptors.cs rename to test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/TestTagHelperDescriptors.cs index a19488fdad..144e497d33 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/TestTagHelperDescriptors.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/TestTagHelperDescriptors.cs @@ -158,7 +158,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests .Name("catch-all") .PropertyName("CatchAll") .AsEnum() - .TypeName(typeof(MyEnum).FullName), + .TypeName($"{typeof(TestTagHelperDescriptors).FullName}.{nameof(MyEnum)}"), }), CreateTagHelperDescriptor( tagName: "input", @@ -170,7 +170,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests .Name("value") .PropertyName("Value") .AsEnum() - .TypeName(typeof(MyEnum).FullName), + .TypeName($"{typeof(TestTagHelperDescriptors).FullName}.{nameof(MyEnum)}"), }), }; } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs index aac559a92b..911f672a80 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs @@ -42,19 +42,19 @@ __TestNamespace_InputTagHelper.Value = MyEnum.MyValue; __TestNamespace_InputTagHelper = CreateTagHelper(); __TestNamespace_CatchAllTagHelper = CreateTagHelper(); #line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" -__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors+MyEnum.MyValue; +__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors.MyEnum.MyValue; #line default #line hidden __TestNamespace_InputTagHelper = CreateTagHelper(); __TestNamespace_CatchAllTagHelper = CreateTagHelper(); #line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" -__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors+MyEnum.MySecondValue; +__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors.MyEnum.MySecondValue; #line default #line hidden #line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" -__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors+MyEnum.MyValue; +__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors.MyEnum.MyValue; #line default #line hidden diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs index d025e3cbef..25c1263a42 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs @@ -88,7 +88,7 @@ AddHtmlAttributeValue("", 130, MyEnum.MySecondValue, 130, 21, false); __TestNamespace_CatchAllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); #line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" -__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors+MyEnum.MyValue; +__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors.MyEnum.MyValue; #line default #line hidden @@ -109,13 +109,13 @@ __TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Langua __TestNamespace_CatchAllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); #line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" -__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors+MyEnum.MySecondValue; +__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors.MyEnum.MySecondValue; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" -__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors+MyEnum.MyValue; +__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestTagHelperDescriptors.MyEnum.MyValue; #line default #line hidden diff --git a/test/Microsoft.CodeAnalysis.Razor.Test/DefaultTagHelperDescriptorFactoryTest.cs b/test/Microsoft.CodeAnalysis.Razor.Test/DefaultTagHelperDescriptorFactoryTest.cs index 73c15373e1..64c1d856c8 100644 --- a/test/Microsoft.CodeAnalysis.Razor.Test/DefaultTagHelperDescriptorFactoryTest.cs +++ b/test/Microsoft.CodeAnalysis.Razor.Test/DefaultTagHelperDescriptorFactoryTest.cs @@ -353,7 +353,30 @@ namespace Microsoft.CodeAnalysis.Razor.Workspaces .TypeName(typeof(CustomEnum).FullName) .AsEnum()) .Build() - } + }, + { + typeof(NestedEnumTagHelper), + TagHelperDescriptorBuilder.Create(typeof(NestedEnumTagHelper).FullName, AssemblyName) + .TagMatchingRule(ruleBuilder => ruleBuilder.RequireTagName("nested-enum")) + .BindAttribute(builder => + builder + .Name("non-enum-property") + .PropertyName(nameof(NestedEnumTagHelper.NonEnumProperty)) + .TypeName(typeof(int).FullName)) + .BindAttribute(builder => + builder + .Name("enum-property") + .PropertyName(nameof(NestedEnumTagHelper.EnumProperty)) + .TypeName(typeof(CustomEnum).FullName) + .AsEnum()) + .BindAttribute(builder => + builder + .Name("nested-enum-property") + .PropertyName(nameof(NestedEnumTagHelper.NestedEnumProperty)) + .TypeName($"{typeof(NestedEnumTagHelper).FullName}.{nameof(NestedEnumTagHelper.NestedEnum)}") + .AsEnum()) + .Build() + }, }; } } diff --git a/test/Microsoft.CodeAnalysis.Razor.Test/TagHelperDescriptorFactoryTagHelpers.cs b/test/Microsoft.CodeAnalysis.Razor.Test/TagHelperDescriptorFactoryTagHelpers.cs index 471fbbcf38..658fca5d94 100644 --- a/test/Microsoft.CodeAnalysis.Razor.Test/TagHelperDescriptorFactoryTagHelpers.cs +++ b/test/Microsoft.CodeAnalysis.Razor.Test/TagHelperDescriptorFactoryTagHelpers.cs @@ -26,6 +26,17 @@ namespace Microsoft.CodeAnalysis.Razor.Workspaces.Test { } + public class NestedEnumTagHelper : EnumTagHelper + { + public NestedEnum NestedEnumProperty { get; set; } + + public enum NestedEnum + { + NestedOne, + NestedTwo + } + } + [HtmlTargetElement("input", ParentTag = "div")] public class RequiredParentTagHelper : TagHelper {