forked from Blazor-Diagrams/Blazor.Diagrams
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WI00697921-NCN-Removing_last_node_from_Workflow_Relationship_Designer…
…_throws_exception (#31) WI00697921 - NCN - Removing the last node from Workflow Relationship Designer throws an exception
- Loading branch information
Showing
2 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tests/Blazor.Diagrams.Tests/Components/DiagramCanvasTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Blazor.Diagrams.Components; | ||
using Blazor.Diagrams.Core.Geometry; | ||
using Bunit; | ||
using Xunit; | ||
|
||
namespace Blazor.Diagrams.Tests.Components | ||
{ | ||
public class DiagramCanvasTests | ||
{ | ||
[Fact] | ||
public void Behavior_WhenDisposing_ShouldUnsubscribeToResizes() | ||
{ | ||
// Arrange | ||
JSRuntimeInvocationHandler call; | ||
using (var ctx = new TestContext()) | ||
{ | ||
ctx.JSInterop.Setup<Rectangle>("ZBlazorDiagrams.getBoundingClientRect", _ => true); | ||
call = ctx.JSInterop.SetupVoid("ZBlazorDiagrams.unobserve", _ => true).SetVoidResult(); | ||
|
||
// Act | ||
var cut = ctx.RenderComponent<DiagramCanvas>(p => p.Add(n => n.BlazorDiagram, new BlazorDiagram())); | ||
} | ||
|
||
// Assert | ||
call.VerifyInvoke("ZBlazorDiagrams.unobserve", calledTimes: 1); | ||
} | ||
} | ||
} |