Commit 88a6203 1 parent b45ef73 commit 88a6203 Copy full SHA for 88a6203
File tree 2 files changed +27
-4
lines changed
frontend/src/components/retro-formats/mood
2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 1
- import { render } from 'flexible-testing-library-react' ;
1
+ import { act , render , role } from 'flexible-testing-library-react' ;
2
2
3
3
import { MoodRetro } from './MoodRetro' ;
4
4
5
5
const nop = ( ) => undefined ;
6
6
7
7
describe ( 'MoodRetro' , ( ) => {
8
- it ( 'renders without error ' , ( ) => {
9
- render (
8
+ it ( 'can switch between wide and narrow view ' , ( ) => {
9
+ const { getAllBy } = render (
10
10
< MoodRetro
11
11
retroOptions = { { } }
12
12
retroItems = { [ ] }
@@ -16,5 +16,26 @@ describe('MoodRetro', () => {
16
16
dispatch = { nop }
17
17
/> ,
18
18
) ;
19
+
20
+ expect (
21
+ getAllBy ( role ( 'textbox' ) ) . map ( ( i ) => i . getAttribute ( 'placeholder' ) ) ,
22
+ ) . toEqual ( [
23
+ 'I\u2019m glad that\u2026' ,
24
+ 'I\u2019m wondering about\u2026' ,
25
+ 'It wasn\u2019t so great that\u2026' ,
26
+ 'Add an action item' ,
27
+ ] ) ;
28
+
29
+ const originalWidth = window . innerWidth ;
30
+ window . innerWidth = 200 ;
31
+ try {
32
+ act ( ( ) => window . dispatchEvent ( new UIEvent ( 'resize' ) ) ) ;
33
+
34
+ expect (
35
+ getAllBy ( role ( 'textbox' ) ) . map ( ( i ) => i . getAttribute ( 'placeholder' ) ) ,
36
+ ) . toEqual ( [ 'I\u2019m glad that\u2026' ] ) ;
37
+ } finally {
38
+ window . innerWidth = originalWidth ;
39
+ }
19
40
} ) ;
20
41
} ) ;
Original file line number Diff line number Diff line change @@ -74,7 +74,9 @@ export const MoodRetro = ({
74
74
! singleColumn || OPTIONS . enableMobileFacilitation . read ( retroOptions ) ;
75
75
76
76
const useAction = useActionFactory ( dispatch ) ;
77
- const useFacilitatorAction = canFacilitate ? useAction : ( ) => undefined ;
77
+ const useFacilitatorAction = useActionFactory (
78
+ canFacilitate ? dispatch : undefined ,
79
+ ) ;
78
80
79
81
const handleAddItem = useAction ( addRetroItem ) ;
80
82
const handleAddActionItem = useAction ( addRetroActionItem ) ;
You can’t perform that action at this time.
0 commit comments