123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- export default function(qunit, $, Inputmask) {
- qunit.module("Escape character");
- qunit.test("inputmask(\"9\\|9\")", function(assert) {
- var $fixture = $("#qunit-fixture");
- $fixture.append('<input type="text" id="testmask" />');
- var testmask = document.getElementById("testmask");
- var input = $("#testmask");
- Inputmask("9\\|9").mask(testmask);
- testmask.focus();
- $("#testmask").Type("23");
- assert.equal(testmask.value, "2|3", "Result " + testmask.value);
- });
- qunit.test("inputmask(\"9\\[9\\]\")", function(assert) {
- var $fixture = $("#qunit-fixture");
- $fixture.append('<input type="text" id="testmask" />');
- var testmask = document.getElementById("testmask");
- var input = $("#testmask");
- Inputmask("9\\[9\\]").mask(testmask);
- testmask.focus();
- $("#testmask").Type("23");
- assert.equal(testmask.value, "2[3]", "Result " + testmask.value);
- });
- qunit.test("inputmask(\"9\\\\9\")", function(assert) {
- var $fixture = $("#qunit-fixture");
- $fixture.append('<input type="text" id="testmask" />');
- var testmask = document.getElementById("testmask");
- var input = $("#testmask");
- Inputmask("9\\\\9").mask(testmask);
- testmask.focus();
- $("#testmask").Type("23");
- assert.equal(testmask.value, "2\\3", "Result " + testmask.value);
- });
- qunit.test("inputmask(\"9\\{9\\}\")", function(assert) {
- var $fixture = $("#qunit-fixture");
- $fixture.append('<input type="text" id="testmask" />');
- var testmask = document.getElementById("testmask");
- Inputmask("9\\{9\\}").mask(testmask);
- testmask.focus();
- $("#testmask").Type("23");
- assert.equal(testmask.value, "2{3}", "Result " + testmask.value);
- });
- qunit.test("inputmask(\"9\\(9\\)\")", function(assert) {
- var $fixture = $("#qunit-fixture");
- $fixture.append('<input type="text" id="testmask" />');
- var testmask = document.getElementById("testmask");
- Inputmask("9\\(9\\)").mask(testmask);
- testmask.focus();
- $("#testmask").Type("23");
- assert.equal(testmask.value, "2(3)", "Result " + testmask.value);
- });
- qunit.test("inputmask(\"9\\?9\")", function(assert) {
- var $fixture = $("#qunit-fixture");
- $fixture.append('<input type="text" id="testmask" />');
- var testmask = document.getElementById("testmask");
- Inputmask("9\\?9").mask(testmask);
- testmask.focus();
- $("#testmask").Type("23");
- assert.equal(testmask.value, "2?3", "Result " + testmask.value);
- });
- qunit.test("inputmask(\"\\9999\") value not mask", function(assert) {
- var $fixture = $("#qunit-fixture");
- $fixture.append('<input type="text" value="999" id="testmask" />');
- var testmask = document.getElementById("testmask");
- Inputmask("\\9999", {
- autoUnmask: true
- }).mask(testmask);
- testmask.focus();
- assert.equal(testmask.inputmask._valueGet(), "9999", "Result " + testmask.inputmask._valueGet());
- });
- };
|