-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
/
input_email_spec.js
87 lines (69 loc) · 2.68 KB
/
input_email_spec.js
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var should = require('should'),
// Stuff we are testing
input_email = require('../../../../server/apps/subscribers/lib/helpers/input_email');
describe('{{input_email}} helper', function () {
it('has input_email helper', function () {
should.exist(input_email);
});
it('returns the correct input when no custom options are specified', function () {
var markup = '<input class="subscribe-email" type="email" name="email" />',
rendered = input_email();
should.exist(rendered);
String(rendered).should.equal(markup);
});
it('returns the correct input when a custom class is specified', function () {
var markup = '<input class="test-class" type="email" name="email" />',
options = {
hash: {
class: 'test-class'
}
},
rendered = input_email(options);
should.exist(rendered);
String(rendered).should.equal(markup);
});
it('returns the correct input when an autofocus is specified', function () {
var markup = '<input class="subscribe-email" type="email" name="email" autofocus="autofocus" />',
options = {
hash: {
autofocus: true
}
},
rendered = input_email(options);
should.exist(rendered);
String(rendered).should.equal(markup);
});
it('returns the correct input when a placeholder is specified', function () {
var markup = '<input class="subscribe-email" type="email" name="email" placeholder="Test" />',
options = {
hash: {
placeholder: 'Test'
}
},
rendered = input_email(options);
should.exist(rendered);
String(rendered).should.equal(markup);
});
it('returns the correct input when a value is specified', function () {
var markup = '<input class="subscribe-email" type="email" name="email" value="Test value" />',
options = {
hash: {
value: 'Test value'
}
},
rendered = input_email(options);
should.exist(rendered);
String(rendered).should.equal(markup);
});
it('returns the correct input when an id is specified', function () {
var markup = '<input class="subscribe-email" type="email" name="email" id="test-id" />',
options = {
hash: {
id: 'test-id'
}
},
rendered = input_email(options);
should.exist(rendered);
String(rendered).should.equal(markup);
});
});