Skip to content

Commit 73d72b1

Browse files
authored
fix(Cascader): should display Empty after click Clearable button (#5128)
* feat: 清空按钮不应该使用 Items 第一个值 * test: 更新单元测试
1 parent 195deb5 commit 73d72b1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/BootstrapBlazor/Components/Cascader/Cascader.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private void SetDefaultValue(string defaultValue)
170170
}
171171
else
172172
{
173-
CurrentValueAsString = Items.FirstOrDefault()?.Value ?? string.Empty;
173+
CurrentValueAsString = string.Empty;
174174
}
175175
RefreshDisplayText();
176176
}

test/UnitTest/Components/CascaderTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void SetDefaultValue_Ok()
159159
pb.Add(a => a.Items, items);
160160
pb.Add(a => a.Value, "Test");
161161
});
162-
Assert.Equal("1", cut.Instance.Value);
162+
Assert.Equal("", cut.Instance.Value);
163163

164164
cut.SetParametersAndRender(pb =>
165165
{

0 commit comments

Comments
 (0)