@@ -37,16 +37,28 @@ test('Review form submits', async () => {
37
37
const reviewTextarea = getByPlaceholderText ( 'Write an awesome review' )
38
38
await fireEvent . update ( reviewTextarea , fakeReview . review )
39
39
40
+ // Rating Radio buttons
41
+ const initiallySelectedInput = getByLabelText ( 'Awful' )
40
42
const ratingSelect = getByLabelText ( 'Wonderful' )
41
- await fireEvent . update ( ratingSelect , fakeReview . rating )
43
+
44
+ expect ( initiallySelectedInput . checked ) . toBe ( true )
45
+ expect ( ratingSelect . checked ) . toBe ( false )
46
+
47
+ await fireEvent . update ( ratingSelect )
48
+
49
+ expect ( ratingSelect . checked ) . toBe ( true )
50
+ expect ( initiallySelectedInput . checked ) . toBe ( false )
42
51
43
52
// Get the Select element by using the initially displayed value.
44
53
const genreSelect = getByDisplayValue ( 'Comedy' )
45
54
await fireEvent . update ( genreSelect , fakeReview . genre )
46
55
47
56
// Get the Input element by its implicit ARIA role.
48
57
const recommendInput = getByRole ( 'checkbox' )
49
- await fireEvent . update ( recommendInput , fakeReview . recommend )
58
+
59
+ expect ( recommendInput . checked ) . toBe ( false )
60
+ await fireEvent . update ( recommendInput )
61
+ expect ( recommendInput . checked ) . toBe ( true )
50
62
51
63
// NOTE: in jsdom, it's not possible to trigger a form submission
52
64
// by clicking on the submit button. This is really unfortunate.
0 commit comments