mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Update npm and add the jquery mask
This commit is contained in:
parent
d5fab8dacf
commit
bd97e8aa6c
2799 changed files with 332053 additions and 2864 deletions
718
node_modules/jquery-mask-plugin/test/jquery.mask.test.js
generated
vendored
Normal file
718
node_modules/jquery-mask-plugin/test/jquery.mask.test.js
generated
vendored
Normal file
|
@ -0,0 +1,718 @@
|
|||
var QUNIT = true;
|
||||
$(document).ready(function(){
|
||||
|
||||
var testfield = $('.simple-field'),
|
||||
testfieldDataMask = $('.simple-field-data-mask'),
|
||||
testfieldDataMaskWithReverse = $('.simple-field-data-mask-reverse'),
|
||||
testfieldDataMaskWithClearIfNotMatch = $('.simple-field-data-mask-clearifnotmatch'),
|
||||
testfieldDataMaskWithClearIfNotMatchAndOptionalMask = $('.simple-field-data-mask-clearifnotmatch-and-optional-mask'),
|
||||
testdiv = $('.simple-div'),
|
||||
typeTest = function (typedValue, obj) {
|
||||
obj = typeof obj === "undefined" ? testfield : obj;
|
||||
|
||||
return obj.keydown().val(typedValue).trigger('input').val();
|
||||
},
|
||||
typeDivTest = function(typedValue){
|
||||
return testdiv.keydown().text(typedValue).trigger('input').text();
|
||||
};
|
||||
|
||||
module('Setting Up');
|
||||
test("test if the mask method exists after plugin insertion", function() {
|
||||
equal( typeof testfield.mask , "function" , "mask function should exists" );
|
||||
});
|
||||
|
||||
module('Simple Masks');
|
||||
test("Masks with only numbers.", function(){
|
||||
testfield.mask('000000');
|
||||
|
||||
equal( typeTest("1."), "1");
|
||||
equal( typeTest('1éáa2aaaaqwo'), "12");
|
||||
equal( typeTest('1234567'), "123456");
|
||||
|
||||
});
|
||||
|
||||
test("When I change the mask on-the-fly things should work normally", function(){
|
||||
testfield.mask('0000.0000');
|
||||
|
||||
equal( typeTest("1."), "1");
|
||||
equal( typeTest('1éáa2aaaaqwo'), "12");
|
||||
equal( typeTest('1234567'), "1234.567");
|
||||
|
||||
// changing on-the-fly
|
||||
testfield.mask('0.000.000');
|
||||
|
||||
equal( typeTest("1."), "1.");
|
||||
equal( typeTest('1éáa2aaaaqwo'), "1.2");
|
||||
equal( typeTest('1234567'), "1.234.567");
|
||||
|
||||
});
|
||||
|
||||
test("When I change the mask on-the-fly with onChange callback things should work normally", function(){
|
||||
|
||||
var masks = ['0000.00009', '0.0000.0000'];
|
||||
var SPphoneMask = function(phone){
|
||||
return phone.length <= 9 ? masks[0] : masks[1];
|
||||
};
|
||||
|
||||
testfield.mask(SPphoneMask, {onChange: function(phone, e, currentField, options){
|
||||
$(currentField).mask(SPphoneMask(phone), options);
|
||||
}});
|
||||
|
||||
equal( typeTest("1"), "1");
|
||||
equal( typeTest("12"), "12");
|
||||
equal( typeTest("123"), "123");
|
||||
equal( typeTest("1234"), "1234");
|
||||
equal( typeTest("12345"), "1234.5");
|
||||
equal( typeTest("123456"), "1234.56");
|
||||
equal( typeTest("1234567"), "1234.567");
|
||||
equal( typeTest("12345678"), "1234.5678");
|
||||
equal( typeTest("123456789"), "1.2345.6789");
|
||||
|
||||
});
|
||||
|
||||
test("When I change the mask on-the-fly with onKeyPress callback things should work normally", function(){
|
||||
|
||||
var masks = ['0000.00009', '0.0000.0000'];
|
||||
var SPphoneMask = function(phone){
|
||||
return phone.length <= 9 ? masks[0] : masks[1];
|
||||
};
|
||||
|
||||
testfield.mask(SPphoneMask, {onKeyPress: function(phone, e, currentField, options){
|
||||
$(currentField).mask(SPphoneMask(phone), options);
|
||||
}});
|
||||
|
||||
equal( typeTest("1"), "1");
|
||||
equal( typeTest("12"), "12");
|
||||
equal( typeTest("123"), "123");
|
||||
equal( typeTest("1234"), "1234");
|
||||
equal( typeTest("12345"), "1234.5");
|
||||
equal( typeTest("123456"), "1234.56");
|
||||
equal( typeTest("1234567"), "1234.567");
|
||||
equal( typeTest("12345678"), "1234.5678");
|
||||
equal( typeTest("123456789"), "1.2345.6789");
|
||||
|
||||
});
|
||||
|
||||
test("#onInvalid callback. should call when invalid", function(){
|
||||
testfield.mask('00/00/0000', {onInvalid: function(val, e, el, invalid, options){
|
||||
equal(val, "1")
|
||||
equal(typeof e, "object")
|
||||
equal(typeof el, "object")
|
||||
equal(invalid.length, 1);
|
||||
equal(invalid[0]["e"], "/\\d/");
|
||||
equal(invalid[0]["p"], 1);
|
||||
equal(invalid[0]["v"], "a");
|
||||
equal(typeof options.onInvalid, "function");
|
||||
}});
|
||||
|
||||
equal( typeTest("1a") , "1");
|
||||
});
|
||||
|
||||
test("#onInvalid callback. should not call when valid", function(){
|
||||
var callback = sinon.spy();
|
||||
testfield.mask('00/00/0000', {onInvalid: callback});
|
||||
|
||||
equal( typeTest("11") , "11");
|
||||
equal(callback.called, false)
|
||||
});
|
||||
|
||||
test('When I typed a char thats the same as the mask char', function(){
|
||||
testfield.unmask();
|
||||
testfield.mask('00/00/0000');
|
||||
|
||||
equal( typeTest("00/"), "00/");
|
||||
equal( typeTest("00a"), "00/");
|
||||
equal( typeTest("00a00/00"), "00/00/00");
|
||||
equal( typeTest("0a/00/00"), "00/00/0");
|
||||
equal( typeTest("0a/0a/00"), "00/00");
|
||||
|
||||
});
|
||||
|
||||
test('When I typed exactly the same as the mask', function(){
|
||||
testfield.mask('00/00/0000');
|
||||
equal( typeTest("00"), "00");
|
||||
equal( typeTest("00/"), "00/");
|
||||
equal( typeTest("aa/"), "");
|
||||
equal( typeTest("00/0"), "00/0");
|
||||
equal( typeTest("00/00"), "00/00");
|
||||
equal( typeTest("00/00/0"), "00/00/0");
|
||||
equal( typeTest("00/00/00"), "00/00/00");
|
||||
});
|
||||
|
||||
test("Testing masks with a literal on the last char", function () {
|
||||
testfield.mask("(99)");
|
||||
|
||||
equal( typeTest("(99"), "(99)");
|
||||
});
|
||||
|
||||
|
||||
module('Masks with numbers and especial characters');
|
||||
|
||||
test("Masks with numbers and special characters.", function(){
|
||||
testfield.mask('(000) 000-0000');
|
||||
|
||||
equal( typeTest("1"), "(1");
|
||||
equal( typeTest('12'), "(12");
|
||||
equal( typeTest('123'), "(123");
|
||||
equal( typeTest('1234'), "(123) 4");
|
||||
equal( typeTest('12345'), "(123) 45");
|
||||
equal( typeTest('(123) 456'), "(123) 456");
|
||||
equal( typeTest('(123) 4567'), "(123) 456-7");
|
||||
|
||||
});
|
||||
|
||||
test("Testing masks with a annonymous function", function(){
|
||||
testfield.mask(function(){
|
||||
return "(123) 456-7899"
|
||||
});
|
||||
|
||||
equal( typeTest("1"), "(1");
|
||||
equal( typeTest('12'), "(12");
|
||||
equal( typeTest('123'), "(123");
|
||||
equal( typeTest('1234'), "(123) 4");
|
||||
equal( typeTest('12345'), "(123) 45");
|
||||
equal( typeTest('123456'), "(123) 456");
|
||||
equal( typeTest('1234567'), "(123) 456-7");
|
||||
|
||||
});
|
||||
|
||||
test("Masks with numbers, strings e special characters", function(){
|
||||
testfield.mask('(999) A99-SSSS');
|
||||
|
||||
equal( typeTest("(1"), "(1");
|
||||
equal( typeTest('(12'), "(12");
|
||||
equal( typeTest('(123'), "(123");
|
||||
equal( typeTest('(123) 4'), "(123) 4");
|
||||
equal( typeTest('(123) A'), "(123) A");
|
||||
equal( typeTest('123.'), "(123) ");
|
||||
equal( typeTest('(123) 45'), "(123) 45");
|
||||
equal( typeTest('(123) 456'), "(123) 456");
|
||||
equal( typeTest('(123) 456-A'), "(123) 456-A");
|
||||
equal( typeTest('(123) 456-AB'), "(123) 456-AB");
|
||||
equal( typeTest('(123) 456-ABC'), "(123) 456-ABC");
|
||||
equal( typeTest('(123) 456-ABCD'), "(123) 456-ABCD");
|
||||
equal( typeTest('(123) 456-ABCDE'), "(123) 456-ABCD");
|
||||
equal( typeTest('(123) 456-ABCD1'), "(123) 456-ABCD");
|
||||
|
||||
});
|
||||
|
||||
test("Masks with numbers, strings e special characters #2 ", function(){
|
||||
testfield.mask('AAA 000-S0S');
|
||||
|
||||
equal( typeTest("1"), "1");
|
||||
equal( typeTest('12'), "12");
|
||||
equal( typeTest('123'), "123");
|
||||
equal( typeTest('123 4'), "123 4");
|
||||
equal( typeTest('123 45'), "123 45");
|
||||
equal( typeTest('123 456'), "123 456");
|
||||
equal( typeTest('123 456-7'), "123 456-");
|
||||
|
||||
});
|
||||
|
||||
module("Testing Reversible Masks");
|
||||
|
||||
test("Testing a CPF Mask", function(){
|
||||
testfield.mask('000.000.000-00', {reverse: true});
|
||||
|
||||
equal( typeTest("1"), "1");
|
||||
equal( typeTest("12"), "12");
|
||||
equal( typeTest("123"), "1-23");
|
||||
equal( typeTest("12-34"), "12-34");
|
||||
equal( typeTest("123-45"), "123-45");
|
||||
equal( typeTest("1.234-56"), "1.234-56");
|
||||
equal( typeTest("12.345-67"), "12.345-67");
|
||||
equal( typeTest("123.456-78"), "123.456-78");
|
||||
equal( typeTest("1.234.567-89"), "1.234.567-89");
|
||||
equal( typeTest("12.345.678-90"), "12.345.678-90");
|
||||
equal( typeTest("123.456.789-00"), "123.456.789-00");
|
||||
equal( typeTest("123.456.789-00"), "123.456.789-00");
|
||||
|
||||
equal( typeTest("123.456.789a00"), "123.456.789-00");
|
||||
equal( typeTest("123-a5"), "12-35");
|
||||
|
||||
equal( typeTest("1"), "1");
|
||||
equal( typeTest("12"), "12");
|
||||
equal( typeTest("1-23"), "1-23");
|
||||
equal( typeTest("12-34"), "12-34");
|
||||
equal( typeTest("12-345"), "123-45");
|
||||
equal( typeTest("1.234-56"), "1.234-56");
|
||||
equal( typeTest("12.345-67"), "12.345-67");
|
||||
equal( typeTest("123.456-78"), "123.456-78");
|
||||
equal( typeTest("1.234.567-89"), "1.234.567-89");
|
||||
equal( typeTest("12.345.678-90"), "12.345.678-90");
|
||||
equal( typeTest("123.456.789-00"), "123.456.789-00");
|
||||
equal( typeTest("123.456.789-00"), "123.456.789-00");
|
||||
equal( typeTest("123.456.789a00"), "123.456.789-00");
|
||||
});
|
||||
|
||||
test("Testing Reverse numbers with recursive mask", function(){
|
||||
testfield.mask("#.##0,00", {reverse: true});
|
||||
|
||||
equal(typeTest(""), "");
|
||||
equal(typeTest("1"), "1");
|
||||
equal(typeTest("12"), "12");
|
||||
equal(typeTest("123"), "1,23");
|
||||
equal(typeTest("1,234"), "12,34");
|
||||
equal(typeTest("12,345"), "123,45");
|
||||
equal(typeTest("123,456"), "1.234,56");
|
||||
equal(typeTest("1.234,567"), "12.345,67");
|
||||
equal(typeTest("12.345,678"), "123.456,78");
|
||||
equal(typeTest("123.456,789"), "1.234.567,89");
|
||||
equal(typeTest("1.234.567,890"), "12.345.678,90");
|
||||
equal(typeTest("12.345.678,901"), "123.456.789,01");
|
||||
equal(typeTest("123.456.789,012"), "1.234.567.890,12");
|
||||
equal(typeTest("1.234.567.890,1"), "123.456.789,01");
|
||||
equal(typeTest("123.456.789,0"), "12.345.678,90");
|
||||
equal(typeTest("12.345.678,9"), "1.234.567,89");
|
||||
equal(typeTest("1.234.567,8"), "123.456,78");
|
||||
});
|
||||
|
||||
test("Testing numbers with recursive mask", function(){
|
||||
testfield.mask("0#.#");
|
||||
|
||||
equal(typeTest(""), "");
|
||||
equal(typeTest("1"), "1");
|
||||
equal(typeTest("12"), "12");
|
||||
equal(typeTest("12."), "12.");
|
||||
equal(typeTest("12.3"), "12.3");
|
||||
equal(typeTest("12.34"), "12.34");
|
||||
equal(typeTest("12.345"), "12.34.5");
|
||||
equal(typeTest("12.34.5."), "12.34.5");
|
||||
equal(typeTest("12.34.56"), "12.34.56");
|
||||
equal(typeTest("12.34.567"), "12.34.56.7");
|
||||
equal(typeTest("12.34.56."), "12.34.56.");
|
||||
equal(typeTest("12.34.56"), "12.34.56");
|
||||
equal(typeTest("12.34.5"), "12.34.5");
|
||||
});
|
||||
|
||||
test("Testing numbers with recursive mask with one #", function(){
|
||||
testfield.mask("0#", {});
|
||||
|
||||
equal(typeTest(""), "");
|
||||
equal(typeTest("1"), "1");
|
||||
equal(typeTest("12"), "12");
|
||||
equal(typeTest("123"), "123");
|
||||
equal(typeTest("1234"), "1234");
|
||||
equal(typeTest("12345"), "12345");
|
||||
equal(typeTest("12345"), "12345");
|
||||
equal(typeTest("123456"), "123456");
|
||||
equal(typeTest("1234567"), "1234567");
|
||||
equal(typeTest("123456."), "123456");
|
||||
equal(typeTest("123456"), "123456");
|
||||
equal(typeTest("12345"), "12345");
|
||||
});
|
||||
test("Testing numbers with recursive mask with one # and reverse", function(){
|
||||
testfield.mask("#0", {reverse: true});
|
||||
|
||||
equal(typeTest(""), "");
|
||||
equal(typeTest("1"), "1");
|
||||
equal(typeTest("12"), "12");
|
||||
equal(typeTest("123"), "123");
|
||||
equal(typeTest("1234"), "1234");
|
||||
equal(typeTest("12345"), "12345");
|
||||
equal(typeTest("12345"), "12345");
|
||||
equal(typeTest("123456"), "123456");
|
||||
equal(typeTest("1234567"), "1234567");
|
||||
equal(typeTest("123456."), "123456");
|
||||
equal(typeTest("123456"), "123456");
|
||||
equal(typeTest("12345"), "12345");
|
||||
});
|
||||
test("Testing reversible masks with a literal on the last char", function () {
|
||||
testfield.mask("(99)");
|
||||
|
||||
equal( typeTest("(99"), "(99)");
|
||||
});
|
||||
|
||||
module('Removing mask');
|
||||
|
||||
test("when I get the unmasked value", function(){
|
||||
testfield.mask('(00) 0000-0000', { placeholder: '(__) ____-____' });
|
||||
|
||||
equal(typeTest("1299999999"), "(12) 9999-9999");
|
||||
testfield.unmask()
|
||||
equal(testfield.val(), "1299999999");
|
||||
|
||||
if (window.Zepto) {
|
||||
equal(testfield.attr('placeholder'), '');
|
||||
equal(testfield.attr('maxlength'), null);
|
||||
} else {
|
||||
equal(testfield.attr('placeholder'), undefined);
|
||||
equal(testfield.attr('maxlength'), undefined);
|
||||
}
|
||||
});
|
||||
|
||||
module('Getting Unmasked Value');
|
||||
|
||||
test("when I get the unmasked value", function(){
|
||||
testfield.mask('(00) 0000-0000');
|
||||
|
||||
equal( typeTest("1299999999"), "(12) 9999-9999");
|
||||
equal( testfield.cleanVal(), "1299999999");
|
||||
});
|
||||
|
||||
test("when I get the unmasked value with recursive mask", function(){
|
||||
testfield.mask('#.##0,00', {reverse:true});
|
||||
|
||||
equal( typeTest("123123123123123123", testfield), "1.231.231.231.231.231,23");
|
||||
equal( testfield.cleanVal(), "123123123123123123");
|
||||
});
|
||||
|
||||
module('Masking a value programmatically');
|
||||
|
||||
test("when I get the masked value programmatically", function(){
|
||||
testfield.mask('(00) 0000-0000');
|
||||
typeTest("1299999999", testfield);
|
||||
equal( testfield.masked("3488888888"), "(34) 8888-8888");
|
||||
});
|
||||
|
||||
module('personalized settings')
|
||||
|
||||
test("when adding more itens to the table translation",function(){
|
||||
testfield.mask('00/00/0000', {'translation': {0: {pattern: /[0-9*]/}}});
|
||||
|
||||
equal( typeTest('12/34/5678'), '12/34/5678');
|
||||
equal( typeTest('**/34/5678'), '**/34/5678');
|
||||
});
|
||||
|
||||
test("when adding more itens to the table translation #2",function(){
|
||||
testfield.mask('00/YY/0000', {'translation': {'Y': {pattern: /[0-9*]/}}});
|
||||
|
||||
equal( typeTest('12/34/5678'), '12/34/5678');
|
||||
equal( typeTest('12/**/5678'), '12/**/5678');
|
||||
});
|
||||
|
||||
test("when adding more itens to the table translation #3",function(){
|
||||
var old_translation = $.jMaskGlobals.translation
|
||||
$.jMaskGlobals.translation = {
|
||||
'1': {pattern: /\d/},
|
||||
'9': {pattern: /\d/, optional: true},
|
||||
'#': {pattern: /\d/, recursive: true},
|
||||
'A': {pattern: /[a-zA-Z0-9]/},
|
||||
'S': {pattern: /[a-zA-Z]/}
|
||||
};
|
||||
|
||||
testfield.mask('00/11/1111');
|
||||
|
||||
equal( typeTest('12/12/5678'), '00/12/1256');
|
||||
|
||||
testfield.mask('11/00/1111');
|
||||
equal( typeTest('12/12/5678'), '12/00/1256');
|
||||
|
||||
$.jMaskGlobals.translation = old_translation;
|
||||
});
|
||||
|
||||
test("when adding more itens to the table translation #fallback",function(){
|
||||
testfield.mask('zz/z0/0000', {'translation': {'z': {pattern: /[0-9*]/, fallback: '*'}}});
|
||||
|
||||
equal( typeTest('12/:4/5678'), '12/*4/5678');
|
||||
equal( typeTest('::/:4/5678'), '**/*4/5678');
|
||||
});
|
||||
|
||||
test("test the translation #fallback #1" , function(){
|
||||
testfield.mask('00t00', {'translation': {'t': {pattern: /[:,.]/, fallback: ':'}}});
|
||||
|
||||
equal( typeTest('1'), '1');
|
||||
equal( typeTest('13'), '13');
|
||||
equal( typeTest('137'), '13:7');
|
||||
equal( typeTest('1337'), '13:37');
|
||||
equal( typeTest('13z00'), '13:00');
|
||||
});
|
||||
|
||||
test("test the translation #fallback #2" , function(){
|
||||
testfield.mask('00/t0/t0', {'translation': {'t': {pattern: /[:,.*]/, fallback: '*'}}});
|
||||
|
||||
equal( typeTest('1'), '1');
|
||||
equal( typeTest('13'), '13');
|
||||
equal( typeTest('13/'), '13/');
|
||||
equal( typeTest('13/a'), '13/*');
|
||||
equal( typeTest('13/a1z1'), '13/*1/*1');
|
||||
});
|
||||
|
||||
test("test the translation #fallback #3" , function(){
|
||||
testfield.mask('tt/00/00', {'translation': {'t': {pattern: /[:,.*]/, fallback: '*'}}});
|
||||
|
||||
equal( typeTest('*'), '*');
|
||||
equal( typeTest('13'), '**/13');
|
||||
equal( typeTest('13/'), '**/13/');
|
||||
equal( typeTest('13/a'), '**/13/');
|
||||
equal( typeTest('13/a1z1'), '**/13/11');
|
||||
});
|
||||
|
||||
test("when adding opcional chars",function(){
|
||||
testfield.mask('099.099.099.099');
|
||||
|
||||
equal( typeTest('0.0.0.0'), '0.0.0.0');
|
||||
equal( typeTest('00.00.00.00'), '00.00.00.00');
|
||||
equal( typeTest('00.000.00.000'), '00.000.00.000');
|
||||
equal( typeTest('000.00.000.00'), '000.00.000.00');
|
||||
equal( typeTest('000.000.000.000'), '000.000.000.000');
|
||||
equal( typeTest('000000000000'), '000.000.000.000');
|
||||
equal( typeTest('0'), '0');
|
||||
equal( typeTest('00'), '00');
|
||||
equal( typeTest('00.'), '00.');
|
||||
equal( typeTest('00.0'), '00.0');
|
||||
equal( typeTest('00.00'), '00.00');
|
||||
equal( typeTest('00.00.'), '00.00.');
|
||||
equal( typeTest('00.00.000'), '00.00.000');
|
||||
equal( typeTest('00.00.000.'), '00.00.000.');
|
||||
equal( typeTest('00.00.000.0'), '00.00.000.0');
|
||||
equal( typeTest('00..'), '00.');
|
||||
});
|
||||
|
||||
test("when aplying mask on a element different than a form field",function(){
|
||||
testdiv.mask('000.000.000-00', {reverse: true});
|
||||
|
||||
equal( typeDivTest('12312312312'), '123.123.123-12');
|
||||
equal( typeDivTest('123.123.123-12'), '123.123.123-12');
|
||||
equal( typeDivTest('123.123a123-12'), '123.123.123-12');
|
||||
equal( typeDivTest('191'), '1-91');
|
||||
|
||||
testdiv.mask('00/00/0000');
|
||||
equal( typeDivTest('000000'), '00/00/00');
|
||||
equal( typeDivTest('00000000'), '00/00/0000');
|
||||
equal( typeDivTest('00/00/0000'), '00/00/0000');
|
||||
equal( typeDivTest('0a/00/0000'), '00/00/000');
|
||||
|
||||
});
|
||||
|
||||
module('Testing data-mask attribute support');
|
||||
|
||||
test("Testing data-mask attribute", function(){
|
||||
equal( typeTest("00/", testfieldDataMask), "00/");
|
||||
equal( typeTest("00a", testfieldDataMask), "00/");
|
||||
equal( typeTest("00a00/00", testfieldDataMask), "00/00/00");
|
||||
equal( typeTest("0a/00/00", testfieldDataMask), "00/00/0");
|
||||
equal( typeTest("0a/0a/00", testfieldDataMask), "00/00");
|
||||
equal( typeTest("00000000", testfieldDataMask), "00/00/0000");
|
||||
});
|
||||
|
||||
test("Testing data-mask-reverse attribute", function(){
|
||||
equal( typeTest("0000", testfieldDataMaskWithReverse), "00,00");
|
||||
equal( typeTest("000000", testfieldDataMaskWithReverse), "0.000,00");
|
||||
equal( typeTest("0000000000", testfieldDataMaskWithReverse), "00.000.000,00");
|
||||
});
|
||||
|
||||
module('Event fire test');
|
||||
|
||||
// TODO: need to understand why zepto.js isnt calling change event!
|
||||
if(!window.Zepto) {
|
||||
test('onChange Test', 2, function(){
|
||||
testfield.unmask();
|
||||
|
||||
var callback = sinon.spy();
|
||||
var mock = sinon.mock()
|
||||
var typeAndBlur = function(typedValue){
|
||||
testfield.trigger('keydown');
|
||||
testfield.val(typedValue);
|
||||
testfield.trigger('input');
|
||||
testfield.trigger("blur");
|
||||
};
|
||||
|
||||
testfield.mask('000.(000).000/0-0');
|
||||
|
||||
testfield.on("change", callback);
|
||||
|
||||
typeAndBlur("");
|
||||
typeAndBlur("1");
|
||||
typeAndBlur("12");
|
||||
typeAndBlur("123");
|
||||
typeAndBlur("1234");
|
||||
typeAndBlur("12345");
|
||||
typeAndBlur("123456");
|
||||
typeAndBlur("1234567");
|
||||
typeAndBlur("12345678");
|
||||
typeAndBlur("123456789");
|
||||
typeAndBlur("123456789");
|
||||
typeAndBlur("1234567891");
|
||||
typeAndBlur("12345678912");
|
||||
|
||||
equal(testfield.val(), "123.(456).789/1-2" );
|
||||
equal(true, sinon.match(11).or(12).test(callback.callCount))
|
||||
|
||||
testfield.off("change");
|
||||
testfield.unmask();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
test('onDrop Test', function(){
|
||||
ok(true, "todo");
|
||||
});
|
||||
|
||||
module('testing Remove If Not Match Feature');
|
||||
|
||||
test('test when clearifnotmatch javascript notation', 4, function(){
|
||||
var typeAndFocusOut = function(typedValue){
|
||||
testfield.keydown().val(typedValue).trigger('input');
|
||||
testfield.trigger("focusout");
|
||||
};
|
||||
|
||||
testfield.mask('000');
|
||||
|
||||
typeAndFocusOut("1");
|
||||
equal( testfield.val(), "1" );
|
||||
|
||||
testfield.mask('000', {clearIfNotMatch: true});
|
||||
|
||||
typeAndFocusOut("1");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndFocusOut("12");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndFocusOut("123");
|
||||
equal( testfield.val(), "123" );
|
||||
});
|
||||
|
||||
test('test when clearifnotmatch javascript notation #2', 4, function(){
|
||||
var typeAndFocusOut = function(typedValue){
|
||||
testfield.keydown().val(typedValue).trigger('input');
|
||||
testfield.trigger("focusout");
|
||||
};
|
||||
|
||||
testfield.mask('7 (000) 000-0000');
|
||||
|
||||
typeAndFocusOut("1");
|
||||
equal( testfield.val(), "7 (1" );
|
||||
|
||||
testfield.mask('7 (000) 000-0000', {clearIfNotMatch: true});
|
||||
|
||||
typeAndFocusOut("1");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndFocusOut("12");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndFocusOut("7 (123) 123-1234");
|
||||
equal( testfield.val(), "7 (123) 123-1234" );
|
||||
});
|
||||
|
||||
test('test when clearifnotmatch is HTML notation', 3, function(){
|
||||
var typeAndFocusOut = function(typedValue){
|
||||
testfieldDataMaskWithClearIfNotMatch.keydown().val(typedValue).trigger('input');
|
||||
testfieldDataMaskWithClearIfNotMatch.trigger("focusout");
|
||||
};
|
||||
|
||||
typeAndFocusOut("1");
|
||||
equal( testfieldDataMaskWithClearIfNotMatch.val(), "" );
|
||||
|
||||
typeAndFocusOut("12");
|
||||
equal( testfieldDataMaskWithClearIfNotMatch.val(), "" );
|
||||
|
||||
typeAndFocusOut("123");
|
||||
equal( testfieldDataMaskWithClearIfNotMatch.val(), "123" );
|
||||
});
|
||||
|
||||
module('testing Remove If Not Match Feature');
|
||||
|
||||
test('test when clearifnotmatch javascript notation', 1, function(){
|
||||
|
||||
testfield.mask('000', {placeholder: '___'});
|
||||
equal( testfield.attr('placeholder'), "___" );
|
||||
|
||||
});
|
||||
|
||||
test('test when clearifnotmatch with optional mask', 9, function(){
|
||||
// html notation
|
||||
var typeAndBlur = function(field, typedValue){
|
||||
field.keydown().val(typedValue).trigger('input');
|
||||
field.trigger("focusout");
|
||||
};
|
||||
|
||||
typeAndBlur(testfieldDataMaskWithClearIfNotMatchAndOptionalMask, "1");
|
||||
equal( testfieldDataMaskWithClearIfNotMatchAndOptionalMask.val(), "" );
|
||||
|
||||
typeAndBlur(testfieldDataMaskWithClearIfNotMatchAndOptionalMask, "12");
|
||||
equal( testfieldDataMaskWithClearIfNotMatchAndOptionalMask.val(), "12" );
|
||||
|
||||
typeAndBlur(testfieldDataMaskWithClearIfNotMatchAndOptionalMask, "123");
|
||||
equal( testfieldDataMaskWithClearIfNotMatchAndOptionalMask.val(), "123" );
|
||||
|
||||
// javascript notation
|
||||
testfield.mask('099.099.099.099', {clearIfNotMatch: true});
|
||||
|
||||
typeAndBlur(testfield, "1");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndBlur(testfield, "123.");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndBlur(testfield, "123.0");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndBlur(testfield, "123.01.000.");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndBlur(testfield, "123.01.000.123");
|
||||
equal( testfield.val(), "123.01.000.123" );
|
||||
|
||||
typeAndBlur(testfield, "0.0.0.0");
|
||||
equal( testfield.val(), "0.0.0.0" );
|
||||
});
|
||||
|
||||
test('test when clearifnotmatch with recursive mask', 4, function(){
|
||||
// html notation
|
||||
var typeAndBlur = function(field, typedValue){
|
||||
field.keydown().val(typedValue).trigger('input');
|
||||
field.trigger("focusout");
|
||||
};
|
||||
|
||||
// javascript notation
|
||||
testfield.mask('#.##0,00', {clearIfNotMatch: true, reverse: true});
|
||||
|
||||
typeAndBlur(testfield, "0");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndBlur(testfield, "00");
|
||||
equal( testfield.val(), "" );
|
||||
|
||||
typeAndBlur(testfield, "0,00");
|
||||
equal( testfield.val(), "0,00" );
|
||||
|
||||
typeAndBlur(testfield, "1.000,00");
|
||||
equal( testfield.val(), "1.000,00" );
|
||||
|
||||
});
|
||||
|
||||
module('dynamically loaded elements')
|
||||
test('#non-inputs', function(){
|
||||
expect(5);
|
||||
|
||||
var $container = $('#container-dy-non-inputs');
|
||||
var clock = this.clock;
|
||||
var ticker;
|
||||
var tester;
|
||||
var c = 0;
|
||||
|
||||
function write() {
|
||||
|
||||
if (c >= 5) {
|
||||
clearInterval(ticker);
|
||||
clearInterval(tester);
|
||||
return;
|
||||
}
|
||||
|
||||
c++;
|
||||
|
||||
$container.append('<div class="c">' + c + c + c + c + '</div>');
|
||||
clock.tick(1000);
|
||||
};
|
||||
|
||||
function testIt() {
|
||||
|
||||
var cs = $container.find('.c');
|
||||
$.each(cs, function(k, field){
|
||||
var t = k + 1;
|
||||
equal($(field).text(), '' + t + t + ':' + t + t);
|
||||
t++;
|
||||
});
|
||||
};
|
||||
|
||||
ticker = setInterval(write, 1000);
|
||||
|
||||
write();
|
||||
$('.c', $container).mask('00:00');
|
||||
testIt()
|
||||
});
|
||||
});
|
244
node_modules/jquery-mask-plugin/test/qunit.css
generated
vendored
Normal file
244
node_modules/jquery-mask-plugin/test/qunit.css
generated
vendored
Normal file
|
@ -0,0 +1,244 @@
|
|||
/**
|
||||
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://qunitjs.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699a4;
|
||||
background-color: #0d3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: normal;
|
||||
|
||||
border-radius: 5px 5px 0 0;
|
||||
-moz-border-radius: 5px 5px 0 0;
|
||||
-webkit-border-top-right-radius: 5px;
|
||||
-webkit-border-top-left-radius: 5px;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #c2ccd1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar label {
|
||||
display: inline-block;
|
||||
padding: 0 .5em 0 .1em;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 0 0.5em 2em;
|
||||
color: #5E740B;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
#qunit-modulefilter-container {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li a {
|
||||
padding: 0.5em;
|
||||
color: #c2ccd1;
|
||||
text-decoration: none;
|
||||
}
|
||||
#qunit-tests li a:hover,
|
||||
#qunit-tests li a:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#qunit-tests li .runtime {
|
||||
float: right;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.qunit-assert-list {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
.qunit-collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 .5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #e0f2be;
|
||||
color: #374e0c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #ffcaca;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts { color: black; }
|
||||
#qunit-tests b.passed { color: #5E740B; }
|
||||
#qunit-tests b.failed { color: #710909; }
|
||||
|
||||
#qunit-tests li li {
|
||||
padding: 5px;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #3c510c;
|
||||
background-color: #fff;
|
||||
border-left: 10px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests .pass .test-name { color: #366097; }
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected { color: #999999; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 10px solid #EE5757;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#qunit-tests > li:last-child {
|
||||
border-radius: 0 0 5px 5px;
|
||||
-moz-border-radius: 0 0 5px 5px;
|
||||
-webkit-border-bottom-right-radius: 5px;
|
||||
-webkit-border-bottom-left-radius: 5px;
|
||||
}
|
||||
|
||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name { color: #000000; }
|
||||
|
||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
||||
#qunit-tests .fail .test-expected { color: green; }
|
||||
|
||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
||||
|
||||
|
||||
/** Result */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
#qunit-testresult .module-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
}
|
2152
node_modules/jquery-mask-plugin/test/qunit.js
generated
vendored
Normal file
2152
node_modules/jquery-mask-plugin/test/qunit.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
5073
node_modules/jquery-mask-plugin/test/sinon-1.10.3.js
generated
vendored
Normal file
5073
node_modules/jquery-mask-plugin/test/sinon-1.10.3.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
62
node_modules/jquery-mask-plugin/test/sinon-qunit-1.0.0.js
generated
vendored
Normal file
62
node_modules/jquery-mask-plugin/test/sinon-qunit-1.0.0.js
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* sinon-qunit 1.0.0, 2010/12/09
|
||||
*
|
||||
* @author Christian Johansen (christian@cjohansen.no)
|
||||
*
|
||||
* (The BSD License)
|
||||
*
|
||||
* Copyright (c) 2010-2011, Christian Johansen, christian@cjohansen.no
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of Christian Johansen nor the names of his contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*global sinon, QUnit, test*/
|
||||
sinon.assert.fail = function (msg) {
|
||||
QUnit.ok(false, msg);
|
||||
};
|
||||
|
||||
sinon.assert.pass = function (assertion) {
|
||||
QUnit.ok(true, assertion);
|
||||
};
|
||||
|
||||
sinon.config = {
|
||||
injectIntoThis: true,
|
||||
injectInto: null,
|
||||
properties: ["spy", "stub", "mock", "clock", "sandbox"],
|
||||
useFakeTimers: true,
|
||||
useFakeServer: false
|
||||
};
|
||||
|
||||
(function (global) {
|
||||
var qTest = QUnit.test;
|
||||
|
||||
QUnit.test = global.test = function (testName, expected, callback, async) {
|
||||
if (arguments.length === 2) {
|
||||
callback = expected;
|
||||
expected = null;
|
||||
}
|
||||
|
||||
return qTest(testName, expected, sinon.test(callback), async);
|
||||
};
|
||||
}(this));
|
62
node_modules/jquery-mask-plugin/test/sinon-qunit.js
generated
vendored
Normal file
62
node_modules/jquery-mask-plugin/test/sinon-qunit.js
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* sinon-qunit 1.0.0, 2010/12/09
|
||||
*
|
||||
* @author Christian Johansen (christian@cjohansen.no)
|
||||
*
|
||||
* (The BSD License)
|
||||
*
|
||||
* Copyright (c) 2010-2011, Christian Johansen, christian@cjohansen.no
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of Christian Johansen nor the names of his contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*global sinon, QUnit, test*/
|
||||
sinon.assert.fail = function (msg) {
|
||||
QUnit.ok(false, msg);
|
||||
};
|
||||
|
||||
sinon.assert.pass = function (assertion) {
|
||||
QUnit.ok(true, assertion);
|
||||
};
|
||||
|
||||
sinon.config = {
|
||||
injectIntoThis: true,
|
||||
injectInto: null,
|
||||
properties: ["spy", "stub", "mock", "clock", "sandbox"],
|
||||
useFakeTimers: true,
|
||||
useFakeServer: false
|
||||
};
|
||||
|
||||
(function (global) {
|
||||
var qTest = QUnit.test;
|
||||
|
||||
QUnit.test = global.test = function (testName, expected, callback, async) {
|
||||
if (arguments.length === 2) {
|
||||
callback = expected;
|
||||
expected = null;
|
||||
}
|
||||
|
||||
return qTest(testName, expected, sinon.test(callback), async);
|
||||
};
|
||||
}(this));
|
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.11.1.html
generated
vendored
Normal file
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.11.1.html
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>jQuery-Mask-Plugin UnitTesting</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery-Mask-Plugin QUnit Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- testing area -->
|
||||
<input class="simple-field" type="text" />
|
||||
<input class="simple-field-data-mask" type="text" data-mask="00/00/0000"/>
|
||||
<input class="simple-field-data-mask-selectonfocus" type="text" data-mask="00/00/0000" data-mask-selectonfocus="true" />
|
||||
<input class="simple-field-data-mask-reverse" type="text" data-mask="#.##0,00" data-mask-reverse="true" data-mask-maxlength="false"/>
|
||||
<input class="simple-field-data-mask-clearifnotmatch" data-mask="000" type="text" data-mask-clearifnotmatch="true" />
|
||||
<input class="simple-field-data-mask-clearifnotmatch-and-optional-mask" data-mask="009" type="text" data-mask-clearifnotmatch="true" />
|
||||
<div class="simple-div"></div>
|
||||
<div id="container-dy-non-inputs"> </div>
|
||||
<!--/ testing area-->
|
||||
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./sinon-1.10.3.js"></script>
|
||||
<script type="text/javascript" src="./sinon-qunit-1.0.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/jquery.mask.js"></script>
|
||||
<script type="text/javascript" src="jquery.mask.test.js"></script>
|
||||
</body>
|
||||
</html>
|
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.7.2.html
generated
vendored
Normal file
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.7.2.html
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>jQuery-Mask-Plugin UnitTesting</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery-Mask-Plugin QUnit Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- testing area -->
|
||||
<input class="simple-field" type="text" />
|
||||
<input class="simple-field-data-mask" type="text" data-mask="00/00/0000"/>
|
||||
<input class="simple-field-data-mask-selectonfocus" type="text" data-mask="00/00/0000" data-mask-selectonfocus="true" />
|
||||
<input class="simple-field-data-mask-reverse" type="text" data-mask="#.##0,00" data-mask-reverse="true" data-mask-maxlength="false"/>
|
||||
<input class="simple-field-data-mask-clearifnotmatch" data-mask="000" type="text" data-mask-clearifnotmatch="true" />
|
||||
<input class="simple-field-data-mask-clearifnotmatch-and-optional-mask" data-mask="009" type="text" data-mask-clearifnotmatch="true" />
|
||||
<div class="simple-div"></div>
|
||||
<div id="container-dy-non-inputs"> </div>
|
||||
<!--/ testing area-->
|
||||
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./sinon-1.10.3.js"></script>
|
||||
<script type="text/javascript" src="./sinon-qunit-1.0.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/jquery.mask.js"></script>
|
||||
<script type="text/javascript" src="jquery.mask.test.js"></script>
|
||||
</body>
|
||||
</html>
|
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.8.3.html
generated
vendored
Normal file
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.8.3.html
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>jQuery-Mask-Plugin UnitTesting</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery-Mask-Plugin QUnit Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- testing area -->
|
||||
<input class="simple-field" type="text" />
|
||||
<input class="simple-field-data-mask" type="text" data-mask="00/00/0000"/>
|
||||
<input class="simple-field-data-mask-selectonfocus" type="text" data-mask="00/00/0000" data-mask-selectonfocus="true" />
|
||||
<input class="simple-field-data-mask-reverse" type="text" data-mask="#.##0,00" data-mask-reverse="true" data-mask-maxlength="false"/>
|
||||
<input class="simple-field-data-mask-clearifnotmatch" data-mask="000" type="text" data-mask-clearifnotmatch="true" />
|
||||
<input class="simple-field-data-mask-clearifnotmatch-and-optional-mask" data-mask="009" type="text" data-mask-clearifnotmatch="true" />
|
||||
<div class="simple-div"></div>
|
||||
<div id="container-dy-non-inputs"> </div>
|
||||
<!--/ testing area-->
|
||||
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./sinon-1.10.3.js"></script>
|
||||
<script type="text/javascript" src="./sinon-qunit-1.0.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/jquery.mask.js"></script>
|
||||
<script type="text/javascript" src="jquery.mask.test.js"></script>
|
||||
</body>
|
||||
</html>
|
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.9.1.html
generated
vendored
Normal file
35
node_modules/jquery-mask-plugin/test/test-for-jquery-1.9.1.html
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>jQuery-Mask-Plugin UnitTesting</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery-Mask-Plugin QUnit Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- testing area -->
|
||||
<input class="simple-field" type="text" />
|
||||
<input class="simple-field-data-mask" type="text" data-mask="00/00/0000"/>
|
||||
<input class="simple-field-data-mask-selectonfocus" type="text" data-mask="00/00/0000" data-mask-selectonfocus="true" />
|
||||
<input class="simple-field-data-mask-reverse" type="text" data-mask="#.##0,00" data-mask-reverse="true" data-mask-maxlength="false"/>
|
||||
<input class="simple-field-data-mask-clearifnotmatch" data-mask="000" type="text" data-mask-clearifnotmatch="true" />
|
||||
<input class="simple-field-data-mask-clearifnotmatch-and-optional-mask" data-mask="009" type="text" data-mask-clearifnotmatch="true" />
|
||||
<div class="simple-div"></div>
|
||||
<div id="container-dy-non-inputs"> </div>
|
||||
<!--/ testing area-->
|
||||
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./sinon-1.10.3.js"></script>
|
||||
<script type="text/javascript" src="./sinon-qunit-1.0.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/jquery.mask.js"></script>
|
||||
<script type="text/javascript" src="jquery.mask.test.js"></script>
|
||||
</body>
|
||||
</html>
|
35
node_modules/jquery-mask-plugin/test/test-for-jquery-2.1.1.html
generated
vendored
Normal file
35
node_modules/jquery-mask-plugin/test/test-for-jquery-2.1.1.html
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>jQuery-Mask-Plugin UnitTesting</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery-Mask-Plugin QUnit Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- testing area -->
|
||||
<input class="simple-field" type="text" />
|
||||
<input class="simple-field-data-mask" type="text" data-mask="00/00/0000"/>
|
||||
<input class="simple-field-data-mask-selectonfocus" type="text" data-mask="00/00/0000" data-mask-selectonfocus="true" />
|
||||
<input class="simple-field-data-mask-reverse" type="text" data-mask="#.##0,00" data-mask-reverse="true" data-mask-maxlength="false"/>
|
||||
<input class="simple-field-data-mask-clearifnotmatch" data-mask="000" type="text" data-mask-clearifnotmatch="true" />
|
||||
<input class="simple-field-data-mask-clearifnotmatch-and-optional-mask" data-mask="009" type="text" data-mask-clearifnotmatch="true" />
|
||||
<div class="simple-div"></div>
|
||||
<div id="container-dy-non-inputs"> </div>
|
||||
<!--/ testing area-->
|
||||
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./sinon-1.10.3.js"></script>
|
||||
<script type="text/javascript" src="./sinon-qunit-1.0.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/jquery.mask.js"></script>
|
||||
<script type="text/javascript" src="jquery.mask.test.js"></script>
|
||||
</body>
|
||||
</html>
|
35
node_modules/jquery-mask-plugin/test/test-for-jquery-3.0.0.html
generated
vendored
Normal file
35
node_modules/jquery-mask-plugin/test/test-for-jquery-3.0.0.html
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>jQuery-Mask-Plugin UnitTesting</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">jQuery-Mask-Plugin QUnit Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- testing area -->
|
||||
<input class="simple-field" type="text" />
|
||||
<input class="simple-field-data-mask" type="text" data-mask="00/00/0000"/>
|
||||
<input class="simple-field-data-mask-selectonfocus" type="text" data-mask="00/00/0000" data-mask-selectonfocus="true" />
|
||||
<input class="simple-field-data-mask-reverse" type="text" data-mask="#.##0,00" data-mask-reverse="true" data-mask-maxlength="false"/>
|
||||
<input class="simple-field-data-mask-clearifnotmatch" data-mask="000" type="text" data-mask-clearifnotmatch="true" />
|
||||
<input class="simple-field-data-mask-clearifnotmatch-and-optional-mask" data-mask="009" type="text" data-mask-clearifnotmatch="true" />
|
||||
<div class="simple-div"></div>
|
||||
<div id="container-dy-non-inputs"> </div>
|
||||
<!--/ testing area-->
|
||||
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-3.0.0.min.js"></script>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./sinon-1.10.3.js"></script>
|
||||
<script type="text/javascript" src="./sinon-qunit-1.0.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/jquery.mask.js"></script>
|
||||
<script type="text/javascript" src="jquery.mask.test.js"></script>
|
||||
</body>
|
||||
</html>
|
36
node_modules/jquery-mask-plugin/test/test-for-zepto.html
generated
vendored
Normal file
36
node_modules/jquery-mask-plugin/test/test-for-zepto.html
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Zepto-Mask-Plugin UnitTesting</title>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="all">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">Zepto-Mask-Plugin QUnit Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- testing area -->
|
||||
<input class="simple-field" type="text" />
|
||||
<input class="simple-field-data-mask" type="text" data-mask="00/00/0000"/>
|
||||
<input class="simple-field-data-mask-selectonfocus" type="text" data-mask="00/00/0000" data-mask-selectonfocus="true" />
|
||||
<input class="simple-field-data-mask-reverse" type="text" data-mask="#.##0,00" data-mask-reverse="true" data-mask-maxlength="false"/>
|
||||
<input class="simple-field-data-mask-clearifnotmatch" data-mask="000" type="text" data-mask-clearifnotmatch="true" />
|
||||
<input class="simple-field-data-mask-clearifnotmatch-and-optional-mask" data-mask="009" type="text" data-mask-clearifnotmatch="true" />
|
||||
<div class="simple-div"></div>
|
||||
<div id="container-dy-non-inputs"> </div>
|
||||
<!--/ testing area-->
|
||||
|
||||
<script type="text/javascript" src="zepto/zepto.min.js"></script>
|
||||
<script type="text/javascript" src="zepto/data.js"></script>
|
||||
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./sinon-1.10.3.js"></script>
|
||||
<script type="text/javascript" src="./sinon-qunit-1.0.0.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/jquery.mask.js"></script>
|
||||
<script type="text/javascript" src="jquery.mask.test.js"></script>
|
||||
</body>
|
||||
</html>
|
80
node_modules/jquery-mask-plugin/test/zepto/data.js
generated
vendored
Normal file
80
node_modules/jquery-mask-plugin/test/zepto/data.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
// Zepto.js
|
||||
// (c) 2010-2014 Thomas Fuchs
|
||||
// Zepto.js may be freely distributed under the MIT license.
|
||||
|
||||
// The following code is heavily inspired by jQuery's $.fn.data()
|
||||
|
||||
;(function($){
|
||||
var data = {}, dataAttr = $.fn.data, camelize = $.camelCase,
|
||||
exp = $.expando = 'Zepto' + (+new Date()), emptyArray = []
|
||||
|
||||
// Get value from node:
|
||||
// 1. first try key as given,
|
||||
// 2. then try camelized key,
|
||||
// 3. fall back to reading "data-*" attribute.
|
||||
function getData(node, name) {
|
||||
var id = node[exp], store = id && data[id]
|
||||
if (name === undefined) return store || setData(node)
|
||||
else {
|
||||
if (store) {
|
||||
if (name in store) return store[name]
|
||||
var camelName = camelize(name)
|
||||
if (camelName in store) return store[camelName]
|
||||
}
|
||||
return dataAttr.call($(node), name)
|
||||
}
|
||||
}
|
||||
|
||||
// Store value under camelized key on node
|
||||
function setData(node, name, value) {
|
||||
var id = node[exp] || (node[exp] = ++$.uuid),
|
||||
store = data[id] || (data[id] = attributeData(node))
|
||||
if (name !== undefined) store[camelize(name)] = value
|
||||
return store
|
||||
}
|
||||
|
||||
// Read all "data-*" attributes from a node
|
||||
function attributeData(node) {
|
||||
var store = {}
|
||||
$.each(node.attributes || emptyArray, function(i, attr){
|
||||
if (attr.name.indexOf('data-') == 0)
|
||||
store[camelize(attr.name.replace('data-', ''))] =
|
||||
$.zepto.deserializeValue(attr.value)
|
||||
})
|
||||
return store
|
||||
}
|
||||
|
||||
$.fn.data = function(name, value) {
|
||||
return value === undefined ?
|
||||
// set multiple values via object
|
||||
$.isPlainObject(name) ?
|
||||
this.each(function(i, node){
|
||||
$.each(name, function(key, value){ setData(node, key, value) })
|
||||
}) :
|
||||
// get value from first element
|
||||
(0 in this ? getData(this[0], name) : undefined) :
|
||||
// set value on all elements
|
||||
this.each(function(){ setData(this, name, value) })
|
||||
}
|
||||
|
||||
$.fn.removeData = function(names) {
|
||||
if (typeof names == 'string') names = names.split(/\s+/)
|
||||
return this.each(function(){
|
||||
var id = this[exp], store = id && data[id]
|
||||
if (store) $.each(names || store, function(key){
|
||||
delete store[names ? camelize(this) : key]
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Generate extended `remove` and `empty` functions
|
||||
;['remove', 'empty'].forEach(function(methodName){
|
||||
var origFn = $.fn[methodName]
|
||||
$.fn[methodName] = function() {
|
||||
var elements = this.find('*')
|
||||
if (methodName === 'remove') elements = elements.add(this)
|
||||
elements.removeData()
|
||||
return origFn.call(this)
|
||||
}
|
||||
})
|
||||
})(Zepto)
|
282
node_modules/jquery-mask-plugin/test/zepto/event.js
generated
vendored
Normal file
282
node_modules/jquery-mask-plugin/test/zepto/event.js
generated
vendored
Normal file
|
@ -0,0 +1,282 @@
|
|||
// Zepto.js
|
||||
// (c) 2010-2014 Thomas Fuchs
|
||||
// Zepto.js may be freely distributed under the MIT license.
|
||||
|
||||
;(function($){
|
||||
var _zid = 1, undefined,
|
||||
slice = Array.prototype.slice,
|
||||
isFunction = $.isFunction,
|
||||
isString = function(obj){ return typeof obj == 'string' },
|
||||
handlers = {},
|
||||
specialEvents={},
|
||||
focusinSupported = 'onfocusin' in window,
|
||||
focus = { focus: 'focusin', blur: 'focusout' },
|
||||
hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' }
|
||||
|
||||
specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents'
|
||||
|
||||
function zid(element) {
|
||||
return element._zid || (element._zid = _zid++)
|
||||
}
|
||||
function findHandlers(element, event, fn, selector) {
|
||||
event = parse(event)
|
||||
if (event.ns) var matcher = matcherFor(event.ns)
|
||||
return (handlers[zid(element)] || []).filter(function(handler) {
|
||||
return handler
|
||||
&& (!event.e || handler.e == event.e)
|
||||
&& (!event.ns || matcher.test(handler.ns))
|
||||
&& (!fn || zid(handler.fn) === zid(fn))
|
||||
&& (!selector || handler.sel == selector)
|
||||
})
|
||||
}
|
||||
function parse(event) {
|
||||
var parts = ('' + event).split('.')
|
||||
return {e: parts[0], ns: parts.slice(1).sort().join(' ')}
|
||||
}
|
||||
function matcherFor(ns) {
|
||||
return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)')
|
||||
}
|
||||
|
||||
function eventCapture(handler, captureSetting) {
|
||||
return handler.del &&
|
||||
(!focusinSupported && (handler.e in focus)) ||
|
||||
!!captureSetting
|
||||
}
|
||||
|
||||
function realEvent(type) {
|
||||
return hover[type] || (focusinSupported && focus[type]) || type
|
||||
}
|
||||
|
||||
function add(element, events, fn, data, selector, delegator, capture){
|
||||
var id = zid(element), set = (handlers[id] || (handlers[id] = []))
|
||||
events.split(/\s/).forEach(function(event){
|
||||
if (event == 'ready') return $(document).ready(fn)
|
||||
var handler = parse(event)
|
||||
handler.fn = fn
|
||||
handler.sel = selector
|
||||
// emulate mouseenter, mouseleave
|
||||
if (handler.e in hover) fn = function(e){
|
||||
var related = e.relatedTarget
|
||||
if (!related || (related !== this && !$.contains(this, related)))
|
||||
return handler.fn.apply(this, arguments)
|
||||
}
|
||||
handler.del = delegator
|
||||
var callback = delegator || fn
|
||||
handler.proxy = function(e){
|
||||
e = compatible(e)
|
||||
if (e.isImmediatePropagationStopped()) return
|
||||
e.data = data
|
||||
var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))
|
||||
if (result === false) e.preventDefault(), e.stopPropagation()
|
||||
return result
|
||||
}
|
||||
handler.i = set.length
|
||||
set.push(handler)
|
||||
if ('addEventListener' in element)
|
||||
element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
|
||||
})
|
||||
}
|
||||
function remove(element, events, fn, selector, capture){
|
||||
var id = zid(element)
|
||||
;(events || '').split(/\s/).forEach(function(event){
|
||||
findHandlers(element, event, fn, selector).forEach(function(handler){
|
||||
delete handlers[id][handler.i]
|
||||
if ('removeEventListener' in element)
|
||||
element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
$.event = { add: add, remove: remove }
|
||||
|
||||
$.proxy = function(fn, context) {
|
||||
var args = (2 in arguments) && slice.call(arguments, 2)
|
||||
if (isFunction(fn)) {
|
||||
var proxyFn = function(){ return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments) }
|
||||
proxyFn._zid = zid(fn)
|
||||
return proxyFn
|
||||
} else if (isString(context)) {
|
||||
if (args) {
|
||||
args.unshift(fn[context], fn)
|
||||
return $.proxy.apply(null, args)
|
||||
} else {
|
||||
return $.proxy(fn[context], fn)
|
||||
}
|
||||
} else {
|
||||
throw new TypeError("expected function")
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.bind = function(event, data, callback){
|
||||
return this.on(event, data, callback)
|
||||
}
|
||||
$.fn.unbind = function(event, callback){
|
||||
return this.off(event, callback)
|
||||
}
|
||||
$.fn.one = function(event, selector, data, callback){
|
||||
return this.on(event, selector, data, callback, 1)
|
||||
}
|
||||
|
||||
var returnTrue = function(){return true},
|
||||
returnFalse = function(){return false},
|
||||
ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$)/,
|
||||
eventMethods = {
|
||||
preventDefault: 'isDefaultPrevented',
|
||||
stopImmediatePropagation: 'isImmediatePropagationStopped',
|
||||
stopPropagation: 'isPropagationStopped'
|
||||
}
|
||||
|
||||
function compatible(event, source) {
|
||||
if (source || !event.isDefaultPrevented) {
|
||||
source || (source = event)
|
||||
|
||||
$.each(eventMethods, function(name, predicate) {
|
||||
var sourceMethod = source[name]
|
||||
event[name] = function(){
|
||||
this[predicate] = returnTrue
|
||||
return sourceMethod && sourceMethod.apply(source, arguments)
|
||||
}
|
||||
event[predicate] = returnFalse
|
||||
})
|
||||
|
||||
if (source.defaultPrevented !== undefined ? source.defaultPrevented :
|
||||
'returnValue' in source ? source.returnValue === false :
|
||||
source.getPreventDefault && source.getPreventDefault())
|
||||
event.isDefaultPrevented = returnTrue
|
||||
}
|
||||
return event
|
||||
}
|
||||
|
||||
function createProxy(event) {
|
||||
var key, proxy = { originalEvent: event }
|
||||
for (key in event)
|
||||
if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key]
|
||||
|
||||
return compatible(proxy, event)
|
||||
}
|
||||
|
||||
$.fn.delegate = function(selector, event, callback){
|
||||
return this.on(event, selector, callback)
|
||||
}
|
||||
$.fn.undelegate = function(selector, event, callback){
|
||||
return this.off(event, selector, callback)
|
||||
}
|
||||
|
||||
$.fn.live = function(event, callback){
|
||||
$(document.body).delegate(this.selector, event, callback)
|
||||
return this
|
||||
}
|
||||
$.fn.die = function(event, callback){
|
||||
$(document.body).undelegate(this.selector, event, callback)
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.on = function(event, selector, data, callback, one){
|
||||
var autoRemove, delegator, $this = this
|
||||
if (event && !isString(event)) {
|
||||
$.each(event, function(type, fn){
|
||||
$this.on(type, selector, data, fn, one)
|
||||
})
|
||||
return $this
|
||||
}
|
||||
|
||||
if (!isString(selector) && !isFunction(callback) && callback !== false)
|
||||
callback = data, data = selector, selector = undefined
|
||||
if (isFunction(data) || data === false)
|
||||
callback = data, data = undefined
|
||||
|
||||
if (callback === false) callback = returnFalse
|
||||
|
||||
return $this.each(function(_, element){
|
||||
if (one) autoRemove = function(e){
|
||||
remove(element, e.type, callback)
|
||||
return callback.apply(this, arguments)
|
||||
}
|
||||
|
||||
if (selector) delegator = function(e){
|
||||
var evt, match = $(e.target).closest(selector, element).get(0)
|
||||
if (match && match !== element) {
|
||||
evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element})
|
||||
return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)))
|
||||
}
|
||||
}
|
||||
|
||||
add(element, event, callback, data, selector, delegator || autoRemove)
|
||||
})
|
||||
}
|
||||
$.fn.off = function(event, selector, callback){
|
||||
var $this = this
|
||||
if (event && !isString(event)) {
|
||||
$.each(event, function(type, fn){
|
||||
$this.off(type, selector, fn)
|
||||
})
|
||||
return $this
|
||||
}
|
||||
|
||||
if (!isString(selector) && !isFunction(callback) && callback !== false)
|
||||
callback = selector, selector = undefined
|
||||
|
||||
if (callback === false) callback = returnFalse
|
||||
|
||||
return $this.each(function(){
|
||||
remove(this, event, callback, selector)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.trigger = function(event, args){
|
||||
event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event)
|
||||
event._args = args
|
||||
return this.each(function(){
|
||||
// items in the collection might not be DOM elements
|
||||
if('dispatchEvent' in this) this.dispatchEvent(event)
|
||||
else $(this).triggerHandler(event, args)
|
||||
})
|
||||
}
|
||||
|
||||
// triggers event handlers on current element just as if an event occurred,
|
||||
// doesn't trigger an actual event, doesn't bubble
|
||||
$.fn.triggerHandler = function(event, args){
|
||||
var e, result
|
||||
this.each(function(i, element){
|
||||
e = createProxy(isString(event) ? $.Event(event) : event)
|
||||
e._args = args
|
||||
e.target = element
|
||||
$.each(findHandlers(element, event.type || event), function(i, handler){
|
||||
result = handler.proxy(e)
|
||||
if (e.isImmediatePropagationStopped()) return false
|
||||
})
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
// shortcut methods for `.bind(event, fn)` for each event type
|
||||
;('focusin focusout load resize scroll unload click dblclick '+
|
||||
'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+
|
||||
'change select keydown keypress keyup error').split(' ').forEach(function(event) {
|
||||
$.fn[event] = function(callback) {
|
||||
return callback ?
|
||||
this.bind(event, callback) :
|
||||
this.trigger(event)
|
||||
}
|
||||
})
|
||||
|
||||
;['focus', 'blur'].forEach(function(name) {
|
||||
$.fn[name] = function(callback) {
|
||||
if (callback) this.bind(name, callback)
|
||||
else this.each(function(){
|
||||
try { this[name]() }
|
||||
catch(e) {}
|
||||
})
|
||||
return this
|
||||
}
|
||||
})
|
||||
|
||||
$.Event = function(type, props) {
|
||||
if (!isString(type)) props = type, type = props.type
|
||||
var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true
|
||||
if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name])
|
||||
event.initEvent(type, bubbles, true)
|
||||
return compatible(event)
|
||||
}
|
||||
|
||||
})(Zepto)
|
1580
node_modules/jquery-mask-plugin/test/zepto/zepto.min.js
generated
vendored
Normal file
1580
node_modules/jquery-mask-plugin/test/zepto/zepto.min.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue