Robin Herbots 11 年 前
コミット
07e0dc08b3

+ 1 - 1
dist/inputmask/jquery.inputmask.numeric.extensions.js

@@ -140,7 +140,7 @@
                         pos: pos,
                         remove: matchRslt.index
                     };
-                    if (pos > matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1), 
+                    if (pos >= matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1), 
                     pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
                         pos: pos,
                         remove: matchRslt.index

+ 1 - 1
dist/jquery.inputmask.bundle.js

@@ -1946,7 +1946,7 @@
                         pos: pos,
                         remove: matchRslt.index
                     };
-                    if (pos > matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1), 
+                    if (pos >= matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1), 
                     pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
                         pos: pos,
                         remove: matchRslt.index

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/jquery.inputmask.bundle.min.js


+ 1 - 1
js/jquery.inputmask.numeric.extensions.js

@@ -180,7 +180,7 @@ Optional extensions on the jquery.inputmask base
                             maskset.buffer.splice(matchRslt.index, 1);
                             pos = pos > matchRslt.index ? pos - 1 : matchRslt.index;
                             return { "pos": pos, "remove": matchRslt.index };
-                        } else if (pos > matchRslt.index && pos <= radixPosition) {
+                        } else if (pos >= matchRslt.index && pos <= radixPosition) {
                             maskset.buffer.splice(matchRslt.index, 1);
                             pos = pos > matchRslt.index ? pos - 1 : matchRslt.index;
                             return { "pos": pos, "remove": matchRslt.index };

+ 14 - 0
qunit/tests_paste.js

@@ -135,4 +135,18 @@ asyncTest("99.999.999/9999-99 numericInput ~ paste __-____/..__79100085302751__-
         start();
         $("#testmask").remove();
     }, 0);
+});
+
+asyncTest("currency ~ $123.22 - sjk07", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask('currency');
+    $("#testmask")[0].focus();
+    $("#testmask").paste("$123.22");
+
+    setTimeout(function () {
+        equal($("#testmask").val(), "$ 123.22", "Result " + $("#testmask").val());
+        start();
+        $("#testmask").remove();
+    }, 0);
 });