Fix EditorBrowsableAttribute detection to apply to individual attributes.

- Prior to this change we'd return early and not generate any found descriptors if ANY property on a `TagHelper` had editor browsable never.
- This issue was hidden from tests due to us using the wrong comparer. Updated the comparer and failures occurred without the `TagHelperDescriptorFactory` change (yay).

#454
This commit is contained in:
N. Taylor Mullen 2015-07-23 15:26:46 -07:00
parent 7b9de550c7
commit c87dd8d9de
2 changed files with 9 additions and 8 deletions

View File

@ -273,7 +273,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
if (ShouldSkipDescriptorCreation(designTime, property))
{
return Enumerable.Empty<TagHelperAttributeDescriptor>();
continue;
}
var attributeNameAttribute = property.GetCustomAttribute<HtmlAttributeNameAttribute>(inherit: false);

View File

@ -185,18 +185,19 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
assemblyName: AssemblyName,
attributes: new[]
{
new TagHelperAttributeDescriptor(
name: "property2",
propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property2),
typeName: typeof(int).FullName,
isIndexer: false,
designTimeDescriptor: null),
new TagHelperAttributeDescriptor(
name: "property",
propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property),
typeName: typeof(int).FullName,
isIndexer: false,
designTimeDescriptor: null),
new TagHelperAttributeDescriptor(
name: "property2",
propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property2),
typeName: typeof(int).FullName,
isIndexer: false,
designTimeDescriptor: null)
})
}
},
@ -244,7 +245,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
// Assert
Assert.Empty(errorSink.Errors);
Assert.Equal(expectedDescriptors, descriptors, TagHelperDescriptorComparer.Default);
Assert.Equal(expectedDescriptors, descriptors, CaseSensitiveTagHelperDescriptorComparer.Default);
}
public static TheoryData AttributeTargetData