Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test(`renders a button with the given type when one is set`, () => {
const submitButton = render(<button type="submit">My submit button</button>)
.container.firstChild;
if (!typeIs.button(submitButton)) {
throw new Error('Rendered element is not a button');
}
expect(submitButton.type).toBe('submit');
});
test(`renders the disabled and aria-disabled attributes when disabled is set`, () => {
renderedComponent.rerender(
<button disabled="{true}" title="{title}">
{child}
</button>,
);
if (!typeIs.button(renderedButton)) {
throw new Error('Rendered element is not a button');
}
expect(renderedButton.disabled).toBe(true);
expect(renderedButton.getAttribute('aria-disabled')).toBe('true');
});