Skip to content

Experience for Razor SDK #8731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion eng/ProjectReferences.props
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor" ProjectPath="$(RepositoryRoot)src\Components\Blazor\Blazor\src\Microsoft.AspNetCore.Blazor.csproj" RefProjectPath="$(RepositoryRoot)src\Components\Blazor\Blazor\ref\Microsoft.AspNetCore.Blazor.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor.Server" ProjectPath="$(RepositoryRoot)src\Components\Blazor\Server\src\Microsoft.AspNetCore.Blazor.Server.csproj" RefProjectPath="$(RepositoryRoot)src\Components\Blazor\Server\ref\Microsoft.AspNetCore.Blazor.Server.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Components.Browser" ProjectPath="$(RepositoryRoot)src\Components\Browser\src\Microsoft.AspNetCore.Components.Browser.csproj" RefProjectPath="$(RepositoryRoot)src\Components\Browser\ref\Microsoft.AspNetCore.Components.Browser.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Components.Build" ProjectPath="$(RepositoryRoot)src\Components\Build\src\Microsoft.AspNetCore.Components.Build.csproj" RefProjectPath="$(RepositoryRoot)src\Components\Build\ref\Microsoft.AspNetCore.Components.Build.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Components" ProjectPath="$(RepositoryRoot)src\Components\Components\src\Microsoft.AspNetCore.Components.csproj" RefProjectPath="$(RepositoryRoot)src\Components\Components\ref\Microsoft.AspNetCore.Components.csproj" />
</ItemGroup>
</Project>
372 changes: 186 additions & 186 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

186 changes: 93 additions & 93 deletions eng/Versions.props

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsShippingPackage>true</IsShippingPackage>
<ProvideApplicationPartFactoryAttributeTypeName>Microsoft.AspNetCore.Mvc.ApplicationParts.NullApplicationPartFactory, Microsoft.AspNetCore.Mvc.Core</ProvideApplicationPartFactoryAttributeTypeName>

<_EnableAllInclusiveRazorSdk>true</_EnableAllInclusiveRazorSdk>
<RazorLangVersion>3.0</RazorLangVersion>
<RazorDefaultConfiguration>MVC-3.0</RazorDefaultConfiguration>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsShippingPackage>true</IsShippingPackage>
<ProvideApplicationPartFactoryAttributeTypeName>Microsoft.AspNetCore.Mvc.ApplicationParts.NullApplicationPartFactory, Microsoft.AspNetCore.Mvc.Core</ProvideApplicationPartFactoryAttributeTypeName>

<_EnableAllInclusiveRazorSdk>true</_EnableAllInclusiveRazorSdk>
<RazorLangVersion>3.0</RazorLangVersion>
<RazorDefaultConfiguration>MVC-3.0</RazorDefaultConfiguration>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<RazorCompileOnBuild>true</RazorCompileOnBuild>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<repository type="git" url="https://github.com/aspnet/aspnetcore" commit="$repositorycommit$" />
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<dependencies>
<dependency id="Microsoft.AspNetCore.Components.Build" version="$componentsversion$" include="all" />
<dependency id="Microsoft.AspNetCore.Blazor.Mono" version="$blazormonoversion$" include="all" />
</dependencies>
</metadata>
Expand Down
2 changes: 0 additions & 2 deletions src/Components/Blazor/Build/src/ReferenceFromSource.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
This is only intended for use by other projects in this repo.
-->

<Import Project="$(RepositoryRoot)src\Components\Build\src\ReferenceFromSource.props" />

