This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix empty attribute projections for TagHelpers.
- Added TagHelperParseTreeRewriter tests, attempted to cover all empty attribute edge cases. - Added Codegen tests to validate output and DesignTimeLineMappings. #271
- Loading branch information
1 parent
efab52c
commit f97c6ee
Showing
6 changed files
with
337 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...spNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.DesignTime.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
namespace TestOutput | ||
{ | ||
using Microsoft.AspNet.Razor.Runtime.TagHelpers; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
public class EmptyAttributeTagHelpers | ||
{ | ||
private static object @__o; | ||
private void @__RazorDesignTimeHelpers__() | ||
{ | ||
#pragma warning disable 219 | ||
string __tagHelperDirectiveSyntaxHelper = null; | ||
__tagHelperDirectiveSyntaxHelper = | ||
#line 1 "EmptyAttributeTagHelpers.cshtml" | ||
"something" | ||
|
||
#line default | ||
#line hidden | ||
; | ||
#pragma warning restore 219 | ||
} | ||
#line hidden | ||
private InputTagHelper __InputTagHelper = null; | ||
private InputTagHelper2 __InputTagHelper2 = null; | ||
private PTagHelper __PTagHelper = null; | ||
#line hidden | ||
public EmptyAttributeTagHelpers() | ||
{ | ||
} | ||
|
||
#pragma warning disable 1998 | ||
public override async Task ExecuteAsync() | ||
{ | ||
__InputTagHelper = CreateTagHelper<InputTagHelper>(); | ||
__InputTagHelper.Type = ""; | ||
__InputTagHelper2 = CreateTagHelper<InputTagHelper2>(); | ||
__InputTagHelper2.Type = __InputTagHelper.Type; | ||
#line 4 "EmptyAttributeTagHelpers.cshtml" | ||
__InputTagHelper2.Checked = ; | ||
|
||
#line default | ||
#line hidden | ||
__InputTagHelper = CreateTagHelper<InputTagHelper>(); | ||
__InputTagHelper.Type = ""; | ||
__InputTagHelper2 = CreateTagHelper<InputTagHelper2>(); | ||
__InputTagHelper2.Type = __InputTagHelper.Type; | ||
#line 6 "EmptyAttributeTagHelpers.cshtml" | ||
__InputTagHelper2.Checked = ; | ||
|
||
#line default | ||
#line hidden | ||
__PTagHelper = CreateTagHelper<PTagHelper>(); | ||
#line 5 "EmptyAttributeTagHelpers.cshtml" | ||
__PTagHelper.Age = ; | ||
|
||
#line default | ||
#line hidden | ||
} | ||
#pragma warning restore 1998 | ||
} | ||
} |
141 changes: 141 additions & 0 deletions
141
...Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#pragma checksum "EmptyAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "828f744feb52d497814b7a018f817f31d92085ce" | ||
namespace TestOutput | ||
{ | ||
using Microsoft.AspNet.Razor.Runtime.TagHelpers; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
public class EmptyAttributeTagHelpers | ||
{ | ||
#line hidden | ||
#pragma warning disable 0414 | ||
private System.IO.TextWriter __tagHelperStringValueBuffer = null; | ||
#pragma warning restore 0414 | ||
private TagHelperExecutionContext __tagHelperExecutionContext = null; | ||
private TagHelperRunner __tagHelperRunner = new TagHelperRunner(); | ||
private TagHelperScopeManager __tagHelperScopeManager = new TagHelperScopeManager(); | ||
private InputTagHelper __InputTagHelper = null; | ||
private InputTagHelper2 __InputTagHelper2 = null; | ||
private PTagHelper __PTagHelper = null; | ||
#line hidden | ||
public EmptyAttributeTagHelpers() | ||
{ | ||
} | ||
|
||
#pragma warning disable 1998 | ||
public override async Task ExecuteAsync() | ||
{ | ||
Instrumentation.BeginContext(27, 13, true); | ||
WriteLiteral("\r\n<div>\r\n "); | ||
Instrumentation.EndContext(); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", "test", async() => { | ||
} | ||
, StartWritingScope, EndWritingScope); | ||
__InputTagHelper = CreateTagHelper<InputTagHelper>(); | ||
__tagHelperExecutionContext.Add(__InputTagHelper); | ||
__InputTagHelper.Type = ""; | ||
__tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); | ||
__InputTagHelper2 = CreateTagHelper<InputTagHelper2>(); | ||
__tagHelperExecutionContext.Add(__InputTagHelper2); | ||
__InputTagHelper2.Type = __InputTagHelper.Type; | ||
#line 4 "EmptyAttributeTagHelpers.cshtml" | ||
__InputTagHelper2.Checked = ; | ||
|
||
#line default | ||
#line hidden | ||
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked); | ||
__tagHelperExecutionContext.AddHtmlAttribute("class", ""); | ||
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag()); | ||
WriteLiteral(__tagHelperExecutionContext.Output.GeneratePreContent()); | ||
if (__tagHelperExecutionContext.Output.ContentSet) | ||
{ | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateContent()); | ||
} | ||
else if (__tagHelperExecutionContext.ChildContentRetrieved) | ||
{ | ||
WriteLiteral(__tagHelperExecutionContext.GetChildContentAsync().Result); | ||
} | ||
else | ||
{ | ||
__tagHelperExecutionContext.ExecuteChildContentAsync().Wait(); | ||
} | ||
WriteLiteral(__tagHelperExecutionContext.Output.GeneratePostContent()); | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag()); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.End(); | ||
Instrumentation.BeginContext(74, 6, true); | ||
WriteLiteral("\r\n "); | ||
Instrumentation.EndContext(); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", "test", async() => { | ||
WriteLiteral("\r\n "); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", "test", async() => { | ||
} | ||
, StartWritingScope, EndWritingScope); | ||
__InputTagHelper = CreateTagHelper<InputTagHelper>(); | ||
__tagHelperExecutionContext.Add(__InputTagHelper); | ||
__InputTagHelper.Type = ""; | ||
__tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); | ||
__InputTagHelper2 = CreateTagHelper<InputTagHelper2>(); | ||
__tagHelperExecutionContext.Add(__InputTagHelper2); | ||
__InputTagHelper2.Type = __InputTagHelper.Type; | ||
#line 6 "EmptyAttributeTagHelpers.cshtml" | ||
__InputTagHelper2.Checked = ; | ||
#line default | ||
#line hidden | ||
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked); | ||
__tagHelperExecutionContext.AddHtmlAttribute("class", ""); | ||
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag()); | ||
WriteLiteral(__tagHelperExecutionContext.Output.GeneratePreContent()); | ||
if (__tagHelperExecutionContext.Output.ContentSet) | ||
{ | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateContent()); | ||
} | ||
else if (__tagHelperExecutionContext.ChildContentRetrieved) | ||
{ | ||
WriteLiteral(__tagHelperExecutionContext.GetChildContentAsync().Result); | ||
} | ||
else | ||
{ | ||
__tagHelperExecutionContext.ExecuteChildContentAsync().Wait(); | ||
} | ||
WriteLiteral(__tagHelperExecutionContext.Output.GeneratePostContent()); | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag()); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.End(); | ||
WriteLiteral("\r\n "); | ||
} | ||
, StartWritingScope, EndWritingScope); | ||
__PTagHelper = CreateTagHelper<PTagHelper>(); | ||
__tagHelperExecutionContext.Add(__PTagHelper); | ||
#line 5 "EmptyAttributeTagHelpers.cshtml" | ||
__PTagHelper.Age = ; | ||
|
||
#line default | ||
#line hidden | ||
__tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age); | ||
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag()); | ||
WriteLiteral(__tagHelperExecutionContext.Output.GeneratePreContent()); | ||
if (__tagHelperExecutionContext.Output.ContentSet) | ||
{ | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateContent()); | ||
} | ||
else if (__tagHelperExecutionContext.ChildContentRetrieved) | ||
{ | ||
WriteLiteral(__tagHelperExecutionContext.GetChildContentAsync().Result); | ||
} | ||
else | ||
{ | ||
__tagHelperExecutionContext.ExecuteChildContentAsync().Wait(); | ||
} | ||
WriteLiteral(__tagHelperExecutionContext.Output.GeneratePostContent()); | ||
WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag()); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.End(); | ||
Instrumentation.BeginContext(144, 8, true); | ||
WriteLiteral("\r\n</div>"); | ||
Instrumentation.EndContext(); | ||
} | ||
#pragma warning restore 1998 | ||
} | ||
} |
Oops, something went wrong.