diff --git a/src/AsyncButton.spec.tsx b/src/AsyncButton.spec.tsx
index b056347..165a581 100644
--- a/src/AsyncButton.spec.tsx
+++ b/src/AsyncButton.spec.tsx
@@ -262,7 +262,7 @@ describe(' component', () => {
;
});
- it('should allow HTMLButtonElement event handlers to be passed by default', () => {
+ it('should allow sync HTMLButtonElement event handlers to be passed by default', () => {
function onClick(event: React.MouseEvent) {
event.preventDefault();
}
@@ -271,6 +271,15 @@ describe(' component', () => {
;
});
+ it('should allow async HTMLButtonElement event handlers to be passed by default', () => {
+ async function onClick(event: React.MouseEvent) {
+ event.preventDefault();
+ }
+
+ // @ts-expect-no-error
+ ;
+ });
+
it('should not allow HTMLAnchorElement event handlers to be passed by default', () => {
function onClick(event: React.MouseEvent) {
event.preventDefault();
@@ -280,7 +289,7 @@ describe(' component', () => {
;
});
- it('should allow HTMLButtonElement event handlers to be passed given as="button"', () => {
+ it('should allow sync HTMLButtonElement event handlers to be passed given as="button"', () => {
function onClick(event: React.MouseEvent) {
event.preventDefault();
}
@@ -289,6 +298,15 @@ describe(' component', () => {
;
});
+ it('should allow async HTMLButtonElement event handlers to be passed given as="button"', () => {
+ async function onClick(event: React.MouseEvent) {
+ event.preventDefault();
+ }
+
+ // @ts-expect-no-error
+ ;
+ });
+
it('should not allow HTMLAnchorElement event handlers to be passed given as="button"', () => {
function onClick(event: React.MouseEvent) {
event.preventDefault();
@@ -302,7 +320,7 @@ describe(' component', () => {
;
});
- it('should allow HTMLAnchorElement event handlers to be passed given as="a"', () => {
+ it('should allow sync HTMLAnchorElement event handlers to be passed given as="a"', () => {
function onClick(event: React.MouseEvent) {
event.preventDefault();
}
@@ -311,6 +329,15 @@ describe(' component', () => {
;
});
+ it('should allow async HTMLAnchorElement event handlers to be passed given as="a"', () => {
+ async function onClick(event: React.MouseEvent) {
+ event.preventDefault();
+ }
+
+ // @ts-expect-no-error
+ ;
+ });
+
it('should not allow HTMLButtonElement event handlers to be passed given as="a"', () => {
function onClick(event: React.MouseEvent) {
event.preventDefault();
@@ -326,7 +353,7 @@ describe(' component', () => {
;
});
- it('should allow HTMLButtonElement event handlers to be passed given as={MyButton} that handles onClick', () => {
+ it('should allow sync HTMLButtonElement event handlers to be passed given as={MyButton} that handles onClick', () => {
function MyButton({
onClick,
}: {
@@ -343,6 +370,23 @@ describe(' component', () => {
;
});
+ it('should allow async HTMLButtonElement event handlers to be passed given as={MyButton} that handles onClick', () => {
+ function MyButton({
+ onClick,
+ }: {
+ onClick: (event: React.MouseEvent) => void;
+ }) {
+ return ;
+ }
+
+ async function onClick(event: React.MouseEvent) {
+ event.preventDefault();
+ }
+
+ // @ts-expect-no-error
+ ;
+ });
+
it('should allow HTMLAnchorElement event handlers to be passed given as={MyAnchor} that handles onClick', () => {
function MyAnchor({
onClick,