<PropertyGroup>
<BlazorBuildReferenceFromSource>true</BlazorBuildReferenceFromSource>
<BlazorJsPath>$(RepositoryRoot)src\Components\Browser.JS\src\dist\components.*.js</BlazorJsPath>
Expand Down
25 changes: 3 additions & 22 deletions src/Components/Blazor/Build/test/BindRazorIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class MyComponent : ComponentBase
}"));

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<MyComponent bind-Value=""ParentValue"" />
@functions {
public int ParentValue { get; set; } = 42;
Expand Down Expand Up @@ -77,7 +76,6 @@ Task IComponent.SetParametersAsync(ParameterCollection parameters)
}"));

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<MyComponent bind-Value=""ParentValue"" />
@functions {
public int ParentValue { get; set; } = 42;
Expand Down Expand Up @@ -115,7 +113,6 @@ public class MyComponent : ComponentBase
}"));

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<MyComponent bind-Value-OnChanged=""ParentValue"" />
@functions {
public int ParentValue { get; set; } = 42;
Expand Down Expand Up @@ -153,7 +150,6 @@ Task IComponent.SetParametersAsync(ParameterCollection parameters)
}"));

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<MyComponent bind-Value-OnChanged=""ParentValue"" />
@functions {
public int ParentValue { get; set; } = 42;
Expand Down Expand Up @@ -187,7 +183,6 @@ public static class BindAttributes
}"));

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<div bind=""@ParentValue"" />
@functions {
public string ParentValue { get; set; } = ""hi"";
Expand Down Expand Up @@ -221,7 +216,6 @@ public static class BindAttributes
}"));

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<div bind-value=""@ParentValue"" />
@functions {
public string ParentValue { get; set; } = ""hi"";
Expand Down Expand Up @@ -257,15 +251,14 @@ public static class BindAttributes

// Act
var result = CompileToCSharp(@"
@addTagHelper *, TestAssembly
<div bind-value=""@ParentValue"" />
@functions {
public string ParentValue { get; set; } = ""hi"";
}");

// Assert
var diagnostic = Assert.Single(result.Diagnostics);
Assert.Equal("BL9989", diagnostic.Id);
Assert.Equal("RZ9989", diagnostic.Id);
Assert.Equal(
"The attribute 'bind-value' was matched by multiple bind attributes. Duplicates:" + Environment.NewLine +
"Test.BindAttributes" + Environment.NewLine +
Expand All @@ -278,7 +271,6 @@ public void Render_BuiltIn_BindToInputWithoutType_WritesAttributes()
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input bind=""@ParentValue"" />
@functions {
public int ParentValue { get; set; } = 42;
Expand All @@ -300,7 +292,6 @@ public void Render_BuiltIn_BindToInputText_WithFormat_WritesAttributes()
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input type=""text"" bind=""@CurrentDate"" format-value=""MM/dd/yyyy""/>
@functions {
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
Expand All @@ -323,7 +314,6 @@ public void Render_BuiltIn_BindToInputText_WithFormatFromProperty_WritesAttribut
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input type=""text"" bind=""@CurrentDate"" format-value=""@Format""/>
@functions {
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
Expand All @@ -348,7 +338,6 @@ public void Render_BuiltIn_BindToInputText_WritesAttributes()
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input type=""text"" bind=""@ParentValue"" />
@functions {
public int ParentValue { get; set; } = 42;
Expand All @@ -371,7 +360,6 @@ public void Render_BuiltIn_BindToInputCheckbox_WritesAttributes()
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input type=""checkbox"" bind=""@Enabled"" />
@functions {
public bool Enabled { get; set; }
Expand All @@ -393,7 +381,6 @@ public void Render_BindToElementFallback_WritesAttributes()
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input type=""text"" bind-value-onchange=""@ParentValue"" />
@functions {
public int ParentValue { get; set; } = 42;
Expand All @@ -416,7 +403,6 @@ public void Render_BindToElementFallback_WithFormat_WritesAttributes()
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input type=""text"" bind-value-onchange=""@CurrentDate"" format-value=""MM/dd"" />
@functions {
public DateTime CurrentDate { get; set; } = new DateTime(2018, 1, 1);
Expand All @@ -439,7 +425,6 @@ public void Render_BindToElementFallback_SpecifiesValueAndChangeEvent_WithCSharp
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input type=""@(""text"")"" bind-value-onchange=""@ParentValue"" visible />
@functions {
public int ParentValue { get; set; } = 42;
Expand All @@ -463,7 +448,6 @@ public void Workaround_703()
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<input bind-value-onchange=""@ParentValue"" type=""text"" visible />
@functions {
public int ParentValue { get; set; } = 42;
Expand All @@ -490,7 +474,6 @@ public void Render_BindToElementFallback_SpecifiesValueAndChangeEvent_BodyConten
{
// Arrange
var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<div bind-value-onchange=""@ParentValue"">
<span>@(42.ToString())</span>
</div>
Expand Down Expand Up @@ -518,31 +501,29 @@ public void Render_BindFallback_InvalidSyntax_TooManyParts()
{
// Arrange & Act
var generated = CompileToCSharp(@"
@addTagHelper *, TestAssembly
<input type=""text"" bind-first-second-third=""Text"" />
@functions {
public string Text { get; set; } = ""text"";
}");

// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Equal("BL9991", diagnostic.Id);
Assert.Equal("RZ9991", diagnostic.Id);
}

[Fact]
public void Render_BindFallback_InvalidSyntax_TrailingDash()
{
// Arrange & Act
var generated = CompileToCSharp(@"
@addTagHelper *, TestAssembly
<input type=""text"" bind-first-=""Text"" />
@functions {
public string Text { get; set; } = ""text"";
}");

// Assert
var diagnostic = Assert.Single(generated.Diagnostics);
Assert.Equal("BL9991", diagnostic.Id);
Assert.Equal("RZ9991", diagnostic.Id);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public void Render_BodyChildContent()
AdditionalSyntaxTrees.Add(RenderChildContentComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<RenderChildContent>
<div></div>
</RenderChildContent>");
Expand All @@ -120,7 +119,6 @@ public void Render_BodyChildContent_Generic()
AdditionalSyntaxTrees.Add(RenderChildContentStringComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<RenderChildContentString Value=""HI"">
<div>@context.ToLowerInvariant()</div>
</RenderChildContentString>");
Expand All @@ -147,7 +145,6 @@ public void Render_ExplicitChildContent()
AdditionalSyntaxTrees.Add(RenderChildContentComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<RenderChildContent>
<ChildContent>
<div></div>
Expand All @@ -172,7 +169,7 @@ public void Render_BodyChildContent_Recursive()
AdditionalSyntaxTrees.Add(RenderChildContentComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly

<RenderChildContent>
<RenderChildContent>
<div></div>
Expand Down Expand Up @@ -201,7 +198,6 @@ public void Render_AttributeChildContent()
AdditionalSyntaxTrees.Add(RenderChildContentComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
@{ RenderFragment<string> template = (context) => @<div>@context.ToLowerInvariant()</div>; }
<RenderChildContent ChildContent=""@template(""HI"")"" />");

Expand All @@ -224,7 +220,6 @@ public void Render_AttributeChildContent_RenderFragmentOfString()
AdditionalSyntaxTrees.Add(RenderChildContentStringComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
@{ RenderFragment<string> template = (context) => @<div>@context.ToLowerInvariant()</div>; }
<RenderChildContentString ChildContent=""@template"" Value=""HI"" />");

Expand All @@ -248,7 +243,6 @@ public void Render_AttributeChildContent_NoArgTemplate()
AdditionalSyntaxTrees.Add(RenderChildContentComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
@{ RenderFragment template = @<div>@(""HI"".ToLowerInvariant())</div>; }
<RenderChildContent ChildContent=""@template"" />");

Expand All @@ -271,7 +265,6 @@ public void Render_AttributeChildContent_IgnoresEmptyBody()
AdditionalSyntaxTrees.Add(RenderChildContentComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
@{ RenderFragment<string> template = (context) => @<div>@context.ToLowerInvariant()</div>; }
<RenderChildContent ChildContent=""@template(""HI"")""></RenderChildContent>");

Expand All @@ -294,7 +287,6 @@ public void Render_AttributeChildContent_IgnoresWhitespaceBody()
AdditionalSyntaxTrees.Add(RenderChildContentComponent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
@{ RenderFragment<string> template = (context) => @<div>@context.ToLowerInvariant()</div>; }
<RenderChildContent ChildContent=""@template(""HI"")"">

Expand All @@ -319,7 +311,6 @@ public void Render_MultipleChildContent()
AdditionalSyntaxTrees.Add(RenderMultipleChildContent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
@{ RenderFragment<string> header = context => @<div>@context.ToLowerInvariant()</div>; }
<RenderMultipleChildContent Name=""billg"" Header=@header Value=""HI"">
<ChildContent>Some @context.ToLowerInvariant() Content</ChildContent>
Expand Down Expand Up @@ -353,7 +344,6 @@ public void Render_MultipleChildContent_ContextParameterOnComponent()
AdditionalSyntaxTrees.Add(RenderMultipleChildContent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly
<RenderMultipleChildContent Name=""billg"" Value=""HI"" Context=""item"">
<Header><div>@item.ToLowerInvariant()</div></Header>
<ChildContent Context=""Context"">Some @Context.ToLowerInvariant() Content</ChildContent>
Expand Down Expand Up @@ -388,7 +378,7 @@ public void Render_MultipleChildContent_ContextParameterOnComponent_SetsSameName
AdditionalSyntaxTrees.Add(RenderMultipleChildContent);

var component = CompileToComponent(@"
@addTagHelper *, TestAssembly

<RenderMultipleChildContent Name=""billg"" Value=""HI"" Context=""item"">
<Header><div>@item.ToLowerInvariant()</div></Header>
<ChildContent Context=""item"">Some @item.ToLowerInvariant() Content</ChildContent>
Expand Down
Loading