-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6956c2
commit 980ffdf
Showing
4 changed files
with
56 additions
and
15 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
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
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
34 changes: 34 additions & 0 deletions
34
tests/LinkDotNet.Blog.UnitTests/Web/Features/Components/UploadFileModalDialogTests.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,34 @@ | ||
using System.Threading.Tasks; | ||
using LinkDotNet.Blog.Web.Features.Components; | ||
|
||
namespace LinkDotNet.Blog.UnitTests.Web.Features.Components; | ||
|
||
public class UploadFileModalDialogTests : BunitContext | ||
{ | ||
[Fact] | ||
public async Task ShouldReturnFilenameAndSettingWhenSubmitting() | ||
{ | ||
var cut = Render<UploadFileModalDialog>(); | ||
var task = cut.InvokeAsync(() => cut.Instance.ShowAsync("Filename.png")); | ||
cut.Find("#cache").Change(false); | ||
|
||
await cut.Find("form").SubmitAsync(); | ||
|
||
var result = await task; | ||
result.ShouldNotBeNull(); | ||
result.Name.ShouldBe("Filename.png"); | ||
result.CacheMedia.ShouldBeFalse(); | ||
} | ||
|
||
[Fact] | ||
public async Task ShouldReturnNullWhenAborted() | ||
{ | ||
var cut = Render<UploadFileModalDialog>(); | ||
var task = cut.InvokeAsync(() => cut.Instance.ShowAsync("Filename.png")); | ||
|
||
cut.Find("#abort").Click(); | ||
|
||
var result = await task; | ||
result.ShouldBeNull(); | ||
} | ||
} |