@@ -11,6 +11,7 @@ describe("InputFile", () => {
11
11
it ( "should have expected DOM output" , async ( ) => {
12
12
const label = "Select file" ;
13
13
const buttonLabel = "Click on me" ;
14
+ const labelRemove = "Remove file" ;
14
15
const name = "name" ;
15
16
const placeholder = "Not file has been selected" ;
16
17
const dataTest = "test" ;
@@ -34,6 +35,7 @@ describe("InputFile", () => {
34
35
tabIndex = { tabIndex }
35
36
onChange = { onChange }
36
37
onFocus = { onFocus }
38
+ labelRemove = { labelRemove }
37
39
/> ,
38
40
) ;
39
41
@@ -55,7 +57,15 @@ describe("InputFile", () => {
55
57
const onChange = jest . fn ( ) ;
56
58
const onFocus = jest . fn ( ) ;
57
59
58
- render ( < InputFile dataTest = "test" disabled onChange = { onChange } onFocus = { onFocus } /> ) ;
60
+ render (
61
+ < InputFile
62
+ dataTest = "test"
63
+ disabled
64
+ onChange = { onChange }
65
+ onFocus = { onFocus }
66
+ labelRemove = "Remove file"
67
+ /> ,
68
+ ) ;
59
69
60
70
const input = screen . getByTestId ( "test" ) ;
61
71
expect ( input ) . toBeDisabled ( ) ;
@@ -66,16 +76,16 @@ describe("InputFile", () => {
66
76
67
77
it ( "should have passed width" , ( ) => {
68
78
const width = "100px" ;
69
- render ( < InputFile width = { width } label = "label" /> ) ;
79
+ render ( < InputFile width = { width } label = "label" labelRemove = "Remove file" /> ) ;
70
80
expect ( document . querySelector ( "label" ) ) . toHaveStyle ( { width } ) ;
71
81
} ) ;
72
82
73
83
it ( "should have filename, onRemoveFile" , async ( ) => {
74
84
const onRemoveFile = jest . fn ( ) ;
75
85
76
- render ( < InputFile fileName = "bur" onRemoveFile = { onRemoveFile } /> ) ;
86
+ render ( < InputFile fileName = "bur" onRemoveFile = { onRemoveFile } labelRemove = "Remove file" /> ) ;
77
87
78
- const button = screen . getByRole ( "button" , { name : "remove " } ) ;
88
+ const button = screen . getByRole ( "button" , { name : "Remove file " } ) ;
79
89
await user . click ( button ) ;
80
90
expect ( onRemoveFile ) . toHaveBeenCalled ( ) ;
81
91
} ) ;
@@ -89,6 +99,7 @@ describe("InputFile", () => {
89
99
onFocus = { onFocus }
90
100
onBlur = { onBlur }
91
101
error = "chuck norris counted to infinity twice"
102
+ labelRemove = "Remove file"
92
103
/> ,
93
104
) ;
94
105
0 commit comments