tests_attributes.js 1.0 KB

123456789101112131415161718192021222324
  1. export default function(qunit, $, Inputmask) {
  2. qunit.module("Attribute options");
  3. qunit.test("data-inputmask=\"'alias':'integer', 'integerDigits': 3, 'allowMinus': false, 'allowPlus': false\" - StennikovDmitriy", function(assert) {
  4. var $fixture = $("#qunit-fixture");
  5. $fixture.append('<input type="text" id="testmask" data-inputmask="\'alias\':\'integer\', \'integerDigits\': 3, \'allowMinus\': false, \'allowPlus\': false" />');
  6. var testmask = document.getElementById("testmask");
  7. Inputmask().mask(testmask);
  8. $("#testmask").Type("1234.56");
  9. assert.equal(testmask.value, "123", "Result " + testmask.value);
  10. });
  11. qunit.test("data-inputmask=\"'mask':'[9-]AAA-999'\" - airomero", function(assert) {
  12. var $fixture = $("#qunit-fixture");
  13. $fixture.append('<input type="text" id="testmask" data-inputmask="\'mask\':\'[9-]AAA-999\'" />');
  14. var testmask = document.getElementById("testmask");
  15. Inputmask().mask(testmask);
  16. $("#testmask").Type("abc123");
  17. assert.equal(testmask.value, "ABC-123", "Result " + testmask.value);
  18. });
  19. };