From 4fd866f340ef5c53432717fe4451be25ac2c71b7 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 13 Sep 2015 11:57:48 -0700 Subject: [PATCH] Update `RestrictChildrenAttribute`s properties and parameters to have consistent names. - Other attributes such as `TargetElement` have names referring to tag names as "tags". This update makes both attributes more consistent. #517 --- .../TagHelpers/RestrictChildrenAttribute.cs | 16 ++++++++-------- .../TagHelpers/TagHelperDescriptorFactory.cs | 2 +- .../PrecompilationTagHelperTypeResolverTest.cs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RestrictChildrenAttribute.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RestrictChildrenAttribute.cs index aae957d5a5..e2084b7c62 100644 --- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RestrictChildrenAttribute.cs +++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/RestrictChildrenAttribute.cs @@ -18,25 +18,25 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers /// /// Instantiates a new instance of the class. /// - /// + /// /// The tag name of an element allowed as a child. Tag helpers must target the element. /// - /// + /// /// Additional names of elements allowed as children. Tag helpers must target all such elements. /// - public RestrictChildrenAttribute(string tagName, params string[] tagNames) + public RestrictChildrenAttribute(string childTag, params string[] childTags) { - var concatenatedNames = new string[1 + tagNames.Length]; - concatenatedNames[0] = tagName; + var concatenatedNames = new string[1 + childTags.Length]; + concatenatedNames[0] = childTag; - tagNames.CopyTo(concatenatedNames, 1); + childTags.CopyTo(concatenatedNames, 1); - ChildTagNames = concatenatedNames; + ChildTags = concatenatedNames; } /// /// Get the names of elements allowed as children. Tag helpers must target all such elements. /// - public IEnumerable ChildTagNames { get; } + public IEnumerable ChildTags { get; } } } diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs index a8db563c02..c4feb2a043 100644 --- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs +++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs @@ -157,7 +157,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers return null; } - var allowedChildren = restrictChildrenAttribute.ChildTagNames; + var allowedChildren = restrictChildrenAttribute.ChildTags; var validAllowedChildren = GetValidAllowedChildren(allowedChildren, typeInfo.FullName, errorSink); if (validAllowedChildren.Any()) diff --git a/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs index 4309006196..ad738f0816 100644 --- a/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs +++ b/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/PrecompilationTagHelperTypeResolverTest.cs @@ -181,8 +181,8 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation (expectedAttribute, actualAttribute) => { Assert.Equal( - expectedAttribute.ChildTagNames, - actualAttribute.ChildTagNames); + expectedAttribute.ChildTags, + actualAttribute.ChildTags); }); // Complex array bindings