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.
De-dupe TagHelperDescriptors based on Type for rendering.
- This can occur if you have multiple [TargetElement] attributes that overlap. Ultimately the descriptor is the same because its the same type, just the required attributes differ. - Added tests to validate. #326
- Loading branch information
1 parent
fa40fe6
commit 842549b
Showing
4 changed files
with
138 additions
and
6 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
48 changes: 48 additions & 0 deletions
48
...Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/DuplicateTargetTagHelper.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,48 @@ | ||
#pragma checksum "DuplicateTargetTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9cd2f5a40be40d26a0756bf6a74cee58bd13927f" | ||
namespace TestOutput | ||
{ | ||
using Microsoft.AspNet.Razor.Runtime.TagHelpers; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
public class DuplicateTargetTagHelper | ||
{ | ||
#line hidden | ||
#pragma warning disable 0414 | ||
private TagHelperContent __tagHelperStringValueBuffer = null; | ||
#pragma warning restore 0414 | ||
private TagHelperExecutionContext __tagHelperExecutionContext = null; | ||
private TagHelperRunner __tagHelperRunner = null; | ||
private TagHelperScopeManager __tagHelperScopeManager = new TagHelperScopeManager(); | ||
private InputTagHelper __InputTagHelper = null; | ||
private CatchAllTagHelper __CatchAllTagHelper = null; | ||
#line hidden | ||
public DuplicateTargetTagHelper() | ||
{ | ||
} | ||
|
||
#pragma warning disable 1998 | ||
public override async Task ExecuteAsync() | ||
{ | ||
__tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(); | ||
Instrumentation.BeginContext(33, 2, true); | ||
WriteLiteral("\r\n"); | ||
Instrumentation.EndContext(); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => { | ||
} | ||
, StartTagHelperWritingScope, EndTagHelperWritingScope); | ||
__InputTagHelper = CreateTagHelper<InputTagHelper>(); | ||
__tagHelperExecutionContext.Add(__InputTagHelper); | ||
__InputTagHelper.Type = "checkbox"; | ||
__tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); | ||
__CatchAllTagHelper = CreateTagHelper<CatchAllTagHelper>(); | ||
__tagHelperExecutionContext.Add(__CatchAllTagHelper); | ||
__CatchAllTagHelper.Type = __InputTagHelper.Type; | ||
__tagHelperExecutionContext.AddHtmlAttribute("checked", "true"); | ||
__tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); | ||
await WriteTagHelperAsync(__tagHelperExecutionContext); | ||
__tagHelperExecutionContext = __tagHelperScopeManager.End(); | ||
} | ||
#pragma warning restore 1998 | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...osoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Source/DuplicateTargetTagHelper.cshtml
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,3 @@ | ||
@addTagHelper "something, nice" | ||
|
||
<input type="checkbox" checked="true" /> |