1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

Merge pull request #12719 from calixteman/emailvalidate

JS -- add function eMailValidate used to validate an email address
This commit is contained in:
Tim van der Meij 2020-12-10 22:19:37 +01:00 committed by GitHub
commit 954ac3d944
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View file

@ -1207,5 +1207,21 @@ describe("Scripting", function () {
}
});
});
describe("eMailValidate", function () {
it("should validate an e-mail address", function (done) {
Promise.all([
myeval(`eMailValidate(123)`).then(value => {
expect(value).toEqual(false);
}),
myeval(`eMailValidate("foo@bar.com")`).then(value => {
expect(value).toEqual(true);
}),
myeval(`eMailValidate("foo bar")`).then(value => {
expect(value).toEqual(false);
}),
]).then(() => done());
});
});
});
});