@@ -8,3 +8,27 @@ test("Validate label text must be 'Drop yor files here...'", () => {
88 render ( < Dropzone > Drop yor files here...</ Dropzone > ) ;
99 expect ( screen . getByText ( "Drop yor files here..." ) ) . toBeInTheDocument ( ) ;
1010} ) ;
11+
12+ describe ( "Dropzone actionButtons" , ( ) => {
13+ test . each ( [
14+ [ { uploadButton : { onClick : console . log } } , false ] ,
15+ [ { uploadButton : { onClick : console . log , disabled : false } } , false ] ,
16+ [ { uploadButton : { onClick : console . log , disabled : true } } , true ] ,
17+ [ { deleteButton : { onClick : console . log } } , false ] ,
18+ [ { deleteButton : { onClick : console . log , disabled : false } } , false ] ,
19+ [ { deleteButton : { onClick : console . log , disabled : true } } , true ] ,
20+
21+ // abortButton and cleanButton need more interaction
22+ ] ) ( "disabled %s -> %s" , ( config , expected ) => {
23+ const { container } = render (
24+ < Dropzone actionButtons = { { position : "after" , ...config } } /> ,
25+ ) ;
26+ expect (
27+ (
28+ container . querySelector (
29+ ".files-ui-buttons-container button" ,
30+ ) as HTMLInputElement
31+ ) . disabled ,
32+ ) . toBe ( expected ) ;
33+ } ) ;
34+ } ) ;
0 commit comments