File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,39 @@ public async Task ShowUploadList_Ok()
103103 Assert . NotNull ( file ) ;
104104 }
105105
106+ [ Fact ]
107+ public async Task DropUpload_ShowProgress_Ok ( )
108+ {
109+ var cancel = false ;
110+ var cut = Context . RenderComponent < DropUpload > ( pb =>
111+ {
112+ pb . Add ( a => a . ShowProgress , true ) ;
113+ pb . Add ( a => a . OnChange , async file =>
114+ {
115+ await Task . Delay ( 100 ) ;
116+ await file . SaveToFileAsync ( "1.txt" ) ;
117+ } ) ;
118+ pb . Add ( a => a . OnCancel , file =>
119+ {
120+ cancel = true ;
121+ return Task . CompletedTask ;
122+ } ) ;
123+ } ) ;
124+ var input = cut . FindComponent < InputFile > ( ) ;
125+ await cut . InvokeAsync ( async ( ) =>
126+ {
127+ _ = input . Instance . OnChange . InvokeAsync ( new InputFileChangeEventArgs ( new List < MockBrowserFile > ( )
128+ {
129+ new ( )
130+ } ) ) ;
131+
132+ var button = cut . Find ( ".cancel-icon" ) ;
133+ Assert . NotNull ( button ) ;
134+ await cut . InvokeAsync ( ( ) => button . Click ( ) ) ;
135+ Assert . True ( cancel ) ;
136+ } ) ;
137+ }
138+
106139 [ Fact ]
107140 public void ButtonUpload_OnGetFileFormat_Ok ( )
108141 {
You can’t perform that action at this time.
0 commit comments