|
2 | 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
3 | 3 | // Website: https://www.blazor.zone or https://argozhang.github.io/ |
4 | 4 |
|
| 5 | +using AngleSharp.Dom; |
5 | 6 | using BootstrapBlazor.Shared; |
6 | 7 | using Microsoft.Extensions.DependencyInjection; |
7 | 8 | using Microsoft.Extensions.Localization; |
@@ -59,10 +60,11 @@ public async Task EditAsync_Ok() |
59 | 60 | // 编辑弹窗逻辑 |
60 | 61 | var form = cut.Find(".modal-body form"); |
61 | 62 | await cut.InvokeAsync(() => form.Submit()); |
| 63 | + var modal = cut.FindComponent<Modal>(); |
| 64 | + await cut.InvokeAsync(() => modal.Instance.CloseCallback()); |
62 | 65 |
|
63 | 66 | // 内置数据服务取消回调 |
64 | 67 | await cut.InvokeAsync(() => table.Instance.EditAsync()); |
65 | | - var modal = cut.FindComponent<Modal>(); |
66 | 68 | await cut.InvokeAsync(() => modal.Instance.CloseCallback()); |
67 | 69 |
|
68 | 70 | // 自定义数据服务取消回调测试 |
@@ -99,6 +101,39 @@ public async Task EditAsync_Ok() |
99 | 101 | await cut.InvokeAsync(() => table.Instance.AddAsync()); |
100 | 102 | await cut.InvokeAsync(() => modal.Instance.CloseCallback()); |
101 | 103 | Assert.True(closed); |
| 104 | + |
| 105 | + // IsTracking mode |
| 106 | + table.SetParametersAndRender(pb => |
| 107 | + { |
| 108 | + pb.Add(a => a.IsTracking, true); |
| 109 | + }); |
| 110 | + // Add 弹窗 |
| 111 | + await cut.InvokeAsync(() => table.Instance.AddAsync()); |
| 112 | + |
| 113 | + // 编辑弹窗逻辑 |
| 114 | + input = cut.Find(".modal-body form input.form-control"); |
| 115 | + await cut.InvokeAsync(() => input.Change("Test_Name")); |
| 116 | + |
| 117 | + form = cut.Find(".modal-body form"); |
| 118 | + await cut.InvokeAsync(() => form.Submit()); |
| 119 | + await cut.InvokeAsync(() => modal.Instance.CloseCallback()); |
| 120 | + |
| 121 | + // 更新插入模式 |
| 122 | + table.SetParametersAndRender(pb => |
| 123 | + { |
| 124 | + pb.Add(a => a.InsertRowMode, InsertRowMode.First); |
| 125 | + }); |
| 126 | + |
| 127 | + // Add 弹窗 |
| 128 | + await cut.InvokeAsync(() => table.Instance.AddAsync()); |
| 129 | + |
| 130 | + // 编辑弹窗逻辑 |
| 131 | + input = cut.Find(".modal-body form input.form-control"); |
| 132 | + await cut.InvokeAsync(() => input.Change("Test_Name")); |
| 133 | + |
| 134 | + form = cut.Find(".modal-body form"); |
| 135 | + await cut.InvokeAsync(() => form.Submit()); |
| 136 | + await cut.InvokeAsync(() => modal.Instance.CloseCallback()); |
102 | 137 | } |
103 | 138 |
|
104 | 139 | private class MockEFCoreDataService : IDataService<Foo>, IEntityFrameworkCoreDataService |
|
0 commit comments