Fix #745 - allow multiple implements directives

The pass for this was 'break'ing after the first directive for no real
reason. Oops.
This commit is contained in:
Ryan Nowak 2018-05-08 13:36:49 -07:00 committed by Ryan Nowak
parent e1c2efb5ce
commit 3142217bec
2 changed files with 21 additions and 1 deletions

View File

@ -30,7 +30,6 @@ namespace Microsoft.AspNetCore.Blazor.Razor
if (token != null)
{
@class.Interfaces.Add(token.Content);
break;
}
}
}

View File

@ -58,6 +58,25 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
frame => AssertFrame.Text(frame, "Hello"));
}
[Fact]
public void SupportsMultipleImplementsDeclarations()
{
// Arrange/Act
var testInterfaceTypeName = FullTypeName<ITestInterface>();
var testInterfaceTypeName2 = FullTypeName<ITestInterface2>();
var component = CompileToComponent(
$"@implements {testInterfaceTypeName}\n" +
$"@implements {testInterfaceTypeName2}\n" +
$"Hello");
var frames = GetRenderTree(component);
// Assert
Assert.IsAssignableFrom<ITestInterface>(component);
Assert.IsAssignableFrom<ITestInterface2>(component);
Assert.Collection(frames,
frame => AssertFrame.Text(frame, "Hello"));
}
[Fact]
public void SupportsInheritsDirective()
{
@ -135,6 +154,8 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test
public interface ITestInterface { }
public interface ITestInterface2 { }
public class TestBaseClass : BlazorComponent { }
public interface IMyService1 { }