From 579a55a4ae38cc84e9e62b1e8608292c1c7efbdd Mon Sep 17 00:00:00 2001 From: Steve Kinney Date: Wed, 2 Oct 2024 15:38:02 -0500 Subject: [PATCH] Update alert-button.test.jsx --- .../element-factory/src/alert-button.test.jsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/element-factory/src/alert-button.test.jsx b/examples/element-factory/src/alert-button.test.jsx index 424a3ca..972c696 100644 --- a/examples/element-factory/src/alert-button.test.jsx +++ b/examples/element-factory/src/alert-button.test.jsx @@ -3,12 +3,25 @@ import userEvent from '@testing-library/user-event'; import { AlertButton } from './alert-button'; -describe.todo('AlertButton', () => { +describe('AlertButton', () => { beforeEach(() => {}); afterEach(() => {}); it('should render an alert button', async () => {}); - it('should trigger an alert', async () => {}); + it.only('should trigger an alert', async () => { + // const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {}) + + render(); + const input = screen.getByLabelText('Message'); + const button = screen.getByRole('button', { name: /trigger alert/i }); + + await act(async () => { + await userEvent.type(input, 'Hello'); + }); + + // Click on the button. + // Look and see if alert() was called with the message. + }); });