File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,23 @@ public async Task Checkbox_OnBeforeStateChanged()
7777 Assert . True ( cut . Instance . Value ) ;
7878 }
7979
80+ [ Fact ]
81+ public async Task Checkbox_OnTriggerClickAsync ( )
82+ {
83+ var cut = Context . RenderComponent < Checkbox < bool > > ( ) ;
84+ Assert . False ( cut . Instance . Value ) ;
85+
86+ // JavaScript 调用 OnTriggerClickAsync 方法
87+ // 参数 1 服务端同步更改为 UnChecked 状态 0 服务端同步更改为 Checked 状态
88+ var val = await cut . Instance . OnTriggerClickAsync ( "1" ) ;
89+ Assert . True ( val ) ;
90+ Assert . Equal ( CheckboxState . UnChecked , cut . Instance . State ) ;
91+
92+ val = await cut . Instance . OnTriggerClickAsync ( "0" ) ;
93+ Assert . True ( val ) ;
94+ Assert . Equal ( CheckboxState . Checked , cut . Instance . State ) ;
95+ }
96+
8097 [ Fact ]
8198 public void Checkbox_Dispose ( )
8299 {
You can’t perform that action at this time.
0 commit comments