From e045ce6bfd71c4cadf1b0dfc538204f93805c2e8 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 30 Apr 2022 17:57:21 +0800 Subject: [PATCH] fix(Dialog): should not submit form after clicking button (#10570) * fix(Dialog): should not submit form * chore: update snapshot --- src/dialog/Dialog.js | 2 ++ src/dialog/test/__snapshots__/demo.spec.js.snap | 4 ++-- src/dialog/test/__snapshots__/index.spec.js.snap | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/dialog/Dialog.js b/src/dialog/Dialog.js index 88b9be460..1cc9881b9 100644 --- a/src/dialog/Dialog.js +++ b/src/dialog/Dialog.js @@ -173,6 +173,7 @@ export default createComponent({ loading={this.loading.cancel} text={this.cancelButtonText || t('cancel')} style={{ color: this.cancelButtonColor }} + nativeType="button" onClick={() => { this.handleAction('cancel'); }} @@ -185,6 +186,7 @@ export default createComponent({ loading={this.loading.confirm} text={this.confirmButtonText || t('confirm')} style={{ color: this.confirmButtonColor }} + nativeType="button" onClick={() => { this.handleAction('confirm'); }} diff --git a/src/dialog/test/__snapshots__/demo.spec.js.snap b/src/dialog/test/__snapshots__/demo.spec.js.snap index f28cc820b..c060dce67 100644 --- a/src/dialog/test/__snapshots__/demo.spec.js.snap +++ b/src/dialog/test/__snapshots__/demo.spec.js.snap @@ -40,9 +40,9 @@ exports[`renders demo correctly 1`] = ` diff --git a/src/dialog/test/__snapshots__/index.spec.js.snap b/src/dialog/test/__snapshots__/index.spec.js.snap index 8ff040413..d45966f19 100644 --- a/src/dialog/test/__snapshots__/index.spec.js.snap +++ b/src/dialog/test/__snapshots__/index.spec.js.snap @@ -4,9 +4,9 @@ exports[`allow-html prop 1`] = `
<span>tex exports[`button color 1`] = ` @@ -14,9 +14,9 @@ exports[`button color 1`] = ` exports[`button text 1`] = ` @@ -25,7 +25,7 @@ exports[`button text 1`] = ` exports[`default slot 1`] = ` @@ -34,7 +34,7 @@ exports[`default slot 1`] = ` exports[`title slot 1`] = `