1
1
import { fromJS } from "immutable" ;
2
2
3
- import { mountedFormComponent , screen } from "../../../../../../test-utils" ;
3
+ import { mountedFormComponent , screen , userEvent } from "../../../../../../test-utils" ;
4
4
5
5
import TranslationsForm from "./component" ;
6
6
@@ -25,14 +25,17 @@ describe("<TranslationsForm />", () => {
25
25
}
26
26
} ) ;
27
27
28
-
29
28
it ( "should render <TranslationsForm />" , ( ) => {
30
- mountedFormComponent ( < TranslationsForm mode = "new" /> , state )
31
- expect ( screen . getByText ( ' forms.label' ) ) . toBeInTheDocument ( ) ;
29
+ mountedFormComponent ( < TranslationsForm mode = "new" /> , state ) ;
30
+ expect ( screen . getByText ( " forms.label" ) ) . toBeInTheDocument ( ) ;
32
31
} ) ;
33
32
34
- it ( "should update name and description if the translation are updated" , ( ) => {
35
- mountedFormComponent ( < TranslationsForm mode = "new" /> , state )
36
- expect ( screen . getAllByRole ( 'textbox' ) ) . toHaveLength ( 3 ) ;
33
+ it ( "should update name and description if the translation are updated" , async ( ) => {
34
+ const user = userEvent . setup ( ) ;
35
+
36
+ mountedFormComponent ( < TranslationsForm mode = "new" /> , state ) ;
37
+ await user . type ( screen . getAllByRole ( "textbox" ) [ 0 ] , "name" ) ;
38
+ await user . type ( screen . getAllByRole ( "textbox" ) [ 1 ] , "description" ) ;
39
+ expect ( screen . getAllByRole ( "textbox" ) [ 1 ] ) . toHaveValue ( "description" ) ;
37
40
} ) ;
38
41
} ) ;
0 commit comments