Removed constructors from TagHelperAttributeDesignTimeDescriptor,
TagHelperDesignTimeDescriptor and TagHelperDirectiveDescriptor
This commit is contained in:
parent
e9292a0e30
commit
156f859edc
|
|
@ -41,10 +41,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
|
||||
if (documentationDescriptor != null || outputElementHint != null)
|
||||
{
|
||||
return new TagHelperDesignTimeDescriptor(
|
||||
documentationDescriptor?.Summary,
|
||||
documentationDescriptor?.Remarks,
|
||||
outputElementHint);
|
||||
return new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = documentationDescriptor?.Summary,
|
||||
Remarks = documentationDescriptor?.Remarks,
|
||||
OutputElementHint = outputElementHint
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -68,9 +70,11 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
|
||||
if (documentationDescriptor != null)
|
||||
{
|
||||
return new TagHelperAttributeDesignTimeDescriptor(
|
||||
documentationDescriptor.Summary,
|
||||
documentationDescriptor.Remarks);
|
||||
return new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = documentationDescriptor.Summary,
|
||||
Remarks = documentationDescriptor.Remarks
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -68,10 +68,12 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
|||
TagHelperDirectiveType.RemoveTagHelper :
|
||||
TagHelperDirectiveType.AddTagHelper;
|
||||
|
||||
var directiveDescriptor = new TagHelperDirectiveDescriptor(
|
||||
chunkGenerator.LookupText,
|
||||
span.Start,
|
||||
directive);
|
||||
var directiveDescriptor = new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = chunkGenerator.LookupText,
|
||||
Location = span.Start,
|
||||
DirectiveType = directive
|
||||
};
|
||||
|
||||
_directiveDescriptors.Add(directiveDescriptor);
|
||||
}
|
||||
|
|
@ -79,10 +81,12 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
|||
{
|
||||
var chunkGenerator = (TagHelperPrefixDirectiveChunkGenerator)span.ChunkGenerator;
|
||||
|
||||
var directiveDescriptor = new TagHelperDirectiveDescriptor(
|
||||
chunkGenerator.Prefix,
|
||||
span.Start,
|
||||
TagHelperDirectiveType.TagHelperPrefix);
|
||||
var directiveDescriptor = new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = chunkGenerator.Prefix,
|
||||
Location = span.Start,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
};
|
||||
|
||||
_directiveDescriptors.Add(directiveDescriptor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,25 +8,14 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// </summary>
|
||||
public class TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="TagHelperDesignTimeDescriptor"/>.
|
||||
/// </summary>
|
||||
/// <param name="summary">A summary on how to use a tag helper.</param>
|
||||
/// <param name="remarks">Remarks on how to use a tag helper.</param>
|
||||
public TagHelperAttributeDesignTimeDescriptor(string summary, string remarks)
|
||||
{
|
||||
Summary = summary;
|
||||
Remarks = remarks;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A summary of how to use a tag helper.
|
||||
/// </summary>
|
||||
public string Summary { get; }
|
||||
public string Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Remarks about how to use a tag helper.
|
||||
/// </summary>
|
||||
public string Remarks { get; }
|
||||
public string Remarks { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -8,28 +8,15 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// </summary>
|
||||
public class TagHelperDesignTimeDescriptor
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="TagHelperDesignTimeDescriptor"/>.
|
||||
/// </summary>
|
||||
/// <param name="summary">A summary on how to use a tag helper.</param>
|
||||
/// <param name="remarks">Remarks on how to use a tag helper.</param>
|
||||
/// <param name="outputElementHint">The HTML element a tag helper may output.</param>
|
||||
public TagHelperDesignTimeDescriptor(string summary, string remarks, string outputElementHint)
|
||||
{
|
||||
Summary = summary;
|
||||
Remarks = remarks;
|
||||
OutputElementHint = outputElementHint;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A summary of how to use a tag helper.
|
||||
/// </summary>
|
||||
public string Summary { get; }
|
||||
public string Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Remarks about how to use a tag helper.
|
||||
/// </summary>
|
||||
public string Remarks { get; }
|
||||
public string Remarks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTML element a tag helper may output.
|
||||
|
|
@ -37,6 +24,6 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// <remarks>
|
||||
/// In IDEs supporting IntelliSense, may override the HTML information provided at design time.
|
||||
/// </remarks>
|
||||
public string OutputElementHint { get; }
|
||||
public string OutputElementHint { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -10,42 +10,19 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// </summary>
|
||||
public class TagHelperDirectiveDescriptor
|
||||
{
|
||||
// Internal for testing purposes.
|
||||
internal TagHelperDirectiveDescriptor(string directiveText,
|
||||
TagHelperDirectiveType directiveType)
|
||||
: this(directiveText, SourceLocation.Zero, directiveType)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="TagHelperDirectiveDescriptor"/>.
|
||||
/// </summary>
|
||||
/// <param name="directiveText">A <see cref="string"/> used to understand tag helper
|
||||
/// <see cref="System.Type"/>s.</param>
|
||||
/// <param name="location">The <see cref="SourceLocation"/> of the directive.</param>
|
||||
/// <param name="directiveType">The <see cref="TagHelperDirectiveType"/> of this directive.</param>
|
||||
public TagHelperDirectiveDescriptor([NotNull] string directiveText,
|
||||
SourceLocation location,
|
||||
TagHelperDirectiveType directiveType)
|
||||
{
|
||||
DirectiveText = directiveText;
|
||||
Location = location;
|
||||
DirectiveType = directiveType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="string"/> used to find tag helper <see cref="System.Type"/>s.
|
||||
/// </summary>
|
||||
public string DirectiveText { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="TagHelperDirectiveType"/> of this directive.
|
||||
/// </summary>
|
||||
public TagHelperDirectiveType DirectiveType { get; }
|
||||
public string DirectiveText { get; [param: NotNull] set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="SourceLocation"/> of the directive.
|
||||
/// </summary>
|
||||
public SourceLocation Location { get; }
|
||||
public SourceLocation Location { get; set; } = SourceLocation.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="TagHelperDirectiveType"/> of this directive.
|
||||
/// </summary>
|
||||
public TagHelperDirectiveType DirectiveType { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -545,7 +545,6 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
// Arrange
|
||||
var tagHelperContent = new DefaultTagHelperContent();
|
||||
var expected = "First Second Third";
|
||||
var i = 0;
|
||||
|
||||
// Act
|
||||
tagHelperContent.SetContent("First ").AppendFormat("{0} Third", "Second");
|
||||
|
|
@ -560,7 +559,6 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
// Arrange
|
||||
var tagHelperContent = new DefaultTagHelperContent();
|
||||
var expected = "First Second Third Fourth";
|
||||
var i = 0;
|
||||
|
||||
// Act
|
||||
tagHelperContent
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
attributes: Enumerable.Empty<TagHelperAttributeDescriptor>(),
|
||||
requiredAttributes: Enumerable.Empty<string>(),
|
||||
tagStructure: default(TagStructure),
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor(
|
||||
summary: null,
|
||||
remarks: null,
|
||||
outputElementHint: "strong"))
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
OutputElementHint = "strong"
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -156,10 +156,10 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
attributes: Enumerable.Empty<TagHelperAttributeDescriptor>(),
|
||||
requiredAttributes: Enumerable.Empty<string>(),
|
||||
tagStructure: default(TagStructure),
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor(
|
||||
summary: null,
|
||||
remarks: null,
|
||||
outputElementHint: "div")),
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
OutputElementHint = "div"
|
||||
}),
|
||||
new TagHelperDescriptor(
|
||||
prefix: string.Empty,
|
||||
tagName: "p",
|
||||
|
|
@ -168,10 +168,10 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
attributes: Enumerable.Empty<TagHelperAttributeDescriptor>(),
|
||||
requiredAttributes: Enumerable.Empty<string>(),
|
||||
tagStructure: default(TagStructure),
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor(
|
||||
summary: null,
|
||||
remarks: null,
|
||||
outputElementHint: "div"))
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
OutputElementHint = "div"
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -82,14 +82,18 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"th:",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"different",
|
||||
directiveLocation2,
|
||||
TagHelperDirectiveType.TagHelperPrefix)
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "th:",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "different",
|
||||
Location = directiveLocation2,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -103,18 +107,24 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"th:",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"different",
|
||||
directiveLocation2,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"*Plain*, " + assemblyA,
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "th:",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "different",
|
||||
Location = directiveLocation2,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "*Plain*, " + assemblyA,
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.AddTagHelper
|
||||
}
|
||||
},
|
||||
new[] { CreatePrefixedValidPlainDescriptor("th:") },
|
||||
new[]
|
||||
|
|
@ -128,22 +138,30 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"th:",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"different",
|
||||
directiveLocation2,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"*Plain*, " + assemblyA,
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"*String*, " + assemblyB,
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "th:",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "different",
|
||||
Location = directiveLocation2,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "*Plain*, " + assemblyA,
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.AddTagHelper
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "*String*, " + assemblyB,
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.AddTagHelper
|
||||
}
|
||||
},
|
||||
new[] { CreatePrefixedValidPlainDescriptor("th:"), CreatePrefixedStringDescriptor("th:") },
|
||||
new[]
|
||||
|
|
@ -157,10 +175,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"th ",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "th ",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
},
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -178,10 +198,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"th\t",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "th\t",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -199,10 +221,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"th" + Environment.NewLine,
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "th" + Environment.NewLine,
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -220,10 +244,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
" th ",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = " th ",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -241,10 +267,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"@",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "@",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -262,10 +290,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"t@h",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "t@h",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -283,10 +313,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"!",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "!",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -304,10 +336,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
defaultAssemblyLookups,
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
"!th",
|
||||
directiveLocation1,
|
||||
TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "!th",
|
||||
Location = directiveLocation1,
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
},
|
||||
new TagHelperDescriptor[0],
|
||||
new[]
|
||||
|
|
@ -1341,7 +1375,15 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
"format is: \"typeName, assemblyName\".",
|
||||
lookupText);
|
||||
var resolutionContext = new TagHelperDescriptorResolutionContext(
|
||||
new[] { new TagHelperDirectiveDescriptor(lookupText, documentLocation, directiveType) },
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = lookupText,
|
||||
Location = documentLocation,
|
||||
DirectiveType = directiveType
|
||||
}
|
||||
},
|
||||
errorSink);
|
||||
|
||||
// Act
|
||||
|
|
@ -1367,7 +1409,15 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
var expectedError = new Exception("A custom exception");
|
||||
var tagHelperDescriptorResolver = new ThrowingTagHelperDescriptorResolver(expectedError);
|
||||
var resolutionContext = new TagHelperDescriptorResolutionContext(
|
||||
new[] { new TagHelperDirectiveDescriptor("A custom, lookup text", documentLocation, directiveType) },
|
||||
new[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "A custom, lookup text",
|
||||
Location = documentLocation,
|
||||
DirectiveType = directiveType
|
||||
}
|
||||
},
|
||||
errorSink);
|
||||
|
||||
|
||||
|
|
@ -1431,7 +1481,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
string directiveText,
|
||||
TagHelperDirectiveType directiveType)
|
||||
{
|
||||
return new TagHelperDirectiveDescriptor(directiveText, SourceLocation.Zero, directiveType);
|
||||
return new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = directiveText,
|
||||
Location = SourceLocation.Zero,
|
||||
DirectiveType = directiveType
|
||||
};
|
||||
}
|
||||
|
||||
private class TestTagHelperDescriptorResolver : TagHelperDescriptorResolver
|
||||
|
|
|
|||
|
|
@ -51,17 +51,17 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{ typeof(InheritedOutputElementHintTagHelper), null },
|
||||
{
|
||||
typeof(OutputElementHintTagHelper),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
summary: null,
|
||||
remarks: null,
|
||||
outputElementHint: "hinted-value")
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
OutputElementHint = "hinted-value"
|
||||
}
|
||||
},
|
||||
{
|
||||
typeof(OverriddenOutputElementHintTagHelper),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
summary: null,
|
||||
remarks: null,
|
||||
outputElementHint: "overridden")
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
OutputElementHint = "overridden"
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -90,10 +90,10 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
var nonExistentCodeBase = defaultCodeBase.Replace("TestFiles", "TestFile");
|
||||
var invalidLocation = defaultLocation + '\0';
|
||||
var invalidCodeBase = defaultCodeBase + '\0';
|
||||
var onlyHint = new TagHelperDesignTimeDescriptor(
|
||||
summary: null,
|
||||
remarks: null,
|
||||
outputElementHint: "p");
|
||||
var onlyHint = new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
OutputElementHint = "p"
|
||||
};
|
||||
|
||||
// tagHelperType, expectedDesignTimeDescriptor
|
||||
return new TheoryData<Type, TagHelperDesignTimeDescriptor>
|
||||
|
|
@ -101,18 +101,30 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{ CreateDocumentationTagHelperType(location: null, codeBase: null), onlyHint },
|
||||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, codeBase: null),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
TypeSummary,
|
||||
TypeRemarks,
|
||||
outputElementHint: "p")
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = TypeSummary,
|
||||
Remarks = TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(location: null, codeBase: defaultCodeBase),
|
||||
new TagHelperDesignTimeDescriptor(TypeSummary, TypeRemarks, outputElementHint: "p")
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = TypeSummary,
|
||||
Remarks = TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, defaultCodeBase),
|
||||
new TagHelperDesignTimeDescriptor(TypeSummary, TypeRemarks, outputElementHint: "p")
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = TypeSummary,
|
||||
Remarks = TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
}
|
||||
},
|
||||
{ CreateType<SingleAttributeTagHelper>(defaultLocation, defaultCodeBase), null },
|
||||
{ CreateDocumentationTagHelperType(nonExistentLocation, codeBase: null), onlyHint },
|
||||
|
|
@ -145,42 +157,52 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
summary: "en-GB: " + TypeSummary,
|
||||
remarks: "en-GB: " + TypeRemarks,
|
||||
outputElementHint: "p"),
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = "en-GB: " + TypeSummary,
|
||||
Remarks = "en-GB: " + TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
},
|
||||
"en-GB"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
summary: "en: " + TypeSummary,
|
||||
remarks: "en: " + TypeRemarks,
|
||||
outputElementHint: "p"),
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = "en: " + TypeSummary,
|
||||
Remarks = "en: " + TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
},
|
||||
"en-US"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
summary: "fr-FR: " + TypeSummary,
|
||||
remarks: "fr-FR: " + TypeRemarks,
|
||||
outputElementHint: "p"),
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = "fr-FR: " + TypeSummary,
|
||||
Remarks = "fr-FR: " + TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
},
|
||||
"fr-FR"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
summary: "fr: " + TypeSummary,
|
||||
remarks: "fr: " + TypeRemarks,
|
||||
outputElementHint: "p"),
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = "fr: " + TypeSummary,
|
||||
Remarks = "fr: " + TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
},
|
||||
"fr-BE"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperDesignTimeDescriptor(
|
||||
summary: "nl-BE: " + TypeSummary,
|
||||
remarks: "nl-BE: " + TypeRemarks,
|
||||
outputElementHint: "p"),
|
||||
new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = "nl-BE: " + TypeSummary,
|
||||
Remarks = "nl-BE: " + TypeRemarks,
|
||||
OutputElementHint = "p"
|
||||
},
|
||||
"nl-BE"
|
||||
}
|
||||
};
|
||||
|
|
@ -244,53 +266,77 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, codeBase: null),
|
||||
nameof(DocumentedTagHelper.SummaryProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(PropertySummary, remarks: null)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = PropertySummary
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, codeBase: null),
|
||||
nameof(DocumentedTagHelper.RemarksProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(summary: null, remarks: PropertyRemarks)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Remarks = PropertyRemarks
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, codeBase: null),
|
||||
nameof(DocumentedTagHelper.RemarksAndSummaryProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
PropertyWithSummaryAndRemarks_Summary,
|
||||
PropertyWithSummaryAndRemarks_Remarks)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = PropertyWithSummaryAndRemarks_Remarks
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(location: null, codeBase: defaultCodeBase),
|
||||
nameof(DocumentedTagHelper.SummaryProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(PropertySummary, remarks: null)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = PropertySummary
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(location: null, codeBase: defaultCodeBase),
|
||||
nameof(DocumentedTagHelper.RemarksProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(summary: null, remarks: PropertyRemarks)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Remarks = PropertyRemarks
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(location: null, codeBase: defaultCodeBase),
|
||||
nameof(DocumentedTagHelper.RemarksAndSummaryProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
PropertyWithSummaryAndRemarks_Summary,
|
||||
PropertyWithSummaryAndRemarks_Remarks)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = PropertyWithSummaryAndRemarks_Remarks
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, defaultCodeBase),
|
||||
nameof(DocumentedTagHelper.SummaryProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(PropertySummary, remarks: null)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = PropertySummary
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, defaultCodeBase),
|
||||
nameof(DocumentedTagHelper.RemarksProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(summary: null, remarks: PropertyRemarks)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Remarks = PropertyRemarks
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(defaultLocation, defaultCodeBase),
|
||||
nameof(DocumentedTagHelper.RemarksAndSummaryProperty),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
PropertyWithSummaryAndRemarks_Summary,
|
||||
PropertyWithSummaryAndRemarks_Remarks)
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = PropertyWithSummaryAndRemarks_Remarks
|
||||
}
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(nonExistentLocation, codeBase: null),
|
||||
|
|
@ -348,37 +394,47 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
summary: "en-GB: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
remarks: "en-GB: " + PropertyWithSummaryAndRemarks_Remarks),
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = "en-GB: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = "en-GB: " + PropertyWithSummaryAndRemarks_Remarks
|
||||
},
|
||||
"en-GB"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
summary: "en: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
remarks: "en: " + PropertyWithSummaryAndRemarks_Remarks),
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = "en: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = "en: " + PropertyWithSummaryAndRemarks_Remarks
|
||||
},
|
||||
"en-US"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
summary: "fr-FR: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
remarks: "fr-FR: " + PropertyWithSummaryAndRemarks_Remarks),
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = "fr-FR: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = "fr-FR: " + PropertyWithSummaryAndRemarks_Remarks
|
||||
},
|
||||
"fr-FR"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
summary: "fr: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
remarks: "fr: " + PropertyWithSummaryAndRemarks_Remarks),
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = "fr: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = "fr: " + PropertyWithSummaryAndRemarks_Remarks
|
||||
},
|
||||
"fr-BE"
|
||||
},
|
||||
{
|
||||
CreateDocumentationTagHelperType(LocalizedDocumentedAssemblyLocation, codeBase: null),
|
||||
new TagHelperAttributeDesignTimeDescriptor(
|
||||
summary: "nl-BE: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
remarks: "nl-BE: " + PropertyWithSummaryAndRemarks_Remarks),
|
||||
new TagHelperAttributeDesignTimeDescriptor
|
||||
{
|
||||
Summary = "nl-BE: " + PropertyWithSummaryAndRemarks_Summary,
|
||||
Remarks = "nl-BE: " + PropertyWithSummaryAndRemarks_Remarks
|
||||
},
|
||||
"nl-BE"
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,12 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
attributes: Enumerable.Empty<TagHelperAttributeDescriptor>(),
|
||||
requiredAttributes: new[] { "required attribute one", "required attribute two" },
|
||||
tagStructure: TagStructure.Unspecified,
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor("usage summary", "usage remarks", "some-tag"));
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = "usage summary",
|
||||
Remarks = "usage remarks",
|
||||
OutputElementHint = "some-tag"
|
||||
});
|
||||
|
||||
var expectedSerializedDescriptor =
|
||||
$"{{\"{ nameof(TagHelperDescriptor.Prefix) }\":\"prefix:\"," +
|
||||
|
|
@ -188,7 +193,12 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
attributes: Enumerable.Empty<TagHelperAttributeDescriptor>(),
|
||||
requiredAttributes: new[] { "required attribute one", "required attribute two" },
|
||||
tagStructure: TagStructure.WithoutEndTag,
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor("usage summary", "usage remarks", "some-tag"));
|
||||
designTimeDescriptor: new TagHelperDesignTimeDescriptor
|
||||
{
|
||||
Summary = "usage summary",
|
||||
Remarks = "usage remarks",
|
||||
OutputElementHint = "some-tag"
|
||||
});
|
||||
|
||||
// Act
|
||||
var descriptor = JsonConvert.DeserializeObject<TagHelperDescriptor>(serializedDescriptor);
|
||||
|
|
|
|||
|
|
@ -58,10 +58,26 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
Factory.Code("\"four\"").AsTagHelperPrefixDirective("four"));
|
||||
var expectedDescriptors = new TagHelperDirectiveDescriptor[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor("one", TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor("two", TagHelperDirectiveType.RemoveTagHelper),
|
||||
new TagHelperDirectiveDescriptor("three", TagHelperDirectiveType.RemoveTagHelper),
|
||||
new TagHelperDirectiveDescriptor("four", TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "one",
|
||||
DirectiveType = TagHelperDirectiveType.AddTagHelper
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "two",
|
||||
DirectiveType = TagHelperDirectiveType.RemoveTagHelper
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "three",
|
||||
DirectiveType = TagHelperDirectiveType.RemoveTagHelper
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "four",
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
|
|
@ -81,14 +97,34 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
var resolver = new TestTagHelperDescriptorResolver();
|
||||
var expectedInitialDirectiveDescriptors = new TagHelperDirectiveDescriptor[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor("one", TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor("two", TagHelperDirectiveType.RemoveTagHelper),
|
||||
new TagHelperDirectiveDescriptor("three", TagHelperDirectiveType.RemoveTagHelper),
|
||||
new TagHelperDirectiveDescriptor("four", TagHelperDirectiveType.TagHelperPrefix),
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "one",
|
||||
DirectiveType = TagHelperDirectiveType.AddTagHelper
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "two",
|
||||
DirectiveType = TagHelperDirectiveType.RemoveTagHelper
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "three",
|
||||
DirectiveType = TagHelperDirectiveType.RemoveTagHelper
|
||||
},
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "four",
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
}
|
||||
};
|
||||
var expectedEndDirectiveDescriptors = new TagHelperDirectiveDescriptor[]
|
||||
{
|
||||
new TagHelperDirectiveDescriptor("custom", TagHelperDirectiveType.AddTagHelper)
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "custom",
|
||||
DirectiveType = TagHelperDirectiveType.AddTagHelper
|
||||
}
|
||||
};
|
||||
var tagHelperDirectiveSpanVisitor = new CustomTagHelperDirectiveSpanVisitor(
|
||||
resolver,
|
||||
|
|
@ -131,7 +167,11 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
.Accepts(AcceptedCharacters.None),
|
||||
Factory.Code("\"something\"").AsTagHelperPrefixDirective("something")));
|
||||
var expectedDirectiveDescriptor =
|
||||
new TagHelperDirectiveDescriptor("something", TagHelperDirectiveType.TagHelperPrefix);
|
||||
new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "something",
|
||||
DirectiveType = TagHelperDirectiveType.TagHelperPrefix
|
||||
};
|
||||
|
||||
// Act
|
||||
tagHelperDirectiveSpanVisitor.GetDescriptors(document);
|
||||
|
|
@ -157,8 +197,11 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
.Accepts(AcceptedCharacters.None),
|
||||
Factory.Code("\"something\"").AsAddTagHelper("something"))
|
||||
);
|
||||
var expectedRegistration =
|
||||
new TagHelperDirectiveDescriptor("something", TagHelperDirectiveType.AddTagHelper);
|
||||
var expectedRegistration = new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "something",
|
||||
DirectiveType = TagHelperDirectiveType.AddTagHelper
|
||||
};
|
||||
|
||||
// Act
|
||||
tagHelperDirectiveSpanVisitor.GetDescriptors(document);
|
||||
|
|
@ -181,8 +224,11 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
.Accepts(AcceptedCharacters.None),
|
||||
Factory.Code("\"something\"").AsRemoveTagHelper("something"))
|
||||
);
|
||||
var expectedRegistration =
|
||||
new TagHelperDirectiveDescriptor("something", TagHelperDirectiveType.RemoveTagHelper);
|
||||
var expectedRegistration = new TagHelperDirectiveDescriptor
|
||||
{
|
||||
DirectiveText = "something",
|
||||
DirectiveType = TagHelperDirectiveType.RemoveTagHelper
|
||||
};
|
||||
|
||||
// Act
|
||||
tagHelperDirectiveSpanVisitor.GetDescriptors(document);
|
||||
|
|
|
|||
Loading…
Reference in New Issue