Add tests for #773
This doesn't seem to repro anymore after fixing #772. Adding tests anyway.
This commit is contained in:
parent
3f5d25d314
commit
e1c2efb5ce
|
|
@ -407,6 +407,38 @@ Welcome to your new app.
|
|||
d => Assert.Equal("RZ1035", d.Id));
|
||||
}
|
||||
|
||||
[Fact] // https://github.com/aspnet/Blazor/issues/773
|
||||
public void Regression_773()
|
||||
{
|
||||
// Arrange
|
||||
AdditionalSyntaxTrees.Add(Parse(@"
|
||||
using Microsoft.AspNetCore.Blazor.Components;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class SurveyPrompt : BlazorComponent
|
||||
{
|
||||
[Parameter] private string Title { get; set; }
|
||||
}
|
||||
}
|
||||
"));
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
@page ""/""
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
|
||||
<SurveyPrompt Title=""<div>Test!</div>"" />
|
||||
");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BindToComponent_SpecifiesValue_WithMatchingProperties()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -657,6 +657,38 @@ Welcome to your new app.
|
|||
d => Assert.Equal("RZ1035", d.Id));
|
||||
}
|
||||
|
||||
[Fact] // https://github.com/aspnet/Blazor/issues/773
|
||||
public void Regression_773()
|
||||
{
|
||||
// Arrange
|
||||
AdditionalSyntaxTrees.Add(Parse(@"
|
||||
using Microsoft.AspNetCore.Blazor.Components;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class SurveyPrompt : BlazorComponent
|
||||
{
|
||||
[Parameter] private string Title { get; set; }
|
||||
}
|
||||
}
|
||||
"));
|
||||
|
||||
// Act
|
||||
var generated = CompileToCSharp(@"
|
||||
@page ""/""
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
|
||||
<SurveyPrompt Title=""<div>Test!</div>"" />
|
||||
");
|
||||
|
||||
// Assert
|
||||
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
|
||||
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BindToComponent_SpecifiesValue_WithMatchingProperties()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Blazor;
|
||||
using Microsoft.AspNetCore.Blazor.Components;
|
||||
[Microsoft.AspNetCore.Blazor.Components.RouteAttribute("/")]
|
||||
public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
|
||||
{
|
||||
#pragma warning disable 219
|
||||
private void __RazorDirectiveTokenHelpers__() {
|
||||
((System.Action)(() => {
|
||||
global::System.Object __typeHelper = "/";
|
||||
}
|
||||
))();
|
||||
}
|
||||
#pragma warning restore 219
|
||||
#pragma warning disable 0414
|
||||
private static System.Object __o = null;
|
||||
#pragma warning restore 0414
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
base.BuildRenderTree(builder);
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [12] ) - System
|
||||
UsingDirective - (18:2,1 [32] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [17] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [33] ) - Microsoft.AspNetCore.Blazor
|
||||
UsingDirective - (140:6,1 [44] ) - Microsoft.AspNetCore.Blazor.Components
|
||||
RouteAttributeExtensionNode - - /
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
|
||||
DesignTimeDirective -
|
||||
DirectiveToken - (14:0,14 [32] ) - "*, Microsoft.AspNetCore.Blazor"
|
||||
DirectiveToken - (14:0,14 [9] ) - "*, Test"
|
||||
DirectiveToken - (6:0,6 [3] x:\dir\subdir\Test\TestComponent.cshtml) - "/"
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning disable 0414
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - private static System.Object __o = null;
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - #pragma warning restore 0414
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
|
||||
HtmlContent - (11:1,0 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (11:1,0 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
HtmlElement - (13:2,0 [22] x:\dir\subdir\Test\TestComponent.cshtml) - h1
|
||||
HtmlContent - (17:2,4 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (17:2,4 [13] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello, world!
|
||||
HtmlContent - (35:2,22 [32] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (35:2,22 [32] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\nWelcome to your new app.\n\n
|
||||
HtmlElement - (67:6,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - surveyprompt
|
||||
HtmlAttribute - - -
|
||||
HtmlAttributeValue - -
|
||||
IntermediateToken - - Html - <div>Test!</div>
|
||||
HtmlContent - (108:6,41 [2] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (108:6,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Source Location: (6:0,6 [3] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
|"/"|
|
||||
Generated Location: (624:17,37 [3] )
|
||||
|"/"|
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
// <auto-generated/>
|
||||
#pragma warning disable 1591
|
||||
namespace Test
|
||||
{
|
||||
#line hidden
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Blazor;
|
||||
using Microsoft.AspNetCore.Blazor.Components;
|
||||
[Microsoft.AspNetCore.Blazor.Components.RouteAttribute("/")]
|
||||
public class TestComponent : Microsoft.AspNetCore.Blazor.Components.BlazorComponent
|
||||
{
|
||||
#pragma warning disable 1998
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Blazor.RenderTree.RenderTreeBuilder builder)
|
||||
{
|
||||
base.BuildRenderTree(builder);
|
||||
builder.OpenElement(0, "h1");
|
||||
builder.AddContent(1, "Hello, world!");
|
||||
builder.CloseElement();
|
||||
builder.AddContent(2, "\n\nWelcome to your new app.\n\n");
|
||||
builder.OpenElement(3, "surveyprompt");
|
||||
builder.AddAttribute(4, "title", "<div>Test!</div>");
|
||||
builder.CloseElement();
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
Document -
|
||||
NamespaceDeclaration - - Test
|
||||
UsingDirective - (3:1,1 [14] ) - System
|
||||
UsingDirective - (18:2,1 [34] ) - System.Collections.Generic
|
||||
UsingDirective - (53:3,1 [19] ) - System.Linq
|
||||
UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks
|
||||
UsingDirective - (104:5,1 [35] ) - Microsoft.AspNetCore.Blazor
|
||||
UsingDirective - (140:6,1 [46] ) - Microsoft.AspNetCore.Blazor.Components
|
||||
RouteAttributeExtensionNode - - /
|
||||
ClassDeclaration - - public - TestComponent - Microsoft.AspNetCore.Blazor.Components.BlazorComponent -
|
||||
MethodDeclaration - - protected override - void - BuildRenderTree
|
||||
CSharpCode -
|
||||
IntermediateToken - - CSharp - base.BuildRenderTree(builder);
|
||||
HtmlElement - (13:2,0 [22] x:\dir\subdir\Test\TestComponent.cshtml) - h1
|
||||
HtmlContent - (17:2,4 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (17:2,4 [13] x:\dir\subdir\Test\TestComponent.cshtml) - Html - Hello, world!
|
||||
HtmlContent - (35:2,22 [32] x:\dir\subdir\Test\TestComponent.cshtml)
|
||||
IntermediateToken - (35:2,22 [32] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\nWelcome to your new app.\n\n
|
||||
HtmlElement - (67:6,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - surveyprompt
|
||||
HtmlAttribute - - -
|
||||
HtmlAttributeValue - -
|
||||
IntermediateToken - - Html - <div>Test!</div>
|
||||
Loading…
Reference in New Issue