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

JS -- add function eMailValidate used to validate an email address

This commit is contained in:
Calixte Denizet 2020-12-10 15:38:31 +01:00
parent b194c820bf
commit f94269c0d1
3 changed files with 29 additions and 1 deletions

View file

@ -1202,5 +1202,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());
});
});
});
});