diff --git a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 6acb3d4bf4d3..49d5f463f7c2 100644 --- a/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Razor/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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.Linq; @@ -525,6 +525,90 @@ public void RazorPageWithNoLeadingPageDirective_Runtime() var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics; Assert.Equal("RZ3906", Assert.Single(diagnotics).Id); } + + [Fact] + public void RazorPage_WithCssScope() + { + // Arrange + AddCSharpSyntaxTree($@" +[{typeof(HtmlTargetElementAttribute).FullName}({"\"all\""})] +public class AllTagHelper : {typeof(TagHelper).FullName} +{{ + public string Bar {{ get; set; }} +}} + +[{typeof(HtmlTargetElementAttribute).FullName}({"\"form\""})] +public class FormTagHelper : {typeof(TagHelper).FullName} +{{ +}} +"); + + // Act + // This test case attempts to use all syntaxes that might interact with auto-generated attributes + var generated = CompileToCSharp(@"@page +@addTagHelper *, AppCode +@{ + ViewData[""Title""] = ""Home page""; +} +
Learn about building Web apps with ASP.NET Core.
+Learn about building Web apps with ASP.NET Core.
+Learn about building Web apps with ASP.NET Core.
\r\n+ LazyIntermediateToken - (152:7,7 [11] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - Learn about + LazyIntermediateToken - (163:7,18 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + LazyIntermediateToken - (214:7,69 [36] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - building Web apps with ASP.NET Core + LazyIntermediateToken - (250:7,105 [4] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + LazyIntermediateToken - (254:7,109 [1] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - . + LazyIntermediateToken - (255:7,110 [4] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -
+ LazyIntermediateToken - (259:7,114 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + LazyIntermediateToken - (261:8,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -Learn about building Web apps with ASP.NET Core.
\r\n+ LazyIntermediateToken - (145:6,7 [11] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - Learn about + LazyIntermediateToken - (156:6,18 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + LazyIntermediateToken - (207:6,69 [36] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - building Web apps with ASP.NET Core + LazyIntermediateToken - (243:6,105 [4] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + LazyIntermediateToken - (247:6,109 [1] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - . + LazyIntermediateToken - (248:6,110 [4] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -
+ LazyIntermediateToken - (252:6,114 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + LazyIntermediateToken - (254:7,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -