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
This commit is contained in:
N. Taylor Mullen 2015-09-13 11:57:48 -07:00
parent 9ab9a330ed
commit 4fd866f340
3 changed files with 11 additions and 11 deletions

View File

@ -18,25 +18,25 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
/// <summary> /// <summary>
/// Instantiates a new instance of the <see cref="RestrictChildrenAttribute"/> class. /// Instantiates a new instance of the <see cref="RestrictChildrenAttribute"/> class.
/// </summary> /// </summary>
/// <param name="tagName"> /// <param name="childTag">
/// The tag name of an element allowed as a child. Tag helpers must target the element. /// The tag name of an element allowed as a child. Tag helpers must target the element.
/// </param> /// </param>
/// <param name="tagNames"> /// <param name="childTags">
/// Additional names of elements allowed as children. Tag helpers must target all such elements. /// Additional names of elements allowed as children. Tag helpers must target all such elements.
/// </param> /// </param>
public RestrictChildrenAttribute(string tagName, params string[] tagNames) public RestrictChildrenAttribute(string childTag, params string[] childTags)
{ {
var concatenatedNames = new string[1 + tagNames.Length]; var concatenatedNames = new string[1 + childTags.Length];
concatenatedNames[0] = tagName; concatenatedNames[0] = childTag;
tagNames.CopyTo(concatenatedNames, 1); childTags.CopyTo(concatenatedNames, 1);
ChildTagNames = concatenatedNames; ChildTags = concatenatedNames;
} }
/// <summary> /// <summary>
/// Get the names of elements allowed as children. Tag helpers must target all such elements. /// Get the names of elements allowed as children. Tag helpers must target all such elements.
/// </summary> /// </summary>
public IEnumerable<string> ChildTagNames { get; } public IEnumerable<string> ChildTags { get; }
} }
} }

View File

@ -157,7 +157,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
return null; return null;
} }
var allowedChildren = restrictChildrenAttribute.ChildTagNames; var allowedChildren = restrictChildrenAttribute.ChildTags;
var validAllowedChildren = GetValidAllowedChildren(allowedChildren, typeInfo.FullName, errorSink); var validAllowedChildren = GetValidAllowedChildren(allowedChildren, typeInfo.FullName, errorSink);
if (validAllowedChildren.Any()) if (validAllowedChildren.Any())

View File

@ -181,8 +181,8 @@ namespace Microsoft.AspNet.Razor.Runtime.Precompilation
(expectedAttribute, actualAttribute) => (expectedAttribute, actualAttribute) =>
{ {
Assert.Equal( Assert.Equal(
expectedAttribute.ChildTagNames, expectedAttribute.ChildTags,
actualAttribute.ChildTagNames); actualAttribute.ChildTags);
}); });
// Complex array bindings // Complex array bindings