Skip to content
This repository was archived by the owner on Dec 11, 2017. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions spec/Focus.Spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@ feature("Leaving A Masked Input",function(){
expect(input).toHaveValue("1_");
});
});

scenario("Shifts characters left on blur with autoclear false",function(){
given("a mask with 10 placeholders",function(){
input.mask("(999) 999-9999", { autoclear: false });
});
when("focusing input",function(){
input.focus();
});
waits(20);
when("typing characters at the end of the mask and blurring",function(){
input.caret(12);
input.mashKeys("44").blur();
});
then("characters should shift left to beginning of mask",function(){
expect(input).toHaveValue("(44_) ___-____");
});
});
});

feature("Optional marker",function(){
Expand Down
1 change: 1 addition & 0 deletions src/jquery.maskedinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ $.fn.extend({
}
}
if (pos > test.length) {
clearBuffer(i + 1, len);
break;
}
} else if (buffer[i] === test.charAt(pos) && i !== partialPosition) {
Expand Down