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:
parent
7b9de550c7
commit
c87dd8d9de
|
|
@ -273,7 +273,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
{
|
{
|
||||||
if (ShouldSkipDescriptorCreation(designTime, property))
|
if (ShouldSkipDescriptorCreation(designTime, property))
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<TagHelperAttributeDescriptor>();
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributeNameAttribute = property.GetCustomAttribute<HtmlAttributeNameAttribute>(inherit: false);
|
var attributeNameAttribute = property.GetCustomAttribute<HtmlAttributeNameAttribute>(inherit: false);
|
||||||
|
|
|
||||||
|
|
@ -185,18 +185,19 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
assemblyName: AssemblyName,
|
assemblyName: AssemblyName,
|
||||||
attributes: new[]
|
attributes: new[]
|
||||||
{
|
{
|
||||||
|
new TagHelperAttributeDescriptor(
|
||||||
|
name: "property2",
|
||||||
|
propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property2),
|
||||||
|
typeName: typeof(int).FullName,
|
||||||
|
isIndexer: false,
|
||||||
|
designTimeDescriptor: null),
|
||||||
new TagHelperAttributeDescriptor(
|
new TagHelperAttributeDescriptor(
|
||||||
name: "property",
|
name: "property",
|
||||||
propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property),
|
propertyName: nameof(OverriddenPropertyEditorBrowsableTagHelper.Property),
|
||||||
typeName: typeof(int).FullName,
|
typeName: typeof(int).FullName,
|
||||||
isIndexer: false,
|
isIndexer: false,
|
||||||
designTimeDescriptor: null),
|
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
|
||||||
Assert.Empty(errorSink.Errors);
|
Assert.Empty(errorSink.Errors);
|
||||||
Assert.Equal(expectedDescriptors, descriptors, TagHelperDescriptorComparer.Default);
|
Assert.Equal(expectedDescriptors, descriptors, CaseSensitiveTagHelperDescriptorComparer.Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TheoryData AttributeTargetData
|
public static TheoryData AttributeTargetData
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue