From eb3762c5728266244e4b4ef7d80cf4f1b2f213f7 Mon Sep 17 00:00:00 2001 From: Limon Monte Date: Fri, 12 Feb 2021 03:00:34 +0200 Subject: [PATCH] fix: Swal.getIcon() to work in jest environment (#2163) --- src/utils/dom/getters.js | 2 +- sweetalert2.d.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/dom/getters.js b/src/utils/dom/getters.js index ec87824a1..93bdcfd96 100644 --- a/src/utils/dom/getters.js +++ b/src/utils/dom/getters.js @@ -21,7 +21,7 @@ export const getIcons = () => { } export const getIcon = () => { - const visibleIcon = getIcons().filter((icon) => isVisible(icon)) + const visibleIcon = getIcons().filter((icon) => icon.style.display !== 'none') return visibleIcon.length ? visibleIcon[0] : null } diff --git a/sweetalert2.d.ts b/sweetalert2.d.ts index 57e35e8ef..aae5918cf 100644 --- a/sweetalert2.d.ts +++ b/sweetalert2.d.ts @@ -909,6 +909,7 @@ declare module 'sweetalert2' { /** * Set to `true` to disable buttons and show the loader instead of the Confirm button. + * Use it in combination with the `preConfirm` parameter. * * @default false */ @@ -916,6 +917,7 @@ declare module 'sweetalert2' { /** * Set to `true` to disable buttons and show the loader instead of the Deny button. + * Use it in combination with the `preDeny` parameter. * * @default false */