forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform_email.js
More file actions
47 lines (42 loc) · 1.32 KB
/
form_email.js
File metadata and controls
47 lines (42 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
QUnit.test( "field type email check", assert => {
$('#forms').append('<hr>' +
'<h1>field type email check</h1>' +
'<form id="form1">' +
'</form>')
var el = $('#form1')
new App.ControllerForm({
el: el,
model: {
configure_attributes: [
{
name: 'email',
display: 'Email',
tag: 'input',
type: 'email',
limit: 100,
null: true
},
]
},
autofocus: true
});
var input = el.find('[name="email"]');
var validator = document.querySelector('input[name="email"]');
[
{ value: 'acme.corp', valid: false },
{ value: 'john.doe', valid: false },
{ value: '@acme.corp', valid: false },
{ value: 'john.doe@', valid: false },
{ value: 'john.doe@acme.corp', valid: true },
{ value: 'john.döe@acme.corp', valid: true },
{ value: 'john.doe@äcme.corp', valid: true },
{ value: 'john.döe@äcme.corp', valid: true },
{ value: 'john.doe@бах.corp', valid: true },
{ value: 'john.doe@xn--cme-pla.corp', valid: true }
].forEach(verify);
function verify(testee) {
input.val(testee.value);
valid = validator.checkValidity()
assert.equal(testee.valid, valid, testee.value)
}
});