|
1 | 1 | describe("Typing Specifications", function() { |
2 | | - var input; |
3 | | - |
4 | | - beforeEach(function(){ |
5 | | - input = |
6 | | - $("<input />") |
7 | | - .appendTo("body"); |
8 | | - }); |
9 | | - |
10 | | - afterEach(function(){ |
11 | | - input.remove(); |
12 | | - }); |
13 | | - |
14 | | - describe("with a mask containing a literal", function(){ |
15 | | - beforeEach(function(){ |
16 | | - runs(function(){ |
17 | | - input |
18 | | - .mask("9-9") |
19 | | - .focus(); |
20 | | - }); |
21 | | - waits(1); |
22 | | - }); |
23 | | - |
24 | | - describe("when typing an incomplete mask",function(){ |
25 | | - beforeEach(function(){ |
26 | | - input.mashKeys('1'); |
27 | | - }); |
28 | | - |
29 | | - it("should have the correct placeholder text", function(){ |
30 | | - expect(input).toHaveValue('1-_'); |
31 | | - }); |
32 | | - |
33 | | - it("should have the correct caret position", function(){ |
34 | | - var caret=input.caret(); |
35 | | - expect(caret.begin).toEqual(2); |
36 | | - expect(caret.end).toEqual(2); |
37 | | - }); |
38 | | - |
39 | | - describe("when blurring", function(){ |
40 | | - beforeEach(function(){ |
41 | | - input.blur(); |
42 | | - }); |
43 | | - |
44 | | - it("should have an empty value", function(){ |
45 | | - expect(input).toHaveValue(''); |
46 | | - }); |
47 | | - }); |
48 | | - }); |
49 | | - |
50 | | - describe("when typing a complete mask",function(){ |
51 | | - beforeEach(function(){ |
52 | | - input.mashKeys('16'); |
53 | | - }); |
54 | | - |
55 | | - it("should have the correct placeholder text", function(){ |
56 | | - expect(input).toHaveValue('1-6'); |
57 | | - }); |
58 | | - |
59 | | - it("should have the correct caret position", function(){ |
60 | | - var caret=input.caret(); |
61 | | - expect(caret.begin).toEqual(3); |
62 | | - expect(caret.end).toEqual(3); |
63 | | - }); |
64 | | - |
65 | | - describe("when blurring", function(){ |
66 | | - beforeEach(function(){ |
67 | | - input.blur(); |
68 | | - }); |
69 | | - |
70 | | - it("should retain the value", function(){ |
71 | | - expect(input).toHaveValue('1-6'); |
72 | | - }); |
73 | | - }); |
74 | | - }); |
75 | | - }); |
76 | 2 |
|
77 | 3 | describe("with caret position to the left of a character",function(){ |
78 | 4 | describe("when character to right matches the next mask definition",function(){ |
|
0 commit comments