1
1
import { act , fireEvent , render , screen } from '@shared/tests' ;
2
2
import React from 'react' ;
3
+ import { DialogPropTypes , MessageBoxPropTypes , PopoverPropTypes , ResponsivePopoverPropTypes } from '../..' ;
3
4
import { Modals } from './index' ;
4
5
5
6
describe ( 'Modals - static helpers' , function ( ) {
6
7
test ( 'showDialog' , ( ) => {
7
8
render ( null ) ;
9
+ const props : DialogPropTypes & { 'data-testid' : string } = {
10
+ children : 'Dialog Content' ,
11
+ 'data-testid' : 'dialog'
12
+ } ;
8
13
act ( ( ) => {
9
- Modals . showDialog ( {
10
- children : 'Dialog Content' ,
11
- 'data-testid' : 'dialog'
12
- } ) ;
14
+ Modals . showDialog ( props ) ;
13
15
} ) ;
14
16
15
17
expect ( screen . getByTestId ( 'dialog' ) ) . toHaveAttribute ( 'open' , 'true' ) ;
@@ -18,12 +20,13 @@ describe('Modals - static helpers', function () {
18
20
19
21
test ( 'showPopover' , ( ) => {
20
22
render ( < span id = "opener" /> ) ;
23
+ const props : PopoverPropTypes & { 'data-testid' : string } = {
24
+ opener : 'opener' ,
25
+ children : 'Popover Content' ,
26
+ 'data-testid' : 'popover'
27
+ } ;
21
28
act ( ( ) => {
22
- Modals . showPopover ( {
23
- opener : 'opener' ,
24
- children : 'Popover Content' ,
25
- 'data-testid' : 'popover'
26
- } ) ;
29
+ Modals . showPopover ( props ) ;
27
30
} ) ;
28
31
29
32
expect ( screen . getByTestId ( 'popover' ) ) . toHaveAttribute ( 'open' , 'true' ) ;
@@ -32,12 +35,13 @@ describe('Modals - static helpers', function () {
32
35
33
36
test ( 'showResponsivePopover' , ( ) => {
34
37
render ( < span id = "opener" /> ) ;
38
+ const props : ResponsivePopoverPropTypes & { 'data-testid' : string } = {
39
+ opener : 'opener' ,
40
+ children : 'ResponsivePopover Content' ,
41
+ 'data-testid' : 'responsivepopover'
42
+ } ;
35
43
act ( ( ) => {
36
- Modals . showResponsivePopover ( {
37
- opener : 'opener' ,
38
- children : 'ResponsivePopover Content' ,
39
- 'data-testid' : 'responsivepopover'
40
- } ) ;
44
+ Modals . showResponsivePopover ( props ) ;
41
45
} ) ;
42
46
43
47
expect ( screen . getByTestId ( 'responsivepopover' ) ) . toHaveAttribute ( 'open' , 'true' ) ;
@@ -46,11 +50,12 @@ describe('Modals - static helpers', function () {
46
50
47
51
test ( 'showMessageBox' , async ( ) => {
48
52
render ( null ) ;
53
+ const props : MessageBoxPropTypes & { 'data-testid' : string } = {
54
+ children : 'MessageBox Content' ,
55
+ 'data-testid' : 'messagebox'
56
+ } ;
49
57
act ( ( ) => {
50
- Modals . showMessageBox ( {
51
- children : 'MessageBox Content' ,
52
- 'data-testid' : 'messagebox'
53
- } ) ;
58
+ Modals . showMessageBox ( props ) ;
54
59
} ) ;
55
60
56
61
await screen . findByText ( 'Confirmation' ) ;
0 commit comments