-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: show the browser validation message for input (#2704)
- Loading branch information
Showing
2 changed files
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,21 @@ describe('Inputs', () => { | |
}) | ||
}) | ||
|
||
it('browser validation + browser validation message', (done) => { | ||
SwalWithoutAnimation.fire({ input: 'text', inputAttributes: { pattern: '[0-9]+' } }) | ||
|
||
Swal.getInput().value = 'a' | ||
Swal.clickConfirm() | ||
setTimeout(() => { | ||
expect(isVisible(Swal.getValidationMessage())).to.be.true | ||
// Chrome: Please match the format requested. | ||
// Firefox: Please match the requested format. | ||
// Safari: Match the requested format. | ||
expect(Swal.getValidationMessage().textContent.indexOf('atch the') !== -1).to.be.true | ||
done() | ||
}, TIMEOUT) | ||
}) | ||
|
||
it('input email + built-in email validation', (done) => { | ||
const invalidEmailAddress = 'blah-blah@zzz' | ||
const validEmailAddress = '[email protected]' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters