Files
introduction-to-testing/examples/element-factory/src/button.test.js
2024-10-01 19:52:06 -05:00

20 lines
535 B
JavaScript

import { createButton } from './button.js';
describe('createButton', () => {
it('should create a button element', () => {
const button = createButton();
expect(button.tagName).toBe('BUTTON');
});
it('should have the text "Click Me"', () => {
const button = createButton();
expect(button.textContent).toBe('Click Me');
});
it('should change the text to "Clicked!" when clicked', async () => {
const button = createButton();
button.click();
expect(button.textContent).toBe('Clicked!');
});
});