|
Line 0
a/LayoutTests/fast/forms/resources/ValidityState-typeMismatch-email.js_sec1
|
|
|
1 |
description("This test aims to check for typeMismatch flag with type=email input fields"); |
| 2 |
|
| 3 |
var i = document.createElement("input"); |
| 4 |
var v = i.validity; |
| 5 |
|
| 6 |
i.type = "email"; |
| 7 |
shouldBe("v.typeMismatch", "false"); |
| 8 |
|
| 9 |
// VALID SINGLE VALUES |
| 10 |
i.value = "someone@somewhere.com"; |
| 11 |
shouldBe("v.typeMismatch", "false"); |
| 12 |
i.value = "someone@localhost"; |
| 13 |
shouldBe("v.typeMismatch", "false"); |
| 14 |
i.value = "someone@127.0.0.1"; |
| 15 |
shouldBe("v.typeMismatch", "false"); |
| 16 |
i.value = "a@b"; |
| 17 |
shouldBe("v.typeMismatch", "false"); |
| 18 |
i.value = "a/b@c"; |
| 19 |
shouldBe("v.typeMismatch", "false"); |
| 20 |
i.value = "{}@{}.com"; |
| 21 |
shouldBe("v.typeMismatch", "false"); |
| 22 |
i.value = "ddjk-s-jk@asl-"; |
| 23 |
shouldBe("v.typeMismatch", "false"); |
| 24 |
i.value = "m*'@'!%"; |
| 25 |
shouldBe("v.typeMismatch", "false"); |
| 26 |
i.value = "fasfa@tu!!7n7.ad##0!!!"; |
| 27 |
shouldBe("v.typeMismatch", "false"); |
| 28 |
i.value = "F/s/f/a@feo+re.com"; |
| 29 |
shouldBe("v.typeMismatch", "false"); |
| 30 |
i.value = "some+long+email+address@some+host-weird-/looking.com"; |
| 31 |
shouldBe("v.typeMismatch", "false"); |
| 32 |
i.value = "%@%"; |
| 33 |
shouldBe("v.typeMismatch", "false"); |
| 34 |
|
| 35 |
// INVALID SINGLE VALUES |
| 36 |
i.value = "@somewhere.com"; |
| 37 |
shouldBe("v.typeMismatch", "true"); |
| 38 |
i.value = ".wooly@example.com"; |
| 39 |
shouldBe("v.typeMismatch", "true"); |
| 40 |
i.value = "wo..oly@example.com"; |
| 41 |
shouldBe("v.typeMismatch", "true"); |
| 42 |
i.value = "pootietang.@example.com"; |
| 43 |
shouldBe("v.typeMismatch", "true"); |
| 44 |
i.value = ".@example.com"; |
| 45 |
shouldBe("v.typeMismatch", "true"); |
| 46 |
i.value = "a space@example.com"; |
| 47 |
shouldBe("v.typeMismatch", "true"); |
| 48 |
i.value = "something@ex..ample.com"; |
| 49 |
shouldBe("v.typeMismatch", "true"); |
| 50 |
i.value = "a\b@c"; |
| 51 |
shouldBe("v.typeMismatch", "true"); |
| 52 |
i.value = "someone@somewhere.com."; |
| 53 |
shouldBe("v.typeMismatch", "true"); |
| 54 |
i.value = "\"\"test\blah\"\"@example.com"; |
| 55 |
shouldBe("v.typeMismatch", "true"); |
| 56 |
i.value = "\"test\rblah\"@example.com"; |
| 57 |
shouldBe("v.typeMismatch", "true"); |
| 58 |
|
| 59 |
|
| 60 |
// VALID MULTIPLE |
| 61 |
i.multiple = true; |
| 62 |
i.value = "someone@somewhere.com,john@doe.com,a@b,a/b@c,ualla@ualla.127" |
| 63 |
shouldBe("v.typeMismatch", "false"); |
| 64 |
i.value = "some+long+email+address@some+host-weird-/looking.com,F/s/f/a@feo+re.com,m*'@'!%" |
| 65 |
shouldBe("v.typeMismatch", "false"); |
| 66 |
i.value= ",,,,,,,,,,,"; |
| 67 |
shouldBe("v.typeMismatch", "false"); |
| 68 |
|
| 69 |
// INVALID MULTIPLE (true on the first invalid occurrence) |
| 70 |
i.value = "someone@somewhere.com,john@doe..com,a@b,a/b@c,ualla@ualla.127" |
| 71 |
shouldBe("v.typeMismatch", "true"); |
| 72 |
i.value = "some+long+email+address@some+host:weird-/looking.com,F/s/f/a@feo+re.com,,m*'@'!%" |
| 73 |
shouldBe("v.typeMismatch", "true"); |
| 74 |
i.value= ",,,,,,,,, ,,"; |
| 75 |
shouldBe("v.typeMismatch", "true"); |
| 76 |
|
| 77 |
var successfullyParsed = true; |