forked from digitalBush/jquery.maskedinput
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptional.Spec.js
More file actions
85 lines (79 loc) · 2.94 KB
/
Optional.Spec.js
File metadata and controls
85 lines (79 loc) · 2.94 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
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
feature("Optional marker",function(){
scenario("Placeholders not filled to marker",function(){
given("a mask with an optional marker",function(){
input.mask("99?99");
});
when("typing one character and leaving",function(){
input.mashKeys("1").blur();
});
then("value should be empty",function(){
expect(input).toHaveValue("");
});
});
scenario("Placeholders not filled to marker and autoclear = false", function() {
given("a mask with an optional marker",function(){
input.mask("99?99", { autoclear: false });
});
when("typing one character and leaving",function(){
input.mashKeys("1").blur();
});
then("value should be empty",function(){
expect(input).toHaveValue("1___");
});
});
scenario("Placeholders filled to marker",function(){
given("a mask with an optional marker",function(){
input.mask("99?99");
});
when("typing two characters and leaving",function(){
input.mashKeys("12").blur();
});
then("value should remain",function(){
expect(input).toHaveValue("12");
});
});
scenario("Placeholders filled to marker with literals after",function(){
given("a mask with an optional marker and literals",function(){
input.mask("99!? x 99");
});
when("typing two characters and leaving",function(){
input.mashKeys("12").blur();
});
then("value should remain",function(){
expect(input).toHaveValue("12!");
});
});
scenario("Placeholders filled to marker and autoclear = false", function() {
given("a mask with an optional marker",function(){
input.mask("99?99", { autoclear: false });
});
when("typing two characters and leaving",function(){
input.mashKeys("12").blur();
});
then("value should remain",function(){
expect(input).toHaveValue("12");
});
});
scenario("Placeholders filled, one marker filled, and autoclear = false", function() {
given("a mask with an optional marker",function(){
input.mask("99?99", { autoclear: false });
});
when("typing three characters and leaving",function(){
input.mashKeys("123").blur();
});
then("value should remain",function(){
expect(input).toHaveValue("123");
});
});
scenario("Placeholders and markers filled, and autoclear = false", function() {
given("a mask with an optional marker",function(){
input.mask("99?99", { autoclear: false });
});
when("typing four characters and leaving",function(){
input.mashKeys("1234").blur();
});
then("value should remain",function(){
expect(input).toHaveValue("1234");
});
});
});