Skip to content

Commit 854cc00

Browse files
committed
Components: Use explicit ID in checkbox snapshot fixture
1 parent ee5db70 commit 854cc00

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎packages/components/src/checkbox-control/test/index.jsdom.test.tsx‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,19 @@ describe( 'CheckboxControl', () => {
6565
} );
6666

6767
it( 'should render the indeterminate icon when in the indeterminate state', () => {
68-
const { asFragment, rerender } = render( <CheckboxControl /> );
69-
screen
70-
.getByRole( 'checkbox' )
71-
.setAttribute( 'id', 'checkbox-control' );
68+
const id = 'checkbox-control';
69+
const { asFragment, rerender } = render(
70+
<BaseCheckboxControl id={ id } onChange={ noop } />
71+
);
7272
const checkboxDefault = asFragment();
7373

74-
rerender( <CheckboxControl indeterminate /> );
75-
screen
76-
.getByRole( 'checkbox' )
77-
.setAttribute( 'id', 'checkbox-control' );
74+
rerender(
75+
<BaseCheckboxControl
76+
id={ id }
77+
onChange={ noop }
78+
indeterminate
79+
/>
80+
);
7881
const checkboxIndeterminate = asFragment();
7982

8083
// Expect the diff snapshot to be mostly about the indeterminate icon

0 commit comments

Comments
 (0)