File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 33// See the LICENSE file in the project root for more information.
44// Maintainer: Argo Zhang([email protected] ) Website: https://www.blazor.zone 55
6+ using AngleSharp . Dom ;
67using Microsoft . AspNetCore . Components . Forms ;
78using System . ComponentModel . DataAnnotations ;
89
@@ -171,6 +172,41 @@ public void InputUpload_Files()
171172 Assert . Contains ( "test1.png;test2.png" , cut . Markup ) ;
172173 }
173174
175+ [ Fact ]
176+ public void InputUpload_IsMultiple ( )
177+ {
178+ var cut = Context . RenderComponent < InputUpload < List < string > > > ( pb =>
179+ {
180+ pb . Add ( a => a . IsMultiple , false ) ;
181+ } ) ;
182+
183+ // 禁用多选功能
184+ cut . DoesNotContain ( "multiple=\" multiple\" " ) ;
185+
186+ // 给定已上传文件后上传按钮应该被禁用
187+ cut . SetParametersAndRender ( pb =>
188+ {
189+ pb . Add ( a => a . DefaultFileList ,
190+ [
191+ new UploadFile ( ) { FileName = "test1.png" } ,
192+ new UploadFile ( ) { FileName = "test2.png" }
193+ ] ) ;
194+ } ) ;
195+ var button = cut . Find ( ".btn-browser" ) ;
196+ Assert . True ( button . IsDisabled ( ) ) ;
197+
198+ // 开启多选功能
199+ cut . SetParametersAndRender ( pb =>
200+ {
201+ pb . Add ( a => a . IsMultiple , true ) ;
202+ } ) ;
203+ cut . Contains ( "multiple=\" multiple\" " ) ;
204+
205+ // 给定已上传文件后上传按钮不应该被禁用
206+ button = cut . Find ( ".btn-browser" ) ;
207+ Assert . False ( button . IsDisabled ( ) ) ;
208+ }
209+
174210 private class Person
175211 {
176212 [ Required ]
You can’t perform that action at this time.
0 commit comments