In RazorCompiler, allow HTML comments
This commit is contained in:
parent
fd5875c5e7
commit
78a19c07e9
|
|
@ -1,2 +1,8 @@
|
||||||
@using Microsoft.AspNetCore.Blazor.Browser.Routing
|
@using Microsoft.AspNetCore.Blazor.Browser.Routing
|
||||||
<c:BrowserRouter AppAssembly=@(typeof(StandaloneApp.Program).Assembly) PagesNamespace=@("StandaloneApp.Pages") />
|
<!--
|
||||||
|
Configuring this stuff here is temporary. Later we'll move the app config
|
||||||
|
into Program.cs, and it won't be necessary to specify AppAssembly.
|
||||||
|
-->
|
||||||
|
<c:BrowserRouter
|
||||||
|
AppAssembly=@(typeof(StandaloneApp.Program).Assembly)
|
||||||
|
PagesNamespace=@("StandaloneApp.Pages") />
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,9 @@ namespace Microsoft.AspNetCore.Blazor.Razor
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case HtmlTokenType.Comment:
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new InvalidCastException($"Unsupported token type: {nextToken.Type.ToString()}");
|
throw new InvalidCastException($"Unsupported token type: {nextToken.Type.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,19 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
|
||||||
frame => AssertFrame.Element(frame, "img", 1, 1));
|
frame => AssertFrame.Element(frame, "img", 1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void SupportsComments()
|
||||||
|
{
|
||||||
|
// Arrange/Act
|
||||||
|
var component = CompileToComponent("Start<!-- My comment -->End");
|
||||||
|
var frames = GetRenderTree(component);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Collection(frames,
|
||||||
|
frame => AssertFrame.Text(frame, "Start", 0),
|
||||||
|
frame => AssertFrame.Text(frame, "End", 1));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void SupportsAttributesWithLiteralValues()
|
public void SupportsAttributesWithLiteralValues()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue