UNPKG

alpaca

Version:

Alpaca provides the easiest and fastest way to generate interactive forms for the web and mobile devices. It runs simply as HTML5 or more elaborately using Bootstrap, jQuery Mobile or jQuery UI. Alpaca uses Handlebars to process JSON schema and provide

58 lines (52 loc) 1.31 kB
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); }); }); }); });