Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Add HeadTagHelper and BodyTagHelper
Browse files Browse the repository at this point in the history
Addresses aspnet/Mvc#5728
  • Loading branch information
jbagga authored Mar 29, 2017
1 parent e7f5638 commit 582ffe2
Show file tree
Hide file tree
Showing 18 changed files with 96 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ private static RazorSourceDocument GetDefaultImports()
writer.WriteLine("@inject global::Microsoft.AspNetCore.Mvc.IUrlHelper Url");
writer.WriteLine("@inject global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider");
writer.WriteLine("@addTagHelper Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor");
writer.WriteLine("@addTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor");
writer.WriteLine("@addTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor");
writer.Flush();

stream.Position = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public void GetDefaultImports_IncludesUrlTagHelper()
var importContent = GetContent(imports)
.Split(new[] { Environment.NewLine }, StringSplitOptions.None)
.Where(line => line.StartsWith("@addTagHelper"));
var addTagHelper = Assert.Single(importContent);
Assert.Equal("@addTagHelper Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor",
addTagHelper);
Assert.Contains("@addTagHelper Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor", importContent);
Assert.Contains("@addTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor", importContent);
Assert.Contains("@addTagHelper Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor", importContent);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ private void __RazorDirectiveTokenHelpers__() {
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source Location: (13:0,13 [4] /TestFiles/Input/Basic.cshtml)
|logo|
Generated Location: (2370:86,13 [4] )
Generated Location: (2732:94,13 [4] )
|logo|

Source Location: (43:2,5 [21] /TestFiles/Input/Basic.cshtml)
|Html.Input("SomeKey")|
Generated Location: (2455:91,6 [21] )
Generated Location: (2817:99,6 [21] )
|Html.Input("SomeKey")|

Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ private void __RazorDirectiveTokenHelpers__() {
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
MyApp __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source Location: (28:1,8 [5] /TestFiles/Input/Inject.cshtml)
|MyApp|
Generated Location: (2215:85,0 [5] )
Generated Location: (2577:93,0 [5] )
|MyApp|

Source Location: (34:1,14 [14] /TestFiles/Input/Inject.cshtml)
|MyPropertyName|
Generated Location: (2317:89,14 [14] )
Generated Location: (2679:97,14 [14] )
|MyPropertyName|

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ private void __RazorDirectiveTokenHelpers__() {
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
MyModel __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
Source Location: (7:0,7 [7] /TestFiles/Input/InjectWithModel.cshtml)
|MyModel|
Generated Location: (2117:80,0 [7] )
Generated Location: (2479:88,0 [7] )
|MyModel|

Source Location: (24:1,8 [5] /TestFiles/Input/InjectWithModel.cshtml)
|MyApp|
Generated Location: (2207:84,0 [5] )
Generated Location: (2569:92,0 [5] )
|MyApp|

Source Location: (30:1,14 [14] /TestFiles/Input/InjectWithModel.cshtml)
|MyPropertyName|
Generated Location: (2309:88,14 [14] )
Generated Location: (2671:96,14 [14] )
|MyPropertyName|

Source Location: (54:2,8 [17] /TestFiles/Input/InjectWithModel.cshtml)
|MyService<TModel>|
Generated Location: (2393:92,0 [17] )
Generated Location: (2755:100,0 [17] )
|MyService<TModel>|

Source Location: (72:2,26 [4] /TestFiles/Input/InjectWithModel.cshtml)
|Html|
Generated Location: (2507:96,14 [4] )
Generated Location: (2869:104,14 [4] )
|Html|

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ private void __RazorDirectiveTokenHelpers__() {
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
MyModel __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
Source Location: (7:0,7 [7] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyModel|
Generated Location: (2121:80,0 [7] )
Generated Location: (2483:88,0 [7] )
|MyModel|

Source Location: (24:1,8 [5] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyApp|
Generated Location: (2211:84,0 [5] )
Generated Location: (2573:92,0 [5] )
|MyApp|

Source Location: (30:1,14 [14] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyPropertyName|
Generated Location: (2313:88,14 [14] )
Generated Location: (2675:96,14 [14] )
|MyPropertyName|

Source Location: (58:2,8 [17] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyService<TModel>|
Generated Location: (2397:92,0 [17] )
Generated Location: (2759:100,0 [17] )
|MyService<TModel>|

Source Location: (76:2,26 [4] /TestFiles/Input/InjectWithSemicolon.cshtml)
|Html|
Generated Location: (2511:96,14 [4] )
Generated Location: (2873:104,14 [4] )
|Html|

Source Location: (93:3,8 [5] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyApp|
Generated Location: (2585:100,0 [5] )
Generated Location: (2947:108,0 [5] )
|MyApp|

Source Location: (99:3,14 [15] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyPropertyName2|
Generated Location: (2687:104,14 [15] )
Generated Location: (3049:112,14 [15] )
|MyPropertyName2|

Source Location: (129:4,8 [17] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyService<TModel>|
Generated Location: (2772:108,0 [17] )
Generated Location: (3134:116,0 [17] )
|MyService<TModel>|

Source Location: (147:4,26 [5] /TestFiles/Input/InjectWithSemicolon.cshtml)
|Html2|
Generated Location: (2886:112,14 [5] )
Generated Location: (3248:120,14 [5] )
|Html2|

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ private void __RazorDirectiveTokenHelpers__() {
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Collections.IEnumerable __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source Location: (7:0,7 [30] /TestFiles/Input/Model.cshtml)
|System.Collections.IEnumerable|
Generated Location: (2153:80,0 [30] )
Generated Location: (2515:88,0 [30] )
|System.Collections.IEnumerable|

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ private void __RazorDirectiveTokenHelpers__() {
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
DateTime __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Source Location: (7:0,7 [8] /TestFiles/Input/ModelExpressionTagHelper.cshtml)
|DateTime|
Generated Location: (2128:80,0 [8] )
Generated Location: (2490:88,0 [8] )
|DateTime|

Source Location: (33:2,14 [108] /TestFiles/Input/ModelExpressionTagHelper.cshtml)
|Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper, Microsoft.AspNetCore.Mvc.Razor.Extensions.Test|
Generated Location: (2249:84,30 [108] )
Generated Location: (2611:92,30 [108] )
|Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper, Microsoft.AspNetCore.Mvc.Razor.Extensions.Test|

Source Location: (162:4,17 [3] /TestFiles/Input/ModelExpressionTagHelper.cshtml)
|Now|
Generated Location: (3144:96,144 [3] )
Generated Location: (3506:104,144 [3] )
|Now|

Source Location: (189:5,18 [5] /TestFiles/Input/ModelExpressionTagHelper.cshtml)
|Model|
Generated Location: (3545:102,136 [5] )
Generated Location: (3907:110,136 [5] )
|Model|

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ private void __RazorDirectiveTokenHelpers__() {
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
ThisShouldBeGenerated __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source Location: (7:0,7 [21] /TestFiles/Input/MultipleModels.cshtml)
|ThisShouldBeGenerated|
Generated Location: (2162:80,0 [21] )
Generated Location: (2524:88,0 [21] )
|ThisShouldBeGenerated|

Source Location: (37:1,7 [30] /TestFiles/Input/MultipleModels.cshtml)
|System.Collections.IEnumerable|
Generated Location: (2266:84,0 [30] )
Generated Location: (2628:92,0 [30] )
|System.Collections.IEnumerable|

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ private void __RazorDirectiveTokenHelpers__() {
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
IHtmlHelper<TModel> __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source Location: (8:0,8 [19] /TestFiles/Input/_ViewImports.cshtml)
|IHtmlHelper<TModel>|
Generated Location: (2128:80,0 [19] )
Generated Location: (2490:88,0 [19] )
|IHtmlHelper<TModel>|

Source Location: (28:0,28 [5] /TestFiles/Input/_ViewImports.cshtml)
|Model|
Generated Location: (2244:84,14 [5] )
Generated Location: (2606:92,14 [5] )
|Model|

0 comments on commit 582ffe2

Please sign in to comment.