From 21d96eb16a2b838da0ab36988ab9c927e03fdefb Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 13 Aug 2015 10:47:51 -0700 Subject: [PATCH] Enabled `LinkTagHelper` to be written in the void format. - Updated existing tests to showcase it can be written as just the start tag. --- .../LinkTagHelper.cs | 18 +++++++++--------- ...bSite.HtmlGeneration_Home.Link.Encoded.html | 10 +++++----- ...rationWebSite.HtmlGeneration_Home.Link.html | 10 +++++----- .../Views/HtmlGeneration_Home/Link.cshtml | 14 +++++++------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs index 70dcd3f3fb..cf9069b3b2 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/LinkTagHelper.cs @@ -21,15 +21,15 @@ namespace Microsoft.AspNet.Mvc.TagHelpers /// /// The tag helper won't process for cases with just the 'href' attribute. /// - [TargetElement("link", Attributes = HrefIncludeAttributeName)] - [TargetElement("link", Attributes = HrefExcludeAttributeName)] - [TargetElement("link", Attributes = FallbackHrefAttributeName)] - [TargetElement("link", Attributes = FallbackHrefIncludeAttributeName)] - [TargetElement("link", Attributes = FallbackHrefExcludeAttributeName)] - [TargetElement("link", Attributes = FallbackTestClassAttributeName)] - [TargetElement("link", Attributes = FallbackTestPropertyAttributeName)] - [TargetElement("link", Attributes = FallbackTestValueAttributeName)] - [TargetElement("link", Attributes = AppendVersionAttributeName)] + [TargetElement("link", Attributes = HrefIncludeAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = HrefExcludeAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = FallbackHrefAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = FallbackHrefIncludeAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = FallbackHrefExcludeAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = FallbackTestClassAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = FallbackTestPropertyAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = FallbackTestValueAttributeName, TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("link", Attributes = AppendVersionAttributeName, TagStructure = TagStructure.WithoutEndTag)] public class LinkTagHelper : UrlResolutionTagHelper { private static readonly string Namespace = typeof(LinkTagHelper).Namespace; diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.Encoded.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.Encoded.html index 0e7bc812e8..401a11de37 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.Encoded.html +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.Encoded.html @@ -17,7 +17,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -119,7 +119,7 @@ - + @@ -128,6 +128,6 @@

Link Tag Helper Test

- + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.html index e42cbc29f4..15b5a344fe 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.html +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Link.html @@ -17,7 +17,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -119,7 +119,7 @@ - + @@ -128,6 +128,6 @@

Link Tag Helper Test

- + \ No newline at end of file diff --git a/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Link.cshtml b/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Link.cshtml index 150027ba5a..a9336cebb8 100644 --- a/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Link.cshtml +++ b/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Link.cshtml @@ -19,7 +19,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -58,7 +58,7 @@ asp-fallback-href="~/site.css" asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" - asp-fallback-test-value="hidden" /> + asp-fallback-test-value="hidden"> + asp-fallback-test-value="hidden"> + asp-fallback-test-value="hidden"> + asp-append-version="true"> @@ -205,6 +205,6 @@

Link Tag Helper Test

- + \ No newline at end of file