@@ -37,16 +37,28 @@ test('Review form submits', async () => {
3737 const reviewTextarea = getByPlaceholderText ( 'Write an awesome review' )
3838 await fireEvent . update ( reviewTextarea , fakeReview . review )
3939
40+ // Rating Radio buttons
41+ const initiallySelectedInput = getByLabelText ( 'Awful' )
4042 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 )
4251
4352 // Get the Select element by using the initially displayed value.
4453 const genreSelect = getByDisplayValue ( 'Comedy' )
4554 await fireEvent . update ( genreSelect , fakeReview . genre )
4655
4756 // Get the Input element by its implicit ARIA role.
4857 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 )
5062
5163 // NOTE: in jsdom, it's not possible to trigger a form submission
5264 // by clicking on the submit button. This is really unfortunate.
0 commit comments