File tree Expand file tree Collapse file tree 4 files changed +43
-16
lines changed
src/BootstrapBlazor/Components/Upload Expand file tree Collapse file tree 4 files changed +43
-16
lines changed Original file line number Diff line number Diff line change 1616 {
1717 <div @key =" item" class =" @GetItemClassString(item)" id =" @item.ValidateId" style =" @ItemStyleString " >
1818 <Avatar Url =" @item.PrevUrl" />
19- @if (! IsDisabled )
20- {
21- <div class =" upload-item-actions" >
22- <span class =" upload-item-delete" @onclick =" @(e => OnFileDelete(item))" >
23- <i class =" @DeleteIcon" ></i >
19+ <div class =" upload-item-actions" >
20+ <span class =" upload-item-delete" @onclick =" @(e => OnFileDelete(item))" >
21+ <i class =" @DeleteIcon" ></i >
22+ </span >
23+ @if (GetShowProgress (item ))
24+ {
25+ <span class =" upload-item-spin" >
26+ <i class =" @LoadingIcon" ></i >
2427 </span >
25- @if (GetShowProgress (item ))
26- {
27- <span class =" upload-item-spin" >
28- <i class =" @LoadingIcon" ></i >
29- </span >
30- }
31- </div >
32- }
28+ }
29+ </div >
3330 @if (! IsCircle )
3431 {
3532 <span class =" upload-item-label" >
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ await input.Instance.OnChange.InvokeAsync(new InputFileChangeEventArgs(new List<
163163 }
164164
165165 [ Fact ]
166- public void AvatarUpload_ShowProgress_Ok ( )
166+ public async Task DropUpload_ShowProgress_Ok ( )
167167 {
168168 var cut = Context . RenderComponent < AvatarUpload < string > > ( pb =>
169169 {
@@ -172,10 +172,16 @@ public void AvatarUpload_ShowProgress_Ok()
172172 {
173173 await Task . Delay ( 100 ) ;
174174 await file . SaveToFileAsync ( "1.txt" ) ;
175- SetUploaded ( file , false ) ;
176175 } ) ;
177176 } ) ;
178177 var input = cut . FindComponent < InputFile > ( ) ;
178+ await cut . InvokeAsync ( ( ) =>
179+ {
180+ _ = input . Instance . OnChange . InvokeAsync ( new InputFileChangeEventArgs ( new List < MockBrowserFile > ( )
181+ {
182+ new ( )
183+ } ) ) ;
184+ } ) ;
179185 }
180186
181187 private class MockBrowserFile ( string name = "UploadTestFile" , string contentType = "text" ) : IBrowserFile
Original file line number Diff line number Diff line change @@ -386,7 +386,6 @@ public void ButtonUpload_OnGetFileFormat_Ok()
386386 new ( ) { FileName = "1.test" } ,
387387 new ( ) { FileName = "1" }
388388 ] ) ;
389-
390389 } ) ;
391390 cut . Contains ( "fa-file-excel" ) ;
392391 cut . Contains ( "fa-file-word" ) ;
Original file line number Diff line number Diff line change @@ -136,6 +136,31 @@ await cut.InvokeAsync(async () =>
136136 } ) ;
137137 }
138138
139+
140+ [ Fact ]
141+ public void OnGetFileFormat_Ok ( )
142+ {
143+ var cut = Context . RenderComponent < DropUpload > ( pb =>
144+ {
145+ pb . Add ( a => a . LoadingIcon , "fa-loading" ) ;
146+ pb . Add ( a => a . DeleteIcon , "fa-delte" ) ;
147+ pb . Add ( a => a . CancelIcon , "fa-cancel" ) ;
148+ pb . Add ( a => a . DownloadIcon , "fa-download" ) ;
149+ pb . Add ( a => a . InvalidStatusIcon , "fa-invalid" ) ;
150+ pb . Add ( a => a . ValidStatusIcon , "fa-valid" ) ;
151+ pb . Add ( a => a . ShowUploadFileList , true ) ;
152+ pb . Add ( a => a . OnGetFileFormat , extensions =>
153+ {
154+ return "fa-format-test" ;
155+ } ) ;
156+ pb . Add ( a => a . DefaultFileList ,
157+ [
158+ new ( ) { FileName = "1.csv" }
159+ ] ) ;
160+ } ) ;
161+ cut . Contains ( "fa-format-test" ) ;
162+ }
163+
139164 private class MockBrowserFile ( string name = "UploadTestFile" , string contentType = "text" ) : IBrowserFile
140165 {
141166 public string Name { get ; } = name ;
You can’t perform that action at this time.
0 commit comments