Skip to content

Commit bd98e67

Browse files
committed
Revert "test: 更新单元测试"
This reverts commit 0634cc1.
1 parent 4244edd commit bd98e67

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/UnitTest/Components/DialogTest.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ await cut.InvokeAsync(() => dialog.Show(new DialogOption()
211211
};
212212
await cut.InvokeAsync(() => dialog.ShowEditDialog(editOption));
213213
// 点击关闭按钮
214+
button = cut.FindComponents<Button>().First(b => b.Instance.Text == "关闭");
215+
await cut.InvokeAsync(() => button.Instance.OnClickWithoutRender!.Invoke());
214216
await cut.InvokeAsync(() => modal.Instance.CloseCallback());
215217
Assert.True(closed);
216218

@@ -245,13 +247,15 @@ await cut.InvokeAsync(() => dialog.Show(new DialogOption()
245247
// edit dialog is tracking true
246248
editOption.IsTracking = true;
247249
await cut.InvokeAsync(() => dialog.ShowEditDialog(editOption));
248-
Assert.Empty(cut.FindAll(".bb-editor-footer .btn-secondary"));
250+
button = cut.FindComponents<Button>().FirstOrDefault(b => b.Instance.Text == "关闭");
251+
Assert.Null(button);
249252
await cut.InvokeAsync(() => modal.Instance.CloseCallback());
250253

251254
// edit dialog is tracking false
252255
editOption.IsTracking = false;
253256
await cut.InvokeAsync(() => dialog.ShowEditDialog(editOption));
254-
Assert.NotNull(cut.Find(".bb-editor-footer .btn-secondary"));
257+
button = cut.FindComponents<Button>().FirstOrDefault(b => b.Instance.Text == "关闭");
258+
Assert.NotNull(button);
255259
await cut.InvokeAsync(() => modal.Instance.CloseCallback());
256260

257261
// Edit Dialog FooterTemplate

0 commit comments

Comments
 (0)