diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperOutputTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperOutputTest.cs new file mode 100644 index 0000000000..f3427feabd --- /dev/null +++ b/test/Microsoft.AspNet.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperOutputTest.cs @@ -0,0 +1,698 @@ +// 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.IO; +using System.Threading.Tasks; +using Microsoft.AspNet.Razor.Runtime.TagHelpers; +using Microsoft.AspNet.Razor.TagHelpers; +using Microsoft.Extensions.WebEncoders.Testing; +using Xunit; + +namespace Microsoft.AspNet.Razor.Runtime.Test.Runtime.TagHelpers +{ + public class TagHelperOutputTest + { + public static TheoryData WriteTagHelper_InputData + { + get + { + // parameters: TagHelperOutput, expectedOutput + return new TheoryData + { + { + // parameters: TagName, Attributes, SelfClosing, PreContent, Content, PostContent + GetTagHelperOutput( + tagName: "div", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "
Hello World!
" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "Hello World!" + }, + { + GetTagHelperOutput( + tagName: " ", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "Hello World!" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() { { "test", "testVal" } }, + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + { "test", "testVal" }, + { "something", " spaced " } + }, + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + ["test"] = new TagHelperAttribute + { + Name = "test", + Minimized = true + }, + }, + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + ["test"] = new TagHelperAttribute + { + Name = "test", + Minimized = true + }, + ["test2"] = new TagHelperAttribute + { + Name = "test2", + Minimized = true + }, + }, + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + ["first"] = "unminimized", + ["test"] = new TagHelperAttribute + { + Name = "test", + Minimized = true + }, + }, + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + ["test"] = new TagHelperAttribute + { + Name = "test", + Minimized = true + }, + ["last"] = "unminimized", + }, + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() { { "test", "testVal" } }, + tagMode: TagMode.SelfClosing, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + { "test", "testVal" }, + { "something", " spaced " } + }, + tagMode: TagMode.SelfClosing, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() { { "test", "testVal" } }, + tagMode: TagMode.StartTagOnly, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + { "test", "testVal" }, + { "something", " spaced " } + }, + tagMode: TagMode.StartTagOnly, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: "Hello World!", + content: null, + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: null, + postContent: "Hello World!", + postElement: null), + "

Hello World!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: null), + "

HelloTestWorld!

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.SelfClosing, + preElement: null, + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: null), + "

" + }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagOnly, + preElement: null, + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: null), + "

" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: null), + "HelloTestWorld!" + }, + { + GetTagHelperOutput( + tagName: "random", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.SelfClosing, + preElement: null, + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: null), + "" + }, + { + GetTagHelperOutput( + tagName: "random", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagOnly, + preElement: null, + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: null), + "" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.SelfClosing, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.SelfClosing, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.SelfClosing, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.StartTagOnly, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.StartTagOnly, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagOnly, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.SelfClosing, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.SelfClosing, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.SelfClosing, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.StartTagOnly, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.StartTagOnly, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagOnly, + preElement: null, + preContent: null, + content: null, + postContent: null, + postElement: "After"), + "After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeHelloTestWorld!After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.StartTagAndEndTag, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeHelloTestWorld!After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.SelfClosing, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeAfter" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList(), + tagMode: TagMode.SelfClosing, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeHelloTestWorld!After" + }, + { + GetTagHelperOutput( + tagName: "custom", + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagOnly, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeAfter" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagOnly, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeHelloTestWorld!After" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList(), + tagMode: TagMode.StartTagAndEndTag, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeHelloTestWorld!After" + }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList { { "test", "testVal" } }, + tagMode: TagMode.StartTagAndEndTag, + preElement: "Before", + preContent: "Hello", + content: "Test", + postContent: "World!", + postElement: "After"), + "BeforeHelloTestWorld!After" + }, + }; + } + } + + [Theory] + [MemberData(nameof(WriteTagHelper_InputData))] + public void TagHelperOutput_WritesFormattedTagHelper(TagHelperOutput output, string expected) + { + // Arrange + var writer = new StringWriter(); + var tagHelperExecutionContext = new TagHelperExecutionContext( + tagName: output.TagName, + tagMode: output.TagMode, + items: new Dictionary(), + uniqueId: string.Empty, + executeChildContentAsync: () => Task.FromResult(result: true), + startTagHelperWritingScope: () => { }, + endTagHelperWritingScope: () => new DefaultTagHelperContent()); + tagHelperExecutionContext.Output = output; + var testEncoder = new HtmlTestEncoder(); + + // Act + output.WriteTo(writer, testEncoder); + + // Assert + Assert.Equal(expected, writer.ToString(), StringComparer.Ordinal); + } + + private static TagHelperOutput GetTagHelperOutput( + string tagName, + TagHelperAttributeList attributes, + TagMode tagMode, + string preElement, + string preContent, + string content, + string postContent, + string postElement) + { + var output = new TagHelperOutput( + tagName, + attributes, + getChildContentAsync: (_) => Task.FromResult(new DefaultTagHelperContent())) + { + TagMode = tagMode + }; + + if (preElement != null) + { + output.PreElement.AppendHtml(preElement); + } + + if (preContent != null) + { + output.PreContent.AppendHtml(preContent); + } + + if (content != null) + { + output.Content.AppendHtml(content); + } + + if (postContent != null) + { + output.PostContent.AppendHtml(postContent); + } + + if (postElement != null) + { + output.PostElement.AppendHtml(postElement); + } + + return output; + } + } +} diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs index 1c88a9485c..0457a21513 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs @@ -43,8 +43,12 @@ namespace TestOutput __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("catchAll", Html.Raw("hi")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(54, 36, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(90, 62, true); @@ -68,7 +72,7 @@ __TestNamespace_InputTagHelper2.Checked = true; __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(152, 40, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(192, 6, true); @@ -95,7 +99,7 @@ __TestNamespace_InputTagHelper2.Checked = true; __tagHelperExecutionContext.AddHtmlAttribute("catchAll", Html.Raw("hi")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(198, 54, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(252, 2, true); @@ -107,8 +111,12 @@ __TestNamespace_InputTagHelper2.Checked = true; __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(30, 228, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs index 37e860e021..987efe3515 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs @@ -38,7 +38,7 @@ namespace TestOutput __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(153, 7, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(160, 10, true); @@ -66,7 +66,7 @@ namespace TestOutput __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(170, 71, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(241, 10, true); @@ -90,7 +90,7 @@ __TestNamespace_InputTagHelper2.Checked = **From custom attribute code renderer* __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(251, 39, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(290, 6, true); @@ -103,8 +103,12 @@ __TestNamespace_InputTagHelper2.Checked = **From custom attribute code renderer* __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); __tagHelperExecutionContext.AddHtmlAttribute("data-delay", Html.Raw("1000")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(102, 198, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(300, 8, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs index c0de8783f7..7337e4adc3 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs @@ -50,7 +50,7 @@ namespace TestOutput __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(187, 41, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(228, 6, true); @@ -62,8 +62,12 @@ namespace TestOutput __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(105, 136, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(241, 11, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs index 7f9c7ddf34..9c3c71d6c1 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs @@ -39,7 +39,7 @@ namespace TestOutput __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(153, 7, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(160, 10, true); @@ -67,7 +67,7 @@ namespace TestOutput __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(170, 71, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(241, 10, true); @@ -91,7 +91,7 @@ __TestNamespace_InputTagHelper2.Checked = true; __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(251, 39, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(290, 6, true); @@ -104,8 +104,12 @@ __TestNamespace_InputTagHelper2.Checked = true; __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); __tagHelperExecutionContext.AddHtmlAttribute("data-delay", Html.Raw("1000")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(102, 198, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(300, 8, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs index 3f65bfeee2..1f4bf429d9 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs @@ -78,7 +78,7 @@ namespace TestOutput __tagHelperExecutionContext.AddHtmlAttribute("placeholder", Html.Raw("Enter in a new time...")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(278, 66, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } @@ -86,8 +86,12 @@ namespace TestOutput __TestNamespace_PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(265, 83, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(348, 2, true); @@ -133,7 +137,7 @@ namespace TestOutput __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(431, 37, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } @@ -141,8 +145,12 @@ namespace TestOutput __TestNamespace_PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(414, 58, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(472, 18, true); @@ -167,7 +175,7 @@ namespace TestOutput __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(490, 50, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(540, 18, true); @@ -219,7 +227,7 @@ namespace TestOutput __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(558, 79, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(639, 2, true); @@ -248,8 +256,12 @@ AddHtmlAttributeValue(" ", 159, DateTime.Now, 160, 14, false); #line hidden EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(137, 529, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(668, 10, true); @@ -289,7 +301,7 @@ __TestNamespace_InputTagHelper2.Checked = (@object); __tagHelperExecutionContext.AddTagHelperAttribute("ChecKED", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(817, 28, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(845, 10, true); @@ -308,8 +320,12 @@ __TestNamespace_InputTagHelper2.Checked = (@object); __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw("second value")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(678, 181, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(859, 10, true); @@ -336,7 +352,7 @@ __TestNamespace_InputTagHelper2.Checked = (@object); __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(925, 85, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(1010, 10, true); @@ -353,8 +369,12 @@ __TestNamespace_PTagHelper.Age = -1970 + @DateTimeOffset.Now.Year; #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(869, 155, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(1024, 10, true); @@ -379,7 +399,7 @@ __TestNamespace_InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014; __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(1088, 48, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(1136, 10, true); @@ -396,8 +416,12 @@ __TestNamespace_PTagHelper.Age = DateTimeOffset.Now.Year - 1970; #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(1034, 116, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(1150, 10, true); @@ -422,7 +446,7 @@ __TestNamespace_InputTagHelper2.Checked = @( DateTimeOffset.Now.Year ) > 20 __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(1216, 63, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(1279, 10, true); @@ -439,8 +463,12 @@ __TestNamespace_PTagHelper.Age = ("My age is this long.".Length); #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(1160, 133, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(1293, 10, true); @@ -465,7 +493,7 @@ __TestNamespace_PTagHelper.Age = ("My age is this long.".Length); __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(1343, 26, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } @@ -480,8 +508,12 @@ __TestNamespace_PTagHelper.Age = 123; __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("hello")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(1316, 57, false); - await WriteTagHelperToAsync(__razor_template_writer, __tagHelperExecutionContext); + WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs index f501188847..82cdf20b4b 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs @@ -45,7 +45,7 @@ namespace TestOutput __tagHelperExecutionContext.AddHtmlAttribute("TYPE", Html.Raw("checkbox")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(69, 39, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(108, 6, true); @@ -71,7 +71,7 @@ __TestNamespace_InputTagHelper2.Checked = true; __tagHelperExecutionContext.AddHtmlAttribute("checked", Html.Raw("false")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(114, 70, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(184, 2, true); @@ -90,8 +90,12 @@ __TestNamespace_PTagHelper.Age = 3; __tagHelperExecutionContext.AddHtmlAttribute("AGE", Html.Raw("40")); __tagHelperExecutionContext.AddHtmlAttribute("Age", Html.Raw("500")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(33, 157, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs index 4da8a8e2a6..aa25bec082 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs @@ -46,7 +46,7 @@ __TestNamespace_InputTagHelper.Checked = true; __TestNamespace_CatchAllTagHelper.Checked = __TestNamespace_InputTagHelper.Checked; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(33, 40, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs index b00955ae3a..5643b91a46 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs @@ -41,7 +41,7 @@ AddHtmlAttributeValue(" ", 55, DateTime.Now, 56, 14, false); EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(33, 40, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(73, 4, true); @@ -92,7 +92,7 @@ WriteTo(__razor_attribute_value_writer, string.Empty); EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(77, 71, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(148, 4, true); @@ -125,7 +125,7 @@ AddHtmlAttributeValue(" ", 210, DateTime.Now, 211, 14, false); EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(152, 83, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(235, 4, true); @@ -229,7 +229,7 @@ AddHtmlAttributeValue(" ", 404, int.MaxValue, 405, 14, false); EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(239, 183, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(422, 4, true); @@ -261,7 +261,7 @@ AddHtmlAttributeValue(" ", 488, int.MaxValue, 489, 14, false); EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(426, 80, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(506, 4, true); @@ -311,7 +311,7 @@ WriteTo(__razor_attribute_value_writer, string.Empty); EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(510, 64, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs index cb6cf9f8a7..1d6d26822a 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs @@ -47,7 +47,7 @@ __TestNamespace_InputTagHelper2.Checked = ; __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(38, 34, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(72, 6, true); @@ -76,7 +76,7 @@ __TestNamespace_InputTagHelper2.Checked = ; __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(98, 34, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(132, 6, true); @@ -93,8 +93,12 @@ __TestNamespace_PTagHelper.Age = ; #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(78, 64, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(142, 8, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs index 2d9cc358e7..3bf6639c14 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs @@ -52,7 +52,7 @@ __TestNamespace_InputTagHelper.Value = MyEnum.MyValue; __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(79, 33, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(112, 2, true); @@ -74,7 +74,7 @@ AddHtmlAttributeValue("", 128, MyEnum.MySecondValue, 128, 21, false); EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(114, 39, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(153, 2, true); @@ -95,7 +95,7 @@ __TestNamespace_InputTagHelper.Value = Microsoft.AspNet.Razor.Test.Generator.MyE __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(155, 25, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(180, 2, true); @@ -122,7 +122,7 @@ __TestNamespace_CatchAllTagHelper.CatchAll = Microsoft.AspNet.Razor.Test.Generat __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(182, 50, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(232, 2, true); @@ -149,7 +149,7 @@ __TestNamespace_CatchAllTagHelper.CatchAll = enumValue; __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(234, 51, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(285, 2, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs index 55b1e2fdde..6bc9d4bcc7 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs @@ -62,7 +62,7 @@ namespace TestOutput __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(184, 45, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(229, 18, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs index ee5afd5108..54f79bbc7c 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs @@ -34,7 +34,7 @@ namespace TestOutput __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(33, 10, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs index 6cceb534ea..163b126bb8 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs @@ -40,7 +40,7 @@ namespace TestOutput __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(96, 59, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(155, 6, true); @@ -60,7 +60,7 @@ namespace TestOutput __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(161, 119, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(280, 6, true); @@ -82,7 +82,7 @@ namespace TestOutput __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(286, 176, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(462, 6, true); @@ -103,7 +103,7 @@ namespace TestOutput __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(468, 206, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(674, 2, true); @@ -115,8 +115,12 @@ namespace TestOutput __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(33, 647, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs index 171ef1fb52..3907cfe076 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs @@ -77,7 +77,7 @@ namespace TestOutput __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(307, 86, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(393, 29, true); @@ -100,8 +100,12 @@ namespace TestOutput __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); __tagHelperExecutionContext.AddHtmlAttribute("data-delay", Html.Raw("1000")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(137, 433, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(570, 23, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs index c4dc7fdf5f..e7178d8cc8 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs @@ -69,7 +69,7 @@ __TestNamespace_InputTagHelper2.IntDictionaryProperty = intDictionary; __TestNamespace_InputTagHelper1.StringDictionaryProperty = __TestNamespace_InputTagHelper2.StringDictionaryProperty; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(329, 92, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(421, 6, true); @@ -114,7 +114,7 @@ __TestNamespace_InputTagHelper2.IntDictionaryProperty = intDictionary; __TestNamespace_InputTagHelper1.IntProperty = __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"]; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(427, 103, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(530, 6, true); @@ -186,7 +186,7 @@ __TestNamespace_InputTagHelper2.IntDictionaryProperty["salt"] = 37; __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"] = __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"]; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(536, 257, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(793, 6, true); @@ -227,7 +227,7 @@ __TestNamespace_InputTagHelper2.IntDictionaryProperty["value"] = 37; __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"] = __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"]; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(799, 60, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(859, 8, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs index a6b7ac9315..2173752712 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs @@ -69,7 +69,7 @@ __TestNamespace_InputTagHelper1.IntDictionaryProperty = intDictionary; __TestNamespace_InputTagHelper2.StringDictionaryProperty = __TestNamespace_InputTagHelper1.StringDictionaryProperty; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(329, 92, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(421, 6, true); @@ -114,7 +114,7 @@ __TestNamespace_InputTagHelper1.IntDictionaryProperty = intDictionary; __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"] = __TestNamespace_InputTagHelper1.IntProperty; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(427, 103, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(530, 6, true); @@ -186,7 +186,7 @@ __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"] = 37; __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"]; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(536, 257, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(793, 6, true); @@ -227,7 +227,7 @@ __TestNamespace_InputTagHelper1.IntDictionaryProperty["value"] = 37; __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"]; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(799, 60, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(859, 8, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs index 003714fa36..70a00020df 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs @@ -42,8 +42,12 @@ __TestNamespace_PTagHelper.Age = 1337; #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(33, 49, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs index 6e372510b7..0dbcdc4ec8 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs @@ -42,8 +42,12 @@ __TestNamespace_PTagHelper.Age = 1337; #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(33, 53, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs index a1031bd918..4e8f59c6f9 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs @@ -44,7 +44,7 @@ __TestNamespace_CatchAllTagHelper.ListItems = items; __tagHelperExecutionContext.AddHtmlAttribute("[item]", Html.Raw("items")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(276, 45, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(321, 2, true); @@ -65,7 +65,7 @@ __TestNamespace_CatchAllTagHelper.ArrayItems = items; __tagHelperExecutionContext.AddHtmlAttribute("[(item)]", Html.Raw("items")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(323, 49, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(372, 2, true); @@ -88,8 +88,12 @@ __TestNamespace_CatchAllTagHelper.Event1 = doSomething(); __tagHelperExecutionContext.AddTagHelperAttribute("(click)", __TestNamespace_CatchAllTagHelper.Event1); __tagHelperExecutionContext.AddHtmlAttribute("(click)", Html.Raw("doSomething()")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(374, 79, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(453, 2, true); @@ -112,8 +116,12 @@ __TestNamespace_CatchAllTagHelper.Event2 = doSomething(); __tagHelperExecutionContext.AddTagHelperAttribute("(^click)", __TestNamespace_CatchAllTagHelper.Event2); __tagHelperExecutionContext.AddHtmlAttribute("(^click)", Html.Raw("doSomething()")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(455, 81, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(536, 2, true); @@ -132,8 +140,12 @@ __TestNamespace_CatchAllTagHelper.Event2 = doSomething(); __tagHelperExecutionContext.AddTagHelperAttribute("*something", __TestNamespace_CatchAllTagHelper.StringProperty1); __tagHelperExecutionContext.AddHtmlAttribute("*something", Html.Raw("value")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(538, 67, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(605, 2, true); @@ -148,7 +160,7 @@ __TestNamespace_CatchAllTagHelper.Event2 = doSomething(); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("#localminimized"); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(607, 33, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(640, 2, true); @@ -165,7 +177,7 @@ __TestNamespace_CatchAllTagHelper.Event2 = doSomething(); __tagHelperExecutionContext.AddHtmlAttribute("#local", Html.Raw("value")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(642, 47, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs index f428452c76..189924185d 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs @@ -61,8 +61,12 @@ namespace TestOutput __TestNamespace_NestedTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_NestedTagHelper); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(267, 66, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(333, 10, true); @@ -92,8 +96,12 @@ AddHtmlAttributeValue(" ", 199, DateTime.Now, 200, 14, false); #line hidden EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(112, 245, false); - await WriteTagHelperToAsync(__razor_template_writer, __tagHelperExecutionContext); + WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(357, 14, true); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs index 747462c5cf..10cb8280d2 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs @@ -52,8 +52,12 @@ __TestNamespace_PTagHelper.Age = 1337; __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw(__tagHelperStringValueBuffer.GetContent(HtmlEncoder))); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(33, 85, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(118, 4, true); @@ -72,7 +76,7 @@ __TestNamespace_PTagHelper.Age = 1337; __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw("hello")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(122, 47, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(169, 4, true); @@ -92,7 +96,7 @@ __TestNamespace_PTagHelper.Age = 1234; __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw("hello2")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(173, 46, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(219, 4, true); @@ -111,7 +115,7 @@ __TestNamespace_PTagHelper.Age = 1234; __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw("blah")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(223, 51, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs index ea816ce355..3e0d6e9121 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs @@ -54,8 +54,12 @@ __TestNamespace_PTagHelper.Age = 1337; #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + __tagHelperExecutionContext.Output.Content = await __tagHelperExecutionContext.Output.GetChildContentAsync(); + } Instrumentation.BeginContext(97, 44, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(141, 2, true); @@ -81,7 +85,7 @@ __TestNamespace_PTagHelper.Age = 42; __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(143, 34, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(177, 2, true); @@ -101,7 +105,7 @@ __TestNamespace_PTagHelper.Age = 42 + @int; __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(179, 36, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(215, 2, true); @@ -121,7 +125,7 @@ __TestNamespace_PTagHelper.Age = int; __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(217, 31, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(248, 2, true); @@ -141,7 +145,7 @@ __TestNamespace_PTagHelper.Age = (@int); __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(250, 34, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(284, 2, true); @@ -168,7 +172,7 @@ __TestNamespace_PTagHelper.Age = 4 * @(@int + 2); __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(286, 54, false); - await WriteTagHelperAsync(__tagHelperExecutionContext); + Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(340, 2, true);