Skip to content

Commit

Permalink
fix: enable buttons in hideLoading (#2048)
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed Sep 7, 2020
1 parent 8190f31 commit e34dc30
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cypress/integration/methods/input.spec.js
Expand Up @@ -377,6 +377,9 @@ describe('Validation', () => {
Swal.getInput().value = 'blah-blah'
Swal.clickConfirm()
setTimeout(() => {
expect(Swal.getConfirmButton().disabled).to.be.false
expect(Swal.getDenyButton().disabled).to.be.false
expect(Swal.getCancelButton().disabled).to.be.false
expect(isVisible(Swal.getValidationMessage())).to.be.true
expect(Swal.getValidationMessage().textContent).to.equal('Invalid phone number')
Swal.getInput().value = '123-456-7890'
Expand Down
3 changes: 3 additions & 0 deletions src/instanceMethods/hideLoading.js
Expand Up @@ -21,6 +21,9 @@ function hideLoading () {
dom.removeClass([domCache.popup, domCache.actions], swalClasses.loading)
domCache.popup.removeAttribute('aria-busy')
domCache.popup.removeAttribute('data-loading')
domCache.confirmButton.disabled = false
domCache.denyButton.disabled = false
domCache.cancelButton.disabled = false
}

export {
Expand Down
3 changes: 3 additions & 0 deletions test/qunit/validation.js
Expand Up @@ -18,6 +18,9 @@ QUnit.test('input.checkValidity()', (assert) => {
Swal.getInput().value = 'blah-blah'
Swal.clickConfirm()
setTimeout(() => {
assert.notOk(Swal.getConfirmButton().disabled)
assert.notOk(Swal.getDenyButton().disabled)
assert.notOk(Swal.getCancelButton().disabled)
assert.ok(isVisible(Swal.getValidationMessage()))
assert.equal(Swal.getValidationMessage().textContent, 'Invalid phone number')

Expand Down

0 comments on commit e34dc30

Please sign in to comment.