diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs index d564623c7d..4ba64a7aaf 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorIRLoweringPhase.cs @@ -413,7 +413,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution AttributeName = attribute.Name, TagHelperTypeName = associatedDescriptor.TypeName, Descriptor = associatedAttributeDescriptor, - ValueStyle = attribute.ValueStyle + ValueStyle = attribute.ValueStyle, + SourceRange = BuildSourceRangeFromNode(attributeValueNode) }; Builder.Push(setTagHelperProperty); diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs index 28f9796e20..e3c2610e39 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/DefaultRazorRuntimeCSharpLoweringPhase.cs @@ -12,6 +12,19 @@ namespace Microsoft.AspNetCore.Razor.Evolution { internal class DefaultRazorRuntimeCSharpLoweringPhase : RazorCSharpLoweringPhaseBase { + private static string _tagHelperId; + + internal static string GenerateUniqueTagHelperId { + get + { + return _tagHelperId ?? Guid.NewGuid().ToString("N"); + } + set + { + _tagHelperId = value; + } + } + protected override void ExecuteCore(RazorCodeDocument codeDocument) { var irDocument = codeDocument.GetIRDocument(); @@ -32,6 +45,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution { GeneratedCode = renderingContext.Writer.GenerateCode(), LineMappings = renderingContext.LineMappings, + Diagnostics = renderingContext.ErrorSink.Errors }; codeDocument.SetCSharpDocument(csharpDocument); @@ -170,7 +184,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution { const string ValueWriterName = "__razor_attribute_value_writer"; - var expressionValue = node.Children.First() as CSharpExpressionIRNode; + var expressionValue = node.Children.FirstOrDefault() as CSharpExpressionIRNode; var linePragma = expressionValue != null ? new LinePragmaWriter(Context.Writer, node.SourceRange) : null; var prefixLocation = node.SourceRange.AbsoluteIndex; var valueLocation = node.SourceRange.AbsoluteIndex + node.Prefix.Length; @@ -194,8 +208,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution Context.Writer.WriteStartNewObject("HelperResult" /* ORIGINAL: TemplateTypeName */); var initialRenderingConventions = Context.RenderingConventions; - var redirectConventions = new CSharpRedirectRenderingConventions(ValueWriterName, Context.Writer); - Context.RenderingConventions = redirectConventions; + Context.RenderingConventions = new CSharpRedirectRenderingConventions(ValueWriterName, Context.Writer); using (Context.Writer.BuildAsyncLambda(endLine: false, parameterNames: ValueWriterName)) { VisitDefault(node); @@ -250,8 +263,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution .WriteStartNewObject("HelperResult" /* ORIGINAL: TemplateTypeName */); var initialRenderingConventions = Context.RenderingConventions; - var redirectConventions = new CSharpRedirectRenderingConventions(TemplateWriterName, Context.Writer); - Context.RenderingConventions = redirectConventions; + Context.RenderingConventions = new CSharpRedirectRenderingConventions(TemplateWriterName, Context.Writer); using (Context.Writer.BuildAsyncLambda(endLine: false, parameterNames: TemplateWriterName)) { VisitDefault(node); @@ -260,6 +272,375 @@ namespace Microsoft.AspNetCore.Razor.Evolution Context.Writer.WriteEndMethodInvocation(endLine: false); } + + internal override void VisitTagHelper(TagHelperIRNode node) + { + var initialTagHelperRenderingContext = Context.TagHelperRenderingContext; + Context.TagHelperRenderingContext = new TagHelperRenderingContext(); + VisitDefault(node); + Context.TagHelperRenderingContext = initialTagHelperRenderingContext; + } + + internal override void VisitInitializeTagHelperStructure(InitializeTagHelperStructureIRNode node) + { + // Call into the tag helper scope manager to start a new tag helper scope. + // Also capture the value as the current execution context. + Context.Writer + .WriteStartAssignment("__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */) + .WriteStartInstanceMethodInvocation( + "__tagHelperScopeManager" /* ORIGINAL: ScopeManagerVariableName */, + "Begin" /* ORIGINAL: ScopeManagerBeginMethodName */); + + // Assign a unique ID for this instance of the source HTML tag. This must be unique + // per call site, e.g. if the tag is on the view twice, there should be two IDs. + Context.Writer.WriteStringLiteral(node.TagName) + .WriteParameterSeparator() + .Write("global::") + .Write(typeof(TagMode).FullName) + .Write(".") + .Write(node.TagMode.ToString()) + .WriteParameterSeparator() + .WriteStringLiteral(GenerateUniqueTagHelperId) + .WriteParameterSeparator(); + + // We remove and redirect writers so TagHelper authors can retrieve content. + var initialRenderingConventions = Context.RenderingConventions; + Context.RenderingConventions = new CSharpRenderingConventions(Context.Writer); + using (Context.Writer.BuildAsyncLambda(endLine: false)) + { + VisitDefault(node); + } + Context.RenderingConventions = initialRenderingConventions; + + Context.Writer.WriteEndMethodInvocation(); + } + + internal override void VisitCreateTagHelper(CreateTagHelperIRNode node) + { + var tagHelperVariableName = GetTagHelperVariableName(node.TagHelperTypeName); + + Context.Writer + .WriteStartAssignment(tagHelperVariableName) + .WriteStartMethodInvocation( + "CreateTagHelper" /* ORIGINAL: CreateTagHelperMethodName */, + "global::" + node.TagHelperTypeName) + .WriteEndMethodInvocation(); + + Context.Writer.WriteInstanceMethodInvocation( + "__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */, + "Add" /* ORIGINAL: ExecutionContextAddMethodName */, + tagHelperVariableName); + } + + internal override void VisitAddTagHelperHtmlAttribute(AddTagHelperHtmlAttributeIRNode node) + { + var attributeValueStyleParameter = $"global::{typeof(HtmlAttributeValueStyle).FullName}.{node.ValueStyle}"; + var isConditionalAttributeValue = node.Children.Any(child => child is CSharpAttributeValueIRNode); + + // All simple text and minimized attributes will be pre-allocated. + if (isConditionalAttributeValue) + { + // Dynamic attribute value should be run through the conditional attribute removal system. It's + // unbound and contains C#. + + // TagHelper attribute rendering is buffered by default. We do not want to write to the current + // writer. + var valuePieceCount = node.Children.Count( + child => child is HtmlAttributeValueIRNode || child is CSharpAttributeValueIRNode); + + Context.Writer + .WriteStartMethodInvocation("BeginAddHtmlAttributeValues" /* ORIGINAL: BeginAddHtmlAttributeValuesMethodName */) + .Write("__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */) + .WriteParameterSeparator() + .WriteStringLiteral(node.Name) + .WriteParameterSeparator() + .Write(valuePieceCount.ToString(CultureInfo.InvariantCulture)) + .WriteParameterSeparator() + .Write(attributeValueStyleParameter) + .WriteEndMethodInvocation(); + + var initialRenderingConventions = Context.RenderingConventions; + Context.RenderingConventions = new TagHelperHtmlAttributeRenderingConventions(Context.Writer); + VisitDefault(node); + Context.RenderingConventions = initialRenderingConventions; + + Context.Writer + .WriteMethodInvocation( + "EndAddHtmlAttributeValues" /* ORIGINAL: EndAddHtmlAttributeValuesMethodName */, + "__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */); + } + else + { + // This is a data-* attribute which includes C#. Do not perform the conditional attribute removal or + // other special cases used when IsDynamicAttributeValue(). But the attribute must still be buffered to + // determine its final value. + + // Attribute value is not plain text, must be buffered to determine its final value. + Context.Writer.WriteMethodInvocation("BeginWriteTagHelperAttribute" /* ORIGINAL: BeginWriteTagHelperAttributeMethodName */); + + // We're building a writing scope around the provided chunks which captures everything written from the + // page. Therefore, we do not want to write to any other buffer since we're using the pages buffer to + // ensure we capture all content that's written, directly or indirectly. + var initialRenderingConventions = Context.RenderingConventions; + Context.RenderingConventions = new CSharpRenderingConventions(Context.Writer); + VisitDefault(node); + Context.RenderingConventions = initialRenderingConventions; + + Context.Writer + .WriteStartAssignment("__tagHelperStringValueBuffer" /* ORIGINAL: StringValueBufferVariableName */) + .WriteMethodInvocation("EndWriteTagHelperAttribute" /* ORIGINAL: EndWriteTagHelperAttributeMethodName */) + .WriteStartInstanceMethodInvocation( + "__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */, + "AddHtmlAttribute" /* ORIGINAL: ExecutionContextAddHtmlAttributeMethodName */) + .WriteStringLiteral(node.Name) + .WriteParameterSeparator() + .WriteStartMethodInvocation("Html.Raw" /* ORIGINAL: MarkAsHtmlEncodedMethodName */) + .Write("__tagHelperStringValueBuffer" /* ORIGINAL: StringValueBufferVariableName */) + .WriteEndMethodInvocation(endLine: false) + .WriteParameterSeparator() + .Write(attributeValueStyleParameter) + .WriteEndMethodInvocation(); + } + } + + internal override void VisitSetTagHelperProperty(SetTagHelperPropertyIRNode node) + { + var tagHelperVariableName = GetTagHelperVariableName(node.TagHelperTypeName); + var tagHelperRenderingContext = Context.TagHelperRenderingContext; + + // Ensure that the property we're trying to set has initialized its dictionary bound properties. + if (node.Descriptor.IsIndexer && + tagHelperRenderingContext.VerifiedPropertyDictionaries.Add(node.Descriptor.PropertyName)) + { + // Throw a reasonable Exception at runtime if the dictionary property is null. + Context.Writer + .Write("if (") + .Write(tagHelperVariableName) + .Write(".") + .Write(node.Descriptor.PropertyName) + .WriteLine(" == null)"); + using (Context.Writer.BuildScope()) + { + // System is in Host.NamespaceImports for all MVC scenarios. No need to generate FullName + // of InvalidOperationException type. + Context.Writer + .Write("throw ") + .WriteStartNewObject(nameof(InvalidOperationException)) + .WriteStartMethodInvocation("FormatInvalidIndexerAssignment" /* ORIGINAL: FormatInvalidIndexerAssignmentMethodName */) + .WriteStringLiteral(node.AttributeName) + .WriteParameterSeparator() + .WriteStringLiteral(node.TagHelperTypeName) + .WriteParameterSeparator() + .WriteStringLiteral(node.Descriptor.PropertyName) + .WriteEndMethodInvocation(endLine: false) // End of method call + .WriteEndMethodInvocation(); // End of new expression / throw statement + } + } + + var propertyValueAccessor = GetTagHelperPropertyAccessor(tagHelperVariableName, node.AttributeName, node.Descriptor); + + string previousValueAccessor; + if (tagHelperRenderingContext.RenderedBoundAttributes.TryGetValue(node.AttributeName, out previousValueAccessor)) + { + Context.Writer + .WriteStartAssignment(propertyValueAccessor) + .Write(previousValueAccessor) + .WriteLine(";"); + + return; + } + else + { + tagHelperRenderingContext.RenderedBoundAttributes[node.AttributeName] = propertyValueAccessor; + } + + if (node.Descriptor.IsStringProperty) + { + Context.Writer.WriteMethodInvocation("BeginWriteTagHelperAttribute" /* ORIGINAL: BeginWriteTagHelperAttributeMethodName */); + + var initialRenderingConventions = Context.RenderingConventions; + Context.RenderingConventions = new CSharpLiteralCodeConventions(Context.Writer); + VisitDefault(node); + Context.RenderingConventions = initialRenderingConventions; + + Context.Writer + .WriteStartAssignment("__tagHelperStringValueBuffer" /* ORIGINAL: StringValueBufferVariableName */) + .WriteMethodInvocation("EndWriteTagHelperAttribute" /* ORIGINAL: EndWriteTagHelperAttributeMethodName */) + .WriteStartAssignment(propertyValueAccessor) + .Write("__tagHelperStringValueBuffer" /* ORIGINAL: StringValueBufferVariableName */) + .WriteLine(";"); + } + else + { + using (new LinePragmaWriter(Context.Writer, node.SourceRange)) + { + Context.Writer.WriteStartAssignment(propertyValueAccessor); + + if (node.Descriptor.IsEnum && + node.Children.Count == 1 && + node.Children.First() is HtmlContentIRNode) + { + Context.Writer + .Write("global::") + .Write(node.Descriptor.TypeName) + .Write("."); + } + + RenderTagHelperAttributeInline(node, node.SourceRange, Context); + + Context.Writer.WriteLine(";"); + } + } + + // We need to inform the context of the attribute value. + Context.Writer + .WriteStartInstanceMethodInvocation( + "__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */, + "AddTagHelperAttribute" /* ORIGINAL: ExecutionContextAddTagHelperAttributeMethodName */) + .WriteStringLiteral(node.AttributeName) + .WriteParameterSeparator() + .Write(propertyValueAccessor) + .WriteParameterSeparator() + .Write($"global::{typeof(HtmlAttributeValueStyle).FullName}.{node.ValueStyle}") + .WriteEndMethodInvocation(); + } + + internal override void VisitExecuteTagHelpers(ExecuteTagHelpersIRNode node) + { + Context.Writer + .Write("await ") + .WriteStartInstanceMethodInvocation( + "__tagHelperRunner" /* ORIGINAL: RunnerVariableName */, + "RunAsync" /* ORIGINAL: RunnerRunAsyncMethodName */) + .Write("__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */) + .WriteEndMethodInvocation(); + + var executionContextVariableName = "__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */; + var executionContextOutputPropertyName = "Output" /* ORIGINAL: ExecutionContextOutputPropertyName */; + var tagHelperOutputAccessor = $"{executionContextVariableName}.{executionContextOutputPropertyName}"; + + Context.Writer + .Write("if (!") + .Write(tagHelperOutputAccessor) + .Write(".") + .Write("IsContentModified" /* ORIGINAL: TagHelperOutputIsContentModifiedPropertyName */) + .WriteLine(")"); + + using (Context.Writer.BuildScope()) + { + Context.Writer + .Write("await ") + .WriteInstanceMethodInvocation( + executionContextVariableName, + "SetOutputContentAsync" /* ORIGINAL: ExecutionContextSetOutputContentAsyncMethodName */); + } + + Context.Writer + .Write(Context.RenderingConventions.StartWriteMethod) + .Write(tagHelperOutputAccessor) + .WriteEndMethodInvocation() + .WriteStartAssignment(executionContextVariableName) + .WriteInstanceMethodInvocation( + "__tagHelperScopeManager" /* ORIGINAL: ScopeManagerVariableName */, + "End" /* ORIGINAL: ScopeManagerEndMethodName */); + } + + internal override void VisitDeclareTagHelperFields(DeclareTagHelperFieldsIRNode node) + { + Context.Writer.WriteLineHiddenDirective(); + + // Need to disable the warning "X is assigned to but never used." for the value buffer since + // whether it's used depends on how a TagHelper is used. + Context.Writer + .WritePragma("warning disable 0414") + .Write("private ") + .WriteVariableDeclaration("string", "__tagHelperStringValueBuffer" /* ORIGINAL: StringValueBufferVariableName */, value: null) + .WritePragma("warning restore 0414"); + + Context.Writer + .Write("private global::") + .WriteVariableDeclaration( + "Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext" /* ORIGINAL: ExecutionContextTypeName */, + "__tagHelperExecutionContext" /* ORIGINAL: ExecutionContextVariableName */, + value: null); + + Context.Writer + .Write("private global::") + .Write("Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner" /* ORIGINAL: RunnerTypeName */) + .Write(" ") + .Write("__tagHelperRunner" /* ORIGINAL: RunnerVariableName */) + .Write(" = new global::") + .Write("Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner" /* ORIGINAL: RunnerTypeName */) + .WriteLine("();"); + + const string backedScopeManageVariableName = "__backed" + "__tagHelperScopeManager" /* ORIGINAL: ScopeManagerVariableName */; + Context.Writer + .Write("private global::") + .WriteVariableDeclaration( + "Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager", + backedScopeManageVariableName, + value: null); + + Context.Writer + .Write("private global::") + .Write("Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager" /* ORIGINAL: ScopeManagerTypeName */) + .Write(" ") + .WriteLine("__tagHelperScopeManager" /* ORIGINAL: ScopeManagerVariableName */); + + using (Context.Writer.BuildScope()) + { + Context.Writer.WriteLine("get"); + using (Context.Writer.BuildScope()) + { + Context.Writer + .Write("if (") + .Write(backedScopeManageVariableName) + .WriteLine(" == null)"); + + using (Context.Writer.BuildScope()) + { + Context.Writer + .WriteStartAssignment(backedScopeManageVariableName) + .WriteStartNewObject("Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager" /* ORIGINAL: ScopeManagerTypeName */) + .Write("StartTagHelperWritingScope" /* ORIGINAL: StartTagHelperWritingScopeMethodName */) + .WriteParameterSeparator() + .Write("EndTagHelperWritingScope" /* ORIGINAL: EndTagHelperWritingScopeMethodName */) + .WriteEndMethodInvocation(); + } + + Context.Writer.WriteReturn(backedScopeManageVariableName); + } + } + + foreach (var tagHelperTypeName in node.UsedTagHelperTypeNames) + { + var tagHelperVariableName = GetTagHelperVariableName(tagHelperTypeName); + Context.Writer + .Write("private global::") + .WriteVariableDeclaration( + tagHelperTypeName, + tagHelperVariableName, + value: null); + } + } + + private static string GetTagHelperPropertyAccessor( + string tagHelperVariableName, + string attributeName, + TagHelperAttributeDescriptor descriptor) + { + var propertyAccessor = $"{tagHelperVariableName}.{descriptor.PropertyName}"; + + if (descriptor.IsIndexer) + { + var dictionaryKey = attributeName.Substring(descriptor.Name.Length); + propertyAccessor += $"[\"{dictionaryKey}\"]"; + } + + return propertyAccessor; + } + + private static string GetTagHelperVariableName(string tagHelperTypeName) => "__" + tagHelperTypeName.Replace('.', '_'); } } -} +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/LegacyResources.resx b/src/Microsoft.AspNetCore.Razor.Evolution/LegacyResources.resx index 12a1b2c3e8..cfbead3383 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/LegacyResources.resx +++ b/src/Microsoft.AspNetCore.Razor.Evolution/LegacyResources.resx @@ -384,6 +384,14 @@ Instead, wrap the contents of the block in "{{}}": The tag helper '{0}' must not have C# in the element's attribute declaration area. + + Code blocks (e.g. @{{var variable = 23;}}) must not appear in non-string tag helper attribute values. + Already in an expression (code) context. If necessary an explicit expression (e.g. @(@readonly)) may be used. + + + Inline markup blocks (e.g. @<p>content</p>) must not appear in non-string tag helper attribute values. + Expected a '{0}' attribute value, not a string. + In order to put a symbol back, it must have been the symbol which ended at the current position. The specified symbol ends at {0}, but the current position is {1} diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/Properties/LegacyResources.Designer.cs b/src/Microsoft.AspNetCore.Razor.Evolution/Properties/LegacyResources.Designer.cs index 5bd5c4c7e8..3fa9fc3ed1 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/Properties/LegacyResources.Designer.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/Properties/LegacyResources.Designer.cs @@ -1334,6 +1334,42 @@ namespace Microsoft.AspNetCore.Razor.Evolution return string.Format(CultureInfo.CurrentCulture, GetString("TagHelpers_CannotHaveCSharpInTagDeclaration"), p0); } + /// + /// Code blocks (e.g. @{{var variable = 23;}}) must not appear in non-string tag helper attribute values. + /// Already in an expression (code) context. If necessary an explicit expression (e.g. @(@readonly)) may be used. + /// + internal static string TagHelpers_CodeBlocks_NotSupported_InAttributes + { + get { return GetString("TagHelpers_CodeBlocks_NotSupported_InAttributes"); } + } + + /// + /// Code blocks (e.g. @{{var variable = 23;}}) must not appear in non-string tag helper attribute values. + /// Already in an expression (code) context. If necessary an explicit expression (e.g. @(@readonly)) may be used. + /// + internal static string FormatTagHelpers_CodeBlocks_NotSupported_InAttributes() + { + return GetString("TagHelpers_CodeBlocks_NotSupported_InAttributes"); + } + + /// + /// Inline markup blocks (e.g. @<p>content</p>) must not appear in non-string tag helper attribute values. + /// Expected a '{0}' attribute value, not a string. + /// + internal static string TagHelpers_InlineMarkupBlocks_NotSupported_InAttributes + { + get { return GetString("TagHelpers_InlineMarkupBlocks_NotSupported_InAttributes"); } + } + + /// + /// Inline markup blocks (e.g. @<p>content</p>) must not appear in non-string tag helper attribute values. + /// Expected a '{0}' attribute value, not a string. + /// + internal static string FormatTagHelpers_InlineMarkupBlocks_NotSupported_InAttributes(object p0) + { + return string.Format(CultureInfo.CurrentCulture, GetString("TagHelpers_InlineMarkupBlocks_NotSupported_InAttributes"), p0); + } + /// /// In order to put a symbol back, it must have been the symbol which ended at the current position. The specified symbol ends at {0}, but the current position is {1} /// diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpDocument.cs b/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpDocument.cs index d71f2520c5..b021ca2039 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpDocument.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpDocument.cs @@ -11,5 +11,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution public string GeneratedCode { get; set; } internal IReadOnlyList LineMappings { get; set; } + + internal IReadOnlyList Diagnostics { get; set; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs b/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs index c58f17475d..df5e3d6641 100644 --- a/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs +++ b/src/Microsoft.AspNetCore.Razor.Evolution/RazorCSharpLoweringPhaseBase.cs @@ -25,6 +25,43 @@ namespace Microsoft.AspNetCore.Razor.Evolution } } + protected static void RenderTagHelperAttributeInline( + RazorIRNode node, + MappingLocation documentLocation, + CSharpRenderingContext context) + { + if (node is SetTagHelperPropertyIRNode || node is CSharpExpressionIRNode) + { + for (var i = 0; i < node.Children.Count; i++) + { + RenderTagHelperAttributeInline(node.Children[i], documentLocation, context); + } + } + else if (node is HtmlContentIRNode) + { + context.Writer.Write(((HtmlContentIRNode)node).Content); + } + else if (node is CSharpTokenIRNode) + { + context.Writer.Write(((CSharpTokenIRNode)node).Content); + } + else if (node is CSharpStatementIRNode) + { + context.ErrorSink.OnError( + new SourceLocation(documentLocation.AbsoluteIndex, documentLocation.CharacterIndex, documentLocation.ContentLength), + LegacyResources.TagHelpers_CodeBlocks_NotSupported_InAttributes, + documentLocation.ContentLength); + } + else if (node is TemplateIRNode) + { + var attributeValueNode = (SetTagHelperPropertyIRNode)node.Parent; + context.ErrorSink.OnError( + new SourceLocation(documentLocation.AbsoluteIndex, documentLocation.CharacterIndex, documentLocation.ContentLength), + LegacyResources.FormatTagHelpers_InlineMarkupBlocks_NotSupported_InAttributes(attributeValueNode.Descriptor.TypeName), + documentLocation.ContentLength); + } + } + protected static int CalculateExpressionPadding(MappingLocation sourceRange, CSharpRenderingContext context) { var spaceCount = 0; @@ -120,13 +157,10 @@ namespace Microsoft.AspNetCore.Razor.Evolution public override string StartWriteLiteralMethod => "WriteLiteralTo(" + _redirectWriter + ", " /* ORIGINAL: WriteLiteralToMethodName */; - public override string StartBeginWriteAttributeMethod => "BeginWriteAttributeTo(" + _redirectWriter + ", " /* ORIGINAL: BeginWriteAttributeToMethodName */; - public override string StartWriteAttributeValueMethod => "WriteAttributeValueTo(" + _redirectWriter + ", " /* ORIGINAL: WriteAttributeValueToMethodName */; - public override string StartEndWriteAttributeMethod => "EndWriteAttributeTo(" + _redirectWriter /* ORIGINAL: EndWriteAttributeToMethodName */; } @@ -150,6 +184,24 @@ namespace Microsoft.AspNetCore.Razor.Evolution public virtual string StartEndWriteAttributeMethod => "EndWriteAttribute(" /* ORIGINAL: EndWriteAttributeMethodName */; } + protected class TagHelperHtmlAttributeRenderingConventions : CSharpRenderingConventions + { + public TagHelperHtmlAttributeRenderingConventions(CSharpCodeWriter writer) : base(writer) + { + } + + public override string StartWriteAttributeValueMethod => "AddHtmlAttributeValue(" /* ORIGINAL: AddHtmlAttributeValueMethodName */; + } + + protected class CSharpLiteralCodeConventions : CSharpRenderingConventions + { + public CSharpLiteralCodeConventions(CSharpCodeWriter writer) : base(writer) + { + } + + public override string StartWriteMethod => StartWriteLiteralMethod; + } + protected class CSharpRenderingContext { private CSharpRenderingConventions _renderingConventions; @@ -177,11 +229,45 @@ namespace Microsoft.AspNetCore.Razor.Evolution } } - public ICollection Errors { get; } = new List(); + public ErrorSink ErrorSink { get; } = new ErrorSink(); public RazorSourceDocument SourceDocument { get; set; } public RazorParserOptions Options { get; set; } + + public TagHelperRenderingContext TagHelperRenderingContext { get; set; } + } + + protected class TagHelperRenderingContext + { + private Dictionary _renderedBoundAttributes; + private HashSet _verifiedPropertyDictionaries; + + public Dictionary RenderedBoundAttributes + { + get + { + if (_renderedBoundAttributes == null) + { + _renderedBoundAttributes = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + + return _renderedBoundAttributes; + } + } + + public HashSet VerifiedPropertyDictionaries + { + get + { + if (_verifiedPropertyDictionaries == null) + { + _verifiedPropertyDictionaries = new HashSet(StringComparer.Ordinal); + } + + return _verifiedPropertyDictionaries; + } + } } protected class PageStructureCSharpRenderer : RazorIRNodeWalker diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs index 8e78a92715..f499476b34 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -2,9 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Evolution.Intermediate; +using Microsoft.AspNetCore.Razor.Evolution.Legacy; using Xunit; using Xunit.Sdk; @@ -544,6 +546,154 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests // Assert AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); } + + [Fact] + public void SimpleTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.SimpleTagHelperDescriptors); + } + + [Fact] + public void TagHelpersWithBoundAttributes_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.SimpleTagHelperDescriptors); + } + + [Fact] + public void NestedTagHelpers_Runtime() + { + + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.SimpleTagHelperDescriptors); + } + + [Fact] + public void SingleTagHelper_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void SingleTagHelperWithNewlineBeforeAttributes_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void TagHelpersWithWeirdlySpacedAttributes_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void IncompleteTagHelper_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void BasicTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void BasicTagHelpers_Prefixed_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.PrefixedPAndInputTagHelperDescriptors); + } + + [Fact] + public void ComplexTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void DuplicateTargetTagHelper_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DuplicateTargetTagHelperDescriptors); + } + + [Fact] + public void EmptyAttributeTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void EscapedTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void AttributeTargetingTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.AttributeTargetingTagHelperDescriptors); + } + + [Fact] + public void PrefixedAttributeTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.PrefixedAttributeTagHelperDescriptors); + } + + [Fact] + public void DuplicateAttributeTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void DynamicAttributeTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DynamicAttributeTagHelpers_Descriptors); + } + + [Fact] + public void TransitionsInTagHelperAttributes_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void NestedScriptTagTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.DefaultPAndInputTagHelperDescriptors); + } + + [Fact] + public void SymbolBoundAttributes_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.SymbolBoundTagHelperDescriptors); + } + + [Fact] + public void EnumTagHelpers_Runtime() + { + // Arrange, Act & Assert + RunTagHelpersTest(TestTagHelperDescriptors.EnumTagHelperDescriptors); + } #endregion #region DesignTime @@ -1113,6 +1263,40 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests return RazorCodeDocument.Create(TestRazorSourceDocument.CreateResource(sourceFilename)); } + private void RunTagHelpersTest(IEnumerable descriptors) + { + // Arrange + var engine = RazorEngine.Create( + builder => + { + builder.Features.Add(new ApiSetsIRTestAdapter()); + builder.Features.Add(new TagHelperFeature(new TestTagHelperDescriptorResolver(descriptors))); + DefaultRazorRuntimeCSharpLoweringPhase.GenerateUniqueTagHelperId = "test"; + }); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + private class TestTagHelperDescriptorResolver : ITagHelperDescriptorResolver + { + private readonly IEnumerable _descriptors; + + public TestTagHelperDescriptorResolver(IEnumerable descriptors) + { + _descriptors = descriptors; + } + + public IEnumerable Resolve(TagHelperDescriptorResolutionContext resolutionContext) + { + return _descriptors; + } + } + private class ApiSetsIRTestAdapter : RazorIRPassBase { public override DocumentIRNode ExecuteCore(DocumentIRNode irDocument) diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TestTagHelperDescriptors.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TestTagHelperDescriptors.cs new file mode 100644 index 0000000000..d178035e87 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/TestTagHelperDescriptors.cs @@ -0,0 +1,623 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.AspNetCore.Razor.Evolution.Legacy; + +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests +{ + public class TestTagHelperDescriptors + { + internal static IEnumerable DefaultPAndInputTagHelperDescriptors { get; } + = BuildPAndInputTagHelperDescriptors(prefix: string.Empty); + internal static IEnumerable PrefixedPAndInputTagHelperDescriptors { get; } + = BuildPAndInputTagHelperDescriptors(prefix: "THS"); + + internal static IEnumerable SimpleTagHelperDescriptors + { + get + { + return new[] + { + new TagHelperDescriptor + { + TagName = "span", + TypeName = "SpanTagHelper" + }, + new TagHelperDescriptor + { + TagName = "div", + TypeName = "DivTagHelper" + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "InputTagHelper", + Attributes = new[] { new TagHelperAttributeDescriptor + { + Name = "value", + PropertyName = "FooProp", + TypeName = "System.String" + } } + } + }; + } + } + + internal static IEnumerable CssSelectorTagHelperDescriptors + { + get + { + var inputTypePropertyInfo = typeof(TestType).GetProperty("Type"); + var inputCheckedPropertyInfo = typeof(TestType).GetProperty("Checked"); + + return new[] + { + new TagHelperDescriptor + { + TagName = "a", + TypeName = "TestNamespace.ATagHelper", + AssemblyName = "SomeAssembly", + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor + { + Name = "href", + NameComparison = TagHelperRequiredAttributeNameComparison.FullMatch, + Value = "~/", + ValueComparison = TagHelperRequiredAttributeValueComparison.FullMatch, + } + }, + }, + new TagHelperDescriptor + { + TagName = "a", + TypeName = "TestNamespace.ATagHelperMultipleSelectors", + AssemblyName = "SomeAssembly", + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor + { + Name = "href", + NameComparison = TagHelperRequiredAttributeNameComparison.FullMatch, + Value = "~/", + ValueComparison = TagHelperRequiredAttributeValueComparison.PrefixMatch, + }, + new TagHelperRequiredAttributeDescriptor + { + Name = "href", + NameComparison = TagHelperRequiredAttributeNameComparison.FullMatch, + Value = "?hello=world", + ValueComparison = TagHelperRequiredAttributeValueComparison.SuffixMatch, + } + }, + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + }, + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor + { + Name = "type", + NameComparison = TagHelperRequiredAttributeNameComparison.FullMatch, + Value = "text", + ValueComparison = TagHelperRequiredAttributeValueComparison.FullMatch, + } + }, + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper2", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + }, + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor + { + Name = "ty", + NameComparison = TagHelperRequiredAttributeNameComparison.PrefixMatch, + } + }, + }, + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper", + AssemblyName = "SomeAssembly", + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor + { + Name = "href", + NameComparison = TagHelperRequiredAttributeNameComparison.FullMatch, + Value = "~/", + ValueComparison = TagHelperRequiredAttributeValueComparison.PrefixMatch, + } + }, + }, + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper2", + AssemblyName = "SomeAssembly", + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor + { + Name = "type", + NameComparison = TagHelperRequiredAttributeNameComparison.FullMatch, + } + }, + } + }; + } + } + + internal static IEnumerable EnumTagHelperDescriptors + { + get + { + return new[] + { + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "catch-all", + PropertyName = "CatchAll", + IsEnum = true, + TypeName = typeof(MyEnum).FullName + }, + } + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "value", + PropertyName = "Value", + IsEnum = true, + TypeName = typeof(MyEnum).FullName + }, + } + }, + }; + } + } + + internal static IEnumerable SymbolBoundTagHelperDescriptors + { + get + { + return new[] + { + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "[item]", + PropertyName = "ListItems", + TypeName = typeof(List).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "[(item)]", + PropertyName = "ArrayItems", + TypeName = typeof(string[]).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "(click)", + PropertyName = "Event1", + TypeName = typeof(Action).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "(^click)", + PropertyName = "Event2", + TypeName = typeof(Action).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "*something", + PropertyName = "StringProperty1", + TypeName = typeof(string).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "#local", + PropertyName = "StringProperty2", + TypeName = typeof(string).FullName + }, + }, + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "bound" } }, + }, + }; + } + } + + internal static IEnumerable MinimizedTagHelpers_Descriptors + { + get + { + return new[] + { + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "catchall-bound-string", + PropertyName = "BoundRequiredString", + TypeName = typeof(string).FullName, + IsStringProperty = true + } + }, + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor { Name = "catchall-unbound-required" } + }, + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "input-bound-required-string", + PropertyName = "BoundRequiredString", + TypeName = typeof(string).FullName, + IsStringProperty = true + }, + new TagHelperAttributeDescriptor + { + Name = "input-bound-string", + PropertyName = "BoundString", + TypeName = typeof(string).FullName, + IsStringProperty = true + } + }, + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor { Name = "input-bound-required-string" }, + new TagHelperRequiredAttributeDescriptor { Name = "input-unbound-required" } + }, + } + }; + } + } + + internal static IEnumerable DynamicAttributeTagHelpers_Descriptors + { + get + { + return new[] + { + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "bound", + PropertyName = "Bound", + TypeName = typeof(string).FullName, + IsStringProperty = true + } + } + } + }; + } + } + + internal static IEnumerable DuplicateTargetTagHelperDescriptors + { + get + { + var inputTypePropertyInfo = typeof(TestType).GetProperty("Type"); + var inputCheckedPropertyInfo = typeof(TestType).GetProperty("Checked"); + return new[] + { + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + new TagHelperAttributeDescriptor("checked", inputCheckedPropertyInfo) + }, + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "type" } }, + }, + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + new TagHelperAttributeDescriptor("checked", inputCheckedPropertyInfo) + }, + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "checked" } }, + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + new TagHelperAttributeDescriptor("checked", inputCheckedPropertyInfo) + }, + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "type" } }, + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + new TagHelperAttributeDescriptor("checked", inputCheckedPropertyInfo) + }, + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "checked" } }, + } + }; + } + } + + internal static IEnumerable AttributeTargetingTagHelperDescriptors + { + get + { + var inputTypePropertyInfo = typeof(TestType).GetProperty("Type"); + var inputCheckedPropertyInfo = typeof(TestType).GetProperty("Checked"); + return new[] + { + new TagHelperDescriptor + { + TagName = "p", + TypeName = "TestNamespace.PTagHelper", + AssemblyName = "SomeAssembly", + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "class" } }, + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo) + }, + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "type" } }, + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper2", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + new TagHelperAttributeDescriptor("checked", inputCheckedPropertyInfo) + }, + RequiredAttributes = new[] + { + new TagHelperRequiredAttributeDescriptor { Name = "type" }, + new TagHelperRequiredAttributeDescriptor { Name = "checked" } + }, + }, + new TagHelperDescriptor + { + TagName = "*", + TypeName = "TestNamespace.CatchAllTagHelper", + AssemblyName = "SomeAssembly", + RequiredAttributes = new[] { new TagHelperRequiredAttributeDescriptor { Name = "catchAll" } }, + } + }; + } + } + + internal static IEnumerable PrefixedAttributeTagHelperDescriptors + { + get + { + return new[] + { + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper1", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "int-prefix-grabber", + PropertyName = "IntProperty", + TypeName = typeof(int).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "int-dictionary", + PropertyName = "IntDictionaryProperty", + TypeName = typeof(IDictionary).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "string-dictionary", + PropertyName = "StringDictionaryProperty", + TypeName = "Namespace.DictionaryWithoutParameterlessConstructor" + }, + new TagHelperAttributeDescriptor + { + Name = "string-prefix-grabber", + PropertyName = "StringProperty", + TypeName = typeof(string).FullName, + IsStringProperty = true + }, + new TagHelperAttributeDescriptor + { + Name = "int-prefix-", + PropertyName = "IntDictionaryProperty", + TypeName = typeof(int).FullName, + IsIndexer = true + }, + new TagHelperAttributeDescriptor + { + Name = "string-prefix-", + PropertyName = "StringDictionaryProperty", + TypeName = typeof(string).FullName, + IsIndexer = true, + IsStringProperty = true + } + } + }, + new TagHelperDescriptor + { + TagName = "input", + TypeName = "TestNamespace.InputTagHelper2", + AssemblyName = "SomeAssembly", + Attributes = new[] + { + new TagHelperAttributeDescriptor + { + Name = "int-dictionary", + PropertyName = "IntDictionaryProperty", + TypeName = typeof(int).FullName + }, + new TagHelperAttributeDescriptor + { + Name = "string-dictionary", + PropertyName = "StringDictionaryProperty", + TypeName = "Namespace.DictionaryWithoutParameterlessConstructor" + }, + new TagHelperAttributeDescriptor + { + Name = "int-prefix-", + PropertyName = "IntDictionaryProperty", + TypeName = typeof(int).FullName, + IsIndexer = true + }, + new TagHelperAttributeDescriptor + { + Name = "string-prefix-", + PropertyName = "StringDictionaryProperty", + TypeName = typeof(string).FullName, + IsIndexer = true, + IsStringProperty = true + } + } + } + }; + } + } + + private static IEnumerable BuildPAndInputTagHelperDescriptors(string prefix) + { + var pAgePropertyInfo = typeof(TestType).GetProperty("Age"); + var inputTypePropertyInfo = typeof(TestType).GetProperty("Type"); + var checkedPropertyInfo = typeof(TestType).GetProperty("Checked"); + + return new[] + { + new TagHelperDescriptor + { + Prefix = prefix, + TagName = "p", + TypeName = "TestNamespace.PTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("age", pAgePropertyInfo) + }, + TagStructure = TagStructure.NormalOrSelfClosing + }, + new TagHelperDescriptor + { + Prefix = prefix, + TagName = "input", + TypeName = "TestNamespace.InputTagHelper", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo) + }, + TagStructure = TagStructure.WithoutEndTag + }, + new TagHelperDescriptor + { + Prefix = prefix, + TagName = "input", + TypeName = "TestNamespace.InputTagHelper2", + AssemblyName = "SomeAssembly", + Attributes = new TagHelperAttributeDescriptor[] + { + new TagHelperAttributeDescriptor("type", inputTypePropertyInfo), + new TagHelperAttributeDescriptor("checked", checkedPropertyInfo) + }, + } + }; + } + + private class TestType + { + public int Age { get; set; } + + public string Type { get; set; } + + public bool Checked { get; set; } + + public string BoundProperty { get; set; } + } + + public enum MyEnum + { + MyValue, + MySecondValue + } + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml new file mode 100644 index 0000000000..924029743e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml @@ -0,0 +1 @@ +@addTagHelper something, nice \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml new file mode 100644 index 0000000000..0b7f7f0092 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml @@ -0,0 +1,8 @@ +@addTagHelper *, something + +

+

HelloWorld

+ + + +

\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..a9561ea6a2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs @@ -0,0 +1,133 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6c8b55df08e7538ff6155a5bc3b8135b305ad08a" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + private global::TestNamespace.CatchAllTagHelper __TestNamespace_CatchAllTagHelper = null; + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n

"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("strong", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Hello"); + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("hi"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("catchAll", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("World

\r\n \r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("hi"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("catchAll", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("btn"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml new file mode 100644 index 0000000000..fb0515d0a3 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml @@ -0,0 +1,9 @@ +@addTagHelper "something, nice" + +
+

+

+ + +

+
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml new file mode 100644 index 0000000000..73e9407a3d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml @@ -0,0 +1,10 @@ +@tagHelperPrefix "THS" +@addTagHelper something, nice + + + +

+ + +
+
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs new file mode 100644 index 0000000000..9af2c9118d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs @@ -0,0 +1,82 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "859f448778119fd3043b1f19ea3d1f695558d6a6" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("THSp", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n

\r\n \r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("THSinput", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagOnly, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello World"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n
"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml new file mode 100644 index 0000000000..b8b5bcbf73 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml @@ -0,0 +1,10 @@ +@addTagHelper something, nice +@removeTagHelper "doesntmatter, nice" + +
+

+

+ + +

+
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..fdb535ffa6 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs @@ -0,0 +1,134 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "02f53fe4a386cdc0885235e5fd3f5d6d317dd4d6" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n
\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("-delay1000"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagOnly, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("2000 + "); +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" + Write(ViewBag.DefaultInterval); + +#line default +#line hidden + WriteLiteral(" + 1"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("text"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello World"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("1000"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data-delay", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n
"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml new file mode 100644 index 0000000000..e14e76dbb0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml @@ -0,0 +1,36 @@ +@addTagHelper something, nice + +@if (true) +{ + var checkbox = "checkbox"; + +
+

+

Set Time:

+ @if (false) + { +

New Time:

+ } + else + { +

Current Time:

+ + + } +

+

+ @{ var @object = false;} + +

+

+ +

+

+ +

+

+ +

+ @someMethod(@

) +
+} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..668890e721 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs @@ -0,0 +1,482 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3cc5f5ed458e4e33874c4242798b195a31ab065c" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + if (true) +{ + var checkbox = "checkbox"; + + + +#line default +#line hidden + WriteLiteral("
\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n

Set Time:

\r\n"); +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + if (false) + { + + +#line default +#line hidden + WriteLiteral(" "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("New Time: "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("text"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("value", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("Enter in a new time..."); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("placeholder", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + } + else + { + + +#line default +#line hidden + WriteLiteral(" "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Current Time: "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); +#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + WriteLiteral(checkbox); + +#line default +#line hidden + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); +#line 17 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + WriteLiteral(true ? "checkbox" : "anything"); + +#line default +#line hidden + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("tYPe", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagOnly, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); +#line 18 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + if(true) { + +#line default +#line hidden + WriteLiteral("checkbox"); +#line 18 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + } else { + +#line default +#line hidden + WriteLiteral("anything"); +#line 18 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + } + +#line default +#line hidden + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); +#line 19 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "time", 3, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + AddHtmlAttributeValue("", 146, "Current", 146, 7, true); + AddHtmlAttributeValue(" ", 153, "Time:", 154, 6, true); +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +AddHtmlAttributeValue(" ", 159, DateTime.Now, 160, 13, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n"); +#line 22 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + var @object = false; + +#line default +#line hidden + WriteLiteral(" "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagOnly, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); +#line 23 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = (@object); + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("ChecKED", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("first value"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 21 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_PTagHelper.Age = DateTimeOffset.Now.Year - 1970; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("second value"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("hello"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("world"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 26 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = (DateTimeOffset.Now.Year > 2014); + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); +#line 25 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_PTagHelper.Age = -1970 + @DateTimeOffset.Now.Year; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagOnly, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); +#line 29 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); +#line 28 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_PTagHelper.Age = DateTimeOffset.Now.Year - 1970; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); +#line 32 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = @( DateTimeOffset.Now.Year ) > 2014 ; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); +#line 31 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_PTagHelper.Age = ("My age is this long.".Length); + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); +#line 34 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" + Write(someMethod(item => new HelperResult(async(__razor_template_writer) => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); +#line 34 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = checked; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); +#line 34 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +__TestNamespace_PTagHelper.Age = 123; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("hello"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); +} +))); + +#line default +#line hidden + WriteLiteral("\r\n
\r\n"); +#line 36 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" +} + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml new file mode 100644 index 0000000000..9b83d5f7fb --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml @@ -0,0 +1,13 @@ +@addTagHelper "*, something" + +2 TagHelpers. +1 TagHelper. +2 TagHelpers +2 TagHelpers +0 TagHelpers. +1 TagHelper +1 TagHelper +1 TagHelper + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml new file mode 100644 index 0000000000..fb38512fde --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml @@ -0,0 +1,7 @@ +@addTagHelper something, nice + +

+ + + +

\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..cb5727c4ad --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs @@ -0,0 +1,167 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b7cbc77774bfe558f4548cc5b3760f88754a329e" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("button"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("TYPE", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("button"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("false"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("checked", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("button"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("true"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("checked", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("true"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("checked", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" +__TestNamespace_PTagHelper.Age = 3; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("40"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("AGE", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("500"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("Age", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml new file mode 100644 index 0000000000..d4429862bc --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml @@ -0,0 +1,3 @@ +@addTagHelper something, nice + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs new file mode 100644 index 0000000000..236b4dc9b1 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs @@ -0,0 +1,71 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1014725b9048d825ce97b0e5e260ac35f057fe0a" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.CatchAllTagHelper __TestNamespace_CatchAllTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper.Type = __TestNamespace_InputTagHelper.Type; + __TestNamespace_CatchAllTagHelper.Type = __TestNamespace_InputTagHelper.Type; + __TestNamespace_CatchAllTagHelper.Type = __TestNamespace_InputTagHelper.Type; +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml" +__TestNamespace_InputTagHelper.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper.Checked = __TestNamespace_InputTagHelper.Checked; + __TestNamespace_CatchAllTagHelper.Checked = __TestNamespace_InputTagHelper.Checked; + __TestNamespace_CatchAllTagHelper.Checked = __TestNamespace_InputTagHelper.Checked; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml new file mode 100644 index 0000000000..8480908aca --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml @@ -0,0 +1,14 @@ +@addTagHelper something, nice + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..96d896ed6d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs @@ -0,0 +1,301 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "107e341010aad754fc5c952722dbfdc7e33fc38e" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + AddHtmlAttributeValue("", 49, "prefix", 49, 6, true); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +AddHtmlAttributeValue(" ", 55, DateTime.Now, 56, 13, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + AddHtmlAttributeValue("", 93, new HelperResult(async(__razor_attribute_value_writer) => { +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + if (true) { + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +WriteTo(__razor_attribute_value_writer, string.Empty); + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } else { + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteTo(__razor_attribute_value_writer, false); + +#line default +#line hidden +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } + +#line default +#line hidden + } + ), 93, 44, false); + AddHtmlAttributeValue(" ", 137, "suffix", 138, 7, true); + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("prefix "); +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteLiteral(DateTime.Now); + +#line default +#line hidden + WriteLiteral(" suffix"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Bound = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + AddHtmlAttributeValue("", 204, "prefix", 204, 6, true); +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +AddHtmlAttributeValue(" ", 210, DateTime.Now, 211, 13, false); + +#line default +#line hidden + AddHtmlAttributeValue(" ", 224, "suffix", 225, 7, true); + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + BeginWriteTagHelperAttribute(); +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteLiteral(long.MinValue); + +#line default +#line hidden + WriteLiteral(" "); +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + if (true) { + +#line default +#line hidden +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteLiteral(string.Empty); + +#line default +#line hidden +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } else { + +#line default +#line hidden +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteLiteral(false); + +#line default +#line hidden +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } + +#line default +#line hidden + WriteLiteral(" "); +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteLiteral(int.MaxValue); + +#line default +#line hidden + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Bound = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +AddHtmlAttributeValue("", 345, long.MinValue, 345, 14, false); + +#line default +#line hidden + AddHtmlAttributeValue(" ", 359, new HelperResult(async(__razor_attribute_value_writer) => { +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + if (true) { + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteTo(__razor_attribute_value_writer, string.Empty); + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } else { + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteTo(__razor_attribute_value_writer, false); + +#line default +#line hidden +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } + +#line default +#line hidden + } + ), 360, 44, false); +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +AddHtmlAttributeValue(" ", 404, int.MaxValue, 405, 13, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 5, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +AddHtmlAttributeValue("", 442, long.MinValue, 442, 14, false); + +#line default +#line hidden +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +AddHtmlAttributeValue(" ", 456, DateTime.Now, 457, 13, false); + +#line default +#line hidden + AddHtmlAttributeValue(" ", 470, "static", 471, 7, true); + AddHtmlAttributeValue(" ", 477, "content", 481, 11, true); +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +AddHtmlAttributeValue(" ", 488, int.MaxValue, 489, 13, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + AddHtmlAttributeValue("", 526, new HelperResult(async(__razor_attribute_value_writer) => { +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + if (true) { + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" +WriteTo(__razor_attribute_value_writer, string.Empty); + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } else { + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + WriteTo(__razor_attribute_value_writer, false); + +#line default +#line hidden +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" + } + +#line default +#line hidden + } + ), 526, 44, false); + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml new file mode 100644 index 0000000000..afe5f6ad7b --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml @@ -0,0 +1,8 @@ +@addTagHelper something + +
+ +

+ +

+
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..54550f54bb --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs @@ -0,0 +1,115 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ab5e45403d2c57cfdbab9546c3a27eea94f0fb5c" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n
\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = ; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = ; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" +__TestNamespace_PTagHelper.Age = ; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n
"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml new file mode 100644 index 0000000000..903e99ebe4 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml @@ -0,0 +1,11 @@ +@addTagHelper something, nice + +@{ + var enumValue = MyEnum.MyValue; +} + + + + + + diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..42a664c8d0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs @@ -0,0 +1,162 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f9124dcd7da8c06ab193a971690c676c5e0adaac" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.CatchAllTagHelper __TestNamespace_CatchAllTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" + + var enumValue = MyEnum.MyValue; + + +#line default +#line hidden + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" +__TestNamespace_InputTagHelper.Value = MyEnum.MyValue; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" +AddHtmlAttributeValue("", 128, MyEnum.MySecondValue, 128, 21, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" +__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestTagHelperDescriptors+MyEnum.MyValue; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" +__TestNamespace_InputTagHelper.Value = global::Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestTagHelperDescriptors+MyEnum.MySecondValue; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" +__TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestTagHelperDescriptors+MyEnum.MyValue; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" +__TestNamespace_InputTagHelper.Value = enumValue; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" +__TestNamespace_CatchAllTagHelper.CatchAll = enumValue; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml new file mode 100644 index 0000000000..2cd3a16374 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml @@ -0,0 +1,8 @@ +@addTagHelper something + + + + + Not a TagHelper: + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..ab765f0ebc --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs @@ -0,0 +1,73 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "93da17a7091c4d218cfc54282dec1b7b7beac072" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n
\r\n \r\n
"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml new file mode 100644 index 0000000000..add07acf43 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml @@ -0,0 +1,3 @@ +@addTagHelper something, nice + +

+ + + + + +

\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml new file mode 100644 index 0000000000..6ebcc156f0 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml @@ -0,0 +1,16 @@ +@addTagHelper something, nice + + + } + +

+ + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..d9df4a185a --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs @@ -0,0 +1,110 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e3cbc45bc2d4185bf69128f14721795d68e6961a" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n\r\n"); +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml" + } + + +#line default +#line hidden + WriteLiteral(" \r\n "); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello World"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("1000"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data-delay", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n \r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml new file mode 100644 index 0000000000..e6637b03fa --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml @@ -0,0 +1,5 @@ +@addTagHelper *, TestAssembly +Hola +
+ +
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..7411074c14 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs @@ -0,0 +1,92 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "fc99ab53936074d66d80552f780e58d4edb223d6" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::SpanTagHelper __SpanTagHelper = null; + private global::DivTagHelper __DivTagHelper = null; + private global::InputTagHelper __InputTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Hola"); + } + ); + __SpanTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__SpanTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("someattr", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __InputTagHelper.FooProp = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("value", __InputTagHelper.FooProp, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("text"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + ); + __DivTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__DivTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("foo"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml new file mode 100644 index 0000000000..5cca6769e7 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml @@ -0,0 +1,23 @@ +@addTagHelper something, nice + +@{ + var literate = "or illiterate"; + var intDictionary = new Dictionary + { + { "three", 3 }, + }; + var stringDictionary = new SortedDictionary + { + { "name", "value" }, + }; +} + +
+ + + + +
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..2139ba7bf2 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.codegen.cs @@ -0,0 +1,241 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5ae668a393146e4a06179eb37952603907a9b825" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.InputTagHelper1 __TestNamespace_InputTagHelper1 = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" + + var literate = "or illiterate"; + var intDictionary = new Dictionary + { + { "three", 3 }, + }; + var stringDictionary = new SortedDictionary + { + { "name", "value" }, + }; + + +#line default +#line hidden + WriteLiteral("\r\n
\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper1 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper1); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("checkbox"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntDictionaryProperty = intDictionary; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper1.IntDictionaryProperty, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.IntDictionaryProperty = __TestNamespace_InputTagHelper1.IntDictionaryProperty; +#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.StringDictionaryProperty = stringDictionary; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("string-dictionary", __TestNamespace_InputTagHelper1.StringDictionaryProperty, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.StringDictionaryProperty = __TestNamespace_InputTagHelper1.StringDictionaryProperty; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper1 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper1); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("password"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 17 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntDictionaryProperty = intDictionary; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper1.IntDictionaryProperty, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.IntDictionaryProperty = __TestNamespace_InputTagHelper1.IntDictionaryProperty; + if (__TestNamespace_InputTagHelper1.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "TestNamespace.InputTagHelper1", "IntDictionaryProperty")); + } +#line 17 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"] = 37; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-garlic", __TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"], global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.IntDictionaryProperty["garlic"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"]; +#line 17 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntProperty = 42; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper1.IntProperty, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"] = __TestNamespace_InputTagHelper1.IntProperty; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper1 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper1); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("radio"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 19 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntProperty = 42; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper1.IntProperty, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + if (__TestNamespace_InputTagHelper2.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-grabber", "TestNamespace.InputTagHelper2", "IntDictionaryProperty")); + } + __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"] = __TestNamespace_InputTagHelper1.IntProperty; +#line 19 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"] = 37; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-salt", __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"], global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.IntDictionaryProperty["salt"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"]; +#line 19 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"] = 98; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-pepper", __TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"], global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.IntDictionaryProperty["pepper"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"]; + BeginWriteTagHelperAttribute(); + WriteLiteral("8"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("int-prefix-salt", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("string"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper1.StringProperty = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-grabber", __TestNamespace_InputTagHelper1.StringProperty, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + if (__TestNamespace_InputTagHelper2.StringDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-grabber", "TestNamespace.InputTagHelper2", "StringDictionaryProperty")); + } + __TestNamespace_InputTagHelper2.StringDictionaryProperty["grabber"] = __TestNamespace_InputTagHelper1.StringProperty; + BeginWriteTagHelperAttribute(); + WriteLiteral("another string"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"] = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-paprika", __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"], global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.StringDictionaryProperty["paprika"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"]; + BeginWriteTagHelperAttribute(); + WriteLiteral("literate "); +#line 21 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" + WriteLiteral(literate); + +#line default +#line hidden + WriteLiteral("?"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"] = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-cumin", __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"], global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"]; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper1 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper1); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + if (__TestNamespace_InputTagHelper1.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-value", "TestNamespace.InputTagHelper1", "IntDictionaryProperty")); + } +#line 22 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper1.IntDictionaryProperty["value"] = 37; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __TestNamespace_InputTagHelper1.IntDictionaryProperty["value"], global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.IntDictionaryProperty["value"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["value"]; + if (__TestNamespace_InputTagHelper1.StringDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-thyme", "TestNamespace.InputTagHelper1", "StringDictionaryProperty")); + } + BeginWriteTagHelperAttribute(); + WriteLiteral("string"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"] = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"], global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"]; + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n
"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml new file mode 100644 index 0000000000..fae5f78d2d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml @@ -0,0 +1 @@ +@removeTagHelper something, nice \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml new file mode 100644 index 0000000000..bd4ce8107a --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml @@ -0,0 +1,5 @@ +@addTagHelper *, TestAssembly +

Hola

+
+ +
\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.codegen.cs new file mode 100644 index 0000000000..999de0002f --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.codegen.cs @@ -0,0 +1,57 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "248dc9c0c1ef35d3636cfb2fa7f5ac0f8a0b553a" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::InputTagHelper __InputTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("

Hola

\r\n
\r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __InputTagHelper.FooProp = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("value", __InputTagHelper.FooProp, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("text"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml new file mode 100644 index 0000000000..b331d1208f --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml @@ -0,0 +1,3 @@ +@addTagHelper something, nice + +

Body of Tag

\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml new file mode 100644 index 0000000000..5b6b28d786 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml @@ -0,0 +1,4 @@ +@addTagHelper something, nice + +

Body of Tag

\ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.codegen.cs new file mode 100644 index 0000000000..ca3dd015cc --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.codegen.cs @@ -0,0 +1,58 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "83a2d9976b209020f80917aa61a3338e37d3c446" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Body of Tag"); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello World"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml" +__TestNamespace_PTagHelper.Age = 1337; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.codegen.cs new file mode 100644 index 0000000000..9613539d6e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.codegen.cs @@ -0,0 +1,58 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4d7ff17da750ffcbca3130faffef1030e5eb03b8" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Body of Tag"); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello World"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml" +__TestNamespace_PTagHelper.Age = 1337; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml new file mode 100644 index 0000000000..2974c94c74 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml @@ -0,0 +1,19 @@ +@addTagHelper *, nice + +
    +
      + + + +
      +
      + +
        +
          + + + +
          +
          \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.codegen.cs new file mode 100644 index 0000000000..7a03ceea82 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.codegen.cs @@ -0,0 +1,210 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "85cdc137d6a8c95fa926441de44d5187d5c8051e" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.CatchAllTagHelper __TestNamespace_CatchAllTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n
            \r\n
              \r\n\r\n\r\n\r\n
              \r\n
              \r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("ul", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("bound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml" +__TestNamespace_CatchAllTagHelper.ListItems = items; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("[item]", __TestNamespace_CatchAllTagHelper.ListItems, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("items"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("[item]", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("ul", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("bound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml" +__TestNamespace_CatchAllTagHelper.ArrayItems = items; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("[(item)]", __TestNamespace_CatchAllTagHelper.ArrayItems, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("items"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("[(item)]", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("button", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Click Me"); + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("bound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); +#line 14 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml" +__TestNamespace_CatchAllTagHelper.Event1 = doSomething(); + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("(click)", __TestNamespace_CatchAllTagHelper.Event1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("doSomething()"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("(click)", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("button", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Click Me"); + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("bound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); +#line 15 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml" +__TestNamespace_CatchAllTagHelper.Event2 = doSomething(); + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("(^click)", __TestNamespace_CatchAllTagHelper.Event2, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("doSomething()"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("(^click)", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("template", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("\r\n"); + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("bound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); + BeginWriteTagHelperAttribute(); + WriteLiteral("value"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_CatchAllTagHelper.StringProperty1 = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("*something", __TestNamespace_CatchAllTagHelper.StringProperty1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("value"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("*something", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("bound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("#localminimized", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); + BeginWriteTagHelperAttribute(); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("bound", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.Minimized); + BeginWriteTagHelperAttribute(); + WriteLiteral("value"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_CatchAllTagHelper.StringProperty2 = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("#local", __TestNamespace_CatchAllTagHelper.StringProperty2, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("value"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("#local", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml new file mode 100644 index 0000000000..55705c6b00 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml @@ -0,0 +1,14 @@ +@addTagHelper something, nice + +@{ + var code = "some code"; +} + +@section MySection { +
              + + In None ContentBehavior. + Some buffered values with @code + +
              +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml new file mode 100644 index 0000000000..83023559d3 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml @@ -0,0 +1,4 @@ +@addTagHelper *, TestAssembly +
              + +
              \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.codegen.cs new file mode 100644 index 0000000000..f0c0418b3d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.codegen.cs @@ -0,0 +1,59 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f7ed8b06f7ede1d7928dc05f2b2f081a3fda13aa" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::InputTagHelper __InputTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("
              \r\n "); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "bound", 1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml" +AddHtmlAttributeValue("", 56, Hello, 56, 6, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); + BeginWriteTagHelperAttribute(); + WriteLiteral("text"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml new file mode 100644 index 0000000000..d390bc024d --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml @@ -0,0 +1,15 @@ +@addTagHelper something, nice + +

              Body of Tag

              + + + +

              + + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs new file mode 100644 index 0000000000..8d5d3cc4cf --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs @@ -0,0 +1,141 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "44db1fa170a6845ec719f4200e4bb1f639830b49" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; + private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Body of Tag"); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("Hello World"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml" +__TestNamespace_PTagHelper.Age = 1337; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml" + Write(true); + +#line default +#line hidden + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("text"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; + BeginWriteTagHelperAttribute(); + WriteLiteral("hello"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml" +__TestNamespace_PTagHelper.Age = 1234; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + BeginWriteTagHelperAttribute(); + WriteLiteral("hello2"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.SingleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + BeginWriteTagHelperAttribute(); + WriteLiteral("password"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; + BeginWriteTagHelperAttribute(); + WriteLiteral("blah"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml new file mode 100644 index 0000000000..b05d39b2ce --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml @@ -0,0 +1,12 @@ +@addTagHelper something, nice +@{ + var @class = "container-fluid"; + var @int = 1; +} + +

              Body of Tag

              +

              +

              +

              +

              +

              diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs new file mode 100644 index 0000000000..9794b94796 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs @@ -0,0 +1,190 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b9b5a5baa9e2ea89cb37a127c0623b083bff74c3" +namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes_Runtime + { + #line hidden + #pragma warning disable 0414 + private string __tagHelperStringValueBuffer = null; + #pragma warning restore 0414 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" + + var @class = "container-fluid"; + var @int = 1; + + +#line default +#line hidden + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + WriteLiteral("Body of Tag"); + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + AddHtmlAttributeValue("", 107, new HelperResult(async(__razor_attribute_value_writer) => { + } + ), 107, 6, false); + EndAddHtmlAttributeValues(__tagHelperExecutionContext); +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +__TestNamespace_PTagHelper.Age = 1337; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +AddHtmlAttributeValue("", 153, @class, 153, 9, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +__TestNamespace_PTagHelper.Age = 42; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("test"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +__TestNamespace_PTagHelper.Age = 42 + @int; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("test"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 10 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +__TestNamespace_PTagHelper.Age = int; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginWriteTagHelperAttribute(); + WriteLiteral("test"); + __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +__TestNamespace_PTagHelper.Age = (@int); + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.Evolution.Legacy.TagMode.StartTagAndEndTag, "test", async() => { + } + ); + __TestNamespace_PTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 2, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + AddHtmlAttributeValue("", 296, "custom-", 296, 7, true); +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +AddHtmlAttributeValue("", 303, @class, 303, 9, false); + +#line default +#line hidden + EndAddHtmlAttributeValues(__tagHelperExecutionContext); +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" +__TestNamespace_PTagHelper.Age = 4 * @(@int + 2); + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.Evolution.Legacy.HtmlAttributeValueStyle.DoubleQuotes); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt index 3f9f8b23f0..6cd4ee8a98 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/NestedTagHelpers.ir.txt @@ -19,7 +19,7 @@ Document - TagHelper - InitializeTagHelperStructure - - input - TagMode.SelfClosing CreateTagHelper - - InputTagHelper - SetTagHelperProperty - - value - FooProp - HtmlAttributeValueStyle.DoubleQuotes + SetTagHelperProperty - (92:3,17 [5] NestedTagHelpers.cshtml) - value - FooProp - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (92:3,17 [5] NestedTagHelpers.cshtml) - Hello AddTagHelperHtmlAttribute - - type - HtmlAttributeValueStyle.SingleQuotes HtmlContent - (104:3,29 [4] NestedTagHelpers.cshtml) - text diff --git a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/TagHelpersWithBoundAttributes.ir.txt b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/TagHelpersWithBoundAttributes.ir.txt index ce6394201b..2d043cee49 100644 --- a/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/TagHelpersWithBoundAttributes.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Evolution.Test/TestFiles/IntegrationTests/TagHelpersIntegrationTest/TagHelpersWithBoundAttributes.ir.txt @@ -10,7 +10,7 @@ Document - TagHelper - InitializeTagHelperStructure - - input - TagMode.SelfClosing CreateTagHelper - - InputTagHelper - SetTagHelperProperty - - bound - FooProp - HtmlAttributeValueStyle.DoubleQuotes + SetTagHelperProperty - (56:2,17 [6] TagHelpersWithBoundAttributes.cshtml) - bound - FooProp - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (57:2,18 [5] TagHelpersWithBoundAttributes.cshtml) CSharpToken - (57:2,18 [5] TagHelpersWithBoundAttributes.cshtml) - Hello AddTagHelperHtmlAttribute - - type - HtmlAttributeValueStyle.SingleQuotes