Typing.Spec.js
1.28 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
describe("Typing Specifications", function() {
describe("with caret position to the left of a character",function(){
describe("when character to right matches the next mask definition",function(){
beforeEach(function(){
runs(function(){
input
.mask("99")
.focus()
});
waits(1);
runs(function(){
input
.mashKeys("1")
.caret(0)
.mashKeys("2");
});
})
it("should shift character to the right",function(){
expect(input).toHaveValue("21");
});
it("should have correct caret position",function(){
var caret=input.caret();
expect(caret.begin).toEqual(1);
expect(caret.end).toEqual(1);
});
});
describe("when character to right does not match the next mask definition",function(){
beforeEach(function(){
runs(function(){
input
.mask("9a")
.focus()
});
waits(1);
runs(function(){
input
.mashKeys("1")
.caret(0)
.mashKeys("2");
});
})
it("should overwrite character",function(){
expect(input).toHaveValue("2_");
});
it("should have correct caret position",function(){
var caret=input.caret();
expect(caret.begin).toEqual(1);
expect(caret.end).toEqual(1);
});
});
});
});