mirror of https://github.com/facebook/jest.git
17 lines
511 B
JavaScript
17 lines
511 B
JavaScript
// Copyright (c) Meta Platforms, Inc. and affiliates.. All Rights Reserved.
|
|
|
|
import {fireEvent, render} from '@testing-library/react';
|
|
import CheckboxWithLabel from '../CheckboxWithLabel';
|
|
|
|
it('CheckboxWithLabel changes the text after click', () => {
|
|
const {queryByLabelText, getByLabelText} = render(
|
|
<CheckboxWithLabel labelOn="On" labelOff="Off" />,
|
|
);
|
|
|
|
expect(queryByLabelText(/off/i)).toBeTruthy();
|
|
|
|
fireEvent.click(getByLabelText(/off/i));
|
|
|
|
expect(queryByLabelText(/on/i)).toBeTruthy();
|
|
});
|