Skip to content
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
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.9.2-beta01</Version>
<Version>9.9.2-beta03</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Dropdown/Dropdown.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
<div @attributes="@AdditionalAttributes" id="@Id" class="@DirectionClassName">
<DynamicElement TagName="button" type="button" class="@ButtonClassName" data-bs-toggle="@DropdownToggle" disabled="@Disabled"
TriggerClick="ShowSplit" OnClick="OnClickButton">
TriggerClick="ShowSplit" OnClick="OnClickButton" PreventDefault="false" StopPropagation="false">
@if (ButtonTemplate == null)
{
@if (_isAsyncLoading)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
{
case TableCellButton { IsShow: true } b:
<Button AdditionalAttributes="b.AdditionalAttributes" Size="b.Size"
Color="@b.Color" Icon="@b.Icon" Text="@b.Text" IsAsync="@b.IsAsync"
Color="@b.Color" Icon="@b.Icon" Text="@b.Text"
IsAsync="@b.IsAsync" IsKeepDisabled="b.IsKeepDisabled"
TooltipText="@b.TooltipText" TooltipPlacement="@b.TooltipPlacement"
TooltipTrigger="@b.TooltipTrigger" ChildContent="@b.ChildContent"
OnClickWithoutRender="() => OnClick(b)" IsDisabled="b.IsDisabled"></Button>
break;
case TableCellPopConfirmButton { IsShow: true } pb:
<PopConfirmButton AdditionalAttributes="pb.AdditionalAttributes"
Color="@pb.Color" Icon="@pb.Icon" Text="@pb.Text" IsAsync="@pb.IsAsync"
Color="@pb.Color" Icon="@pb.Icon" Text="@pb.Text"
IsAsync="@pb.IsAsync" IsKeepDisabled="pb.IsKeepDisabled"
Size="pb.Size" ShowShadow="@pb.ShowShadow" IsDisabled="@pb.IsDisabled"
IsBlock="@pb.IsBlock" IsOutline="@pb.IsOutline"
OnBeforeClick="@pb.OnBeforeClick" OnClose="@pb.OnClose" OnConfirm="() => OnClickConfirm(pb)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static async Task DownloadFolderAsync(this DownloadService download, stri
var destZipFile = $"{directoryName}.zip";
ZipFile.CreateFromDirectory(folder, destZipFile);

using var stream = new FileStream(destZipFile, FileMode.Open);
await using var stream = new FileStream(destZipFile, FileMode.Open);
await download.DownloadFromStreamAsync(new DownloadOption() { FileName = downloadFileName, FileStream = stream });
}

Expand Down
27 changes: 24 additions & 3 deletions test/UnitTest/Components/DownloadTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone

using Microsoft.JSInterop;

namespace UnitTest.Components;

public class DownloadTest : BootstrapBlazorTestBase
Expand Down Expand Up @@ -96,6 +94,18 @@ public async Task DownloadFromStreamAsync_Null()
});
var btn = cut.Find("button");
await Assert.ThrowsAsync<InvalidOperationException>(() => cut.InvokeAsync(() => btn.Click()));

var trigger = cut.FindComponent<Button>();
trigger.SetParametersAndRender(pb =>
{
pb.Add(a => a.OnClick, async () =>
{
var stream = new MemoryStream();
await downloadService.DownloadFromStreamAsync("", stream);
});
});
btn = cut.Find("button");
await Assert.ThrowsAsync<InvalidOperationException>(() => cut.InvokeAsync(() => btn.Click()));
}

[Fact]
Expand Down Expand Up @@ -131,7 +141,7 @@ public async Task DownloadFolderAsync_Ok()
{
File.Delete(zipFile);
}
using var fs = File.Create(fileName);
await using var fs = File.Create(fileName);
fs.Close();
btn = cut.Find("button");
await cut.InvokeAsync(() => btn.Click());
Expand Down Expand Up @@ -175,5 +185,16 @@ public async Task DownloadFromUrlAsync_Null()
});
var btn = cut.Find("button");
await Assert.ThrowsAsync<InvalidOperationException>(() => cut.InvokeAsync(() => btn.Click()));

var trigger = cut.FindComponent<Button>();
trigger.SetParametersAndRender(pb =>
{
pb.Add(a => a.OnClick, async () =>
{
await downloadService.DownloadFromUrlAsync("", "./favicon.png");
});
});
btn = cut.Find("button");
await Assert.ThrowsAsync<InvalidOperationException>(() => cut.InvokeAsync(() => btn.Click()));
}
}
Loading