diff --git a/examples/react-testing-lib/src/components/Spinner.test.tsx b/examples/react-testing-lib/src/components/Spinner.test.tsx new file mode 100644 index 000000000000..037a615ec5d1 --- /dev/null +++ b/examples/react-testing-lib/src/components/Spinner.test.tsx @@ -0,0 +1,36 @@ +import React from 'react' +import { render } from '@testing-library/react' +import { Spinner } from './Spinner.js' + +test('Spinner renders correctly', () => { + const { container } = render( + , + ) + expect(container).toMatchInlineSnapshot(` +
+ + + Loading spinner + + + + +
+ `) +}) diff --git a/examples/react-testing-lib/src/components/Spinner.tsx b/examples/react-testing-lib/src/components/Spinner.tsx new file mode 100644 index 000000000000..817abffff108 --- /dev/null +++ b/examples/react-testing-lib/src/components/Spinner.tsx @@ -0,0 +1,29 @@ +import React from 'react' + +export function Spinner() { + return ( + + Loading spinner + + + + + + ) +}