angular-ui-mask
Advanced tools
Comparing version 1.4.6 to 1.5.0
/*! | ||
* angular-ui-mask | ||
* https://github.com/angular-ui/ui-mask | ||
* Version: 1.4.6 - 2015-09-28T13:54:32.227Z | ||
* Version: 1.5.0 - 2015-11-03T03:09:24.207Z | ||
* License: MIT | ||
@@ -73,2 +73,7 @@ */ | ||
} | ||
function initPlaceholderChar() { | ||
return initialize(iAttrs.uiMask); | ||
} | ||
var modelViewValue = false; | ||
@@ -145,2 +150,6 @@ iAttrs.$observe('modelViewValue', function(val) { | ||
} | ||
if (angular.isDefined(iAttrs.uiMaskPlaceholderChar)) { | ||
iAttrs.$observe('uiMaskPlaceholderChar', initPlaceholderChar); | ||
} | ||
controller.$formatters.push(formatter); | ||
@@ -257,3 +266,4 @@ controller.$parsers.push(parser); | ||
function getPlaceholderChar(i) { | ||
var placeholder = angular.isDefined(iAttrs.uiMaskPlaceholder) ? iAttrs.uiMaskPlaceholder : iAttrs.placeholder; | ||
var placeholder = angular.isDefined(iAttrs.uiMaskPlaceholder) ? iAttrs.uiMaskPlaceholder : iAttrs.placeholder, | ||
defaultPlaceholderChar; | ||
@@ -263,3 +273,4 @@ if (typeof placeholder !== 'undefined' && placeholder[i]) { | ||
} else { | ||
return '_'; | ||
defaultPlaceholderChar = angular.isDefined(iAttrs.uiMaskPlaceholderChar) && iAttrs.uiMaskPlaceholderChar ? iAttrs.uiMaskPlaceholderChar : '_'; | ||
return (defaultPlaceholderChar.toLowerCase() === 'space') ? ' ' : defaultPlaceholderChar[0]; | ||
} | ||
@@ -323,3 +334,4 @@ } | ||
} | ||
var prevValue = iElement.val(); | ||
function blurHandler() { | ||
@@ -337,3 +349,30 @@ if (linkOptions.clearOnBlur) { | ||
} | ||
//Check for different value and trigger change. | ||
if (value !== prevValue) { | ||
triggerChangeEvent(iElement[0]); | ||
} | ||
prevValue = value; | ||
} | ||
function triggerChangeEvent(element) { | ||
var change; | ||
if (typeof window.Event == 'function' && !element.fireEvent) { | ||
// modern browsers and Edge | ||
change = new Event('change', { | ||
view: window, | ||
bubbles: true, | ||
cancelable: false | ||
}); | ||
element.dispatchEvent(change); | ||
} else if ('createEvent' in document) { | ||
// older browsers | ||
change = document.createEvent('HTMLEvents'); | ||
change.initEvent('change', false, true); | ||
element.dispatchEvent(change); | ||
} | ||
else if (element.fireEvent) { | ||
// IE <= 11 | ||
element.fireEvent('onchange'); | ||
} | ||
} | ||
@@ -340,0 +379,0 @@ function mouseDownUpHandler(e) { |
/*! | ||
* angular-ui-mask | ||
* https://github.com/angular-ui/ui-mask | ||
* Version: 1.4.6 - 2015-09-28T13:54:32.227Z | ||
* Version: 1.5.0 - 2015-11-03T03:09:24.207Z | ||
* License: MIT | ||
*/ | ||
!function(){"use strict";angular.module("ui.mask",[]).value("uiMaskConfig",{maskDefinitions:{9:/\d/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},clearOnBlur:!0,eventsToHandle:["input","keyup","click","focus"]}).directive("uiMask",["uiMaskConfig",function(e){function n(e){return e===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(e.type||e.href||~e.tabIndex)}return{priority:100,require:"ngModel",restrict:"A",compile:function(){var t=e;return function(e,r,i,u){function a(e){return angular.isDefined(e)?($(e),C?(f(),h(),!0):c()):c()}function o(e){e&&(_=e,C&&r.val(v(p(r.val()))))}function l(e){return C?(P=p(e||""),q=g(P),u.$setValidity("mask",q),q&&P.length?v(P):void 0):e}function s(e){return C?(P=p(e||""),q=g(P),u.$viewValue=P.length?v(P):"",u.$setValidity("mask",q),""===P&&i.required&&u.$setValidity("required",!u.$error.required),q?N?u.$viewValue:P:void 0):e}function c(){return C=!1,d(),angular.isDefined(I)?r.attr("placeholder",I):r.removeAttr("placeholder"),angular.isDefined(K)?r.attr("maxlength",K):r.removeAttr("maxlength"),r.val(u.$modelValue),u.$viewValue=u.$modelValue,!1}function f(){P=H=p(u.$modelValue||""),T=z=v(P),q=g(P),i.maxlength&&r.attr("maxlength",2*D[D.length-1]),I||r.attr("placeholder",_);for(var e=u.$modelValue,n=u.$formatters.length;n--;)e=u.$formatters[n](e);u.$viewValue=e||"",u.$render()}function h(){F||(r.bind("blur",y),r.bind("mousedown mouseup",k),r.bind(W.eventsToHandle.join(" "),w),r.bind("paste",V),F=!0)}function d(){F&&(r.unbind("blur",y),r.unbind("mousedown",k),r.unbind("mouseup",k),r.unbind("input",w),r.unbind("keyup",w),r.unbind("click",w),r.unbind("focus",w),r.unbind("paste",V),F=!1)}function g(e){return e.length?e.length>=j:!0}function p(e){var n="",t=E.slice();return e=e.toString(),angular.forEach(R,function(n){e=e.replace(n,"")}),angular.forEach(e.split(""),function(e){t.length&&t[0].test(e)&&(n+=e,t.shift())}),n}function v(e){var n="",t=D.slice();return angular.forEach(_.split(""),function(r,i){e.length&&i===t[0]?(n+=e.charAt(0)||"_",e=e.substr(1),t.shift()):n+=r}),n}function m(e){var n=angular.isDefined(i.uiMaskPlaceholder)?i.uiMaskPlaceholder:i.placeholder;return"undefined"!=typeof n&&n[e]?n[e]:"_"}function b(){return _.replace(/[_]+/g,"_").replace(/([^_]+)([a-zA-Z0-9])([^_])/g,"$1$2_$3").split("_")}function $(e){var n=0;if(D=[],E=[],_="","string"==typeof e){j=0;var t=!1,r=0,i=e.split("");angular.forEach(i,function(e,i){W.maskDefinitions[e]?(D.push(n),_+=m(i-r),E.push(W.maskDefinitions[e]),n++,t||j++):"?"===e?(t=!0,r++):(_+=e,n++)})}D.push(D.slice().pop()+1),R=b(),C=D.length>1?!0:!1}function y(){W.clearOnBlur&&(Z=0,B=0,q&&0!==P.length||(T="",r.val(""),e.$apply(function(){u.$setViewValue("")})))}function k(e){"mousedown"===e.type?r.bind("mouseout",x):r.unbind("mouseout",x)}function x(){B=S(this),r.unbind("mouseout",x)}function V(){A(this,r.val().length)}function w(n){n=n||{};var t=n.which,i=n.type;if(16!==t&&91!==t){var a,o=r.val(),l=z,s=p(o),c=H,f=M(this)||0,h=Z||0,d=f-h,g=D[0],m=D[s.length]||D.slice().shift(),b=B||0,$=S(this)>0,y=b>0,k=o.length>l.length||b&&o.length>l.length-b,x=o.length<l.length||b&&o.length===l.length-b,V=t>=37&&40>=t&&n.shiftKey,w=37===t,E=8===t||"keyup"!==i&&x&&-1===d,_=46===t||"keyup"!==i&&x&&0===d&&!y,R=(w||E||"click"===i)&&f>g;if(B=S(this),!V&&(!$||"click"!==i&&"keyup"!==i)){if("input"===i&&x&&!y&&s===c){for(;E&&f>g&&!O(f);)f--;for(;_&&m>f&&-1===D.indexOf(f);)f++;var j=D.indexOf(f);s=s.substring(0,j)+s.substring(j+1)}for(a=v(s),z=a,H=s,r.val(a),e.$apply(function(){u.$setViewValue(s)}),k&&g>=f&&(f=g+1),R&&f--,f=f>m?m:g>f?g:f;!O(f)&&f>g&&m>f;)f+=R?-1:1;(R&&m>f||k&&!O(h))&&f++,Z=f,A(this,f)}}}function O(e){return D.indexOf(e)>-1}function M(e){if(!e)return 0;if(void 0!==e.selectionStart)return e.selectionStart;if(document.selection&&n(r[0])){e.focus();var t=document.selection.createRange();return t.moveStart("character",e.value?-e.value.length:0),t.text.length}return 0}function A(e,t){if(!e)return 0;if(0!==e.offsetWidth&&0!==e.offsetHeight)if(e.setSelectionRange)n(r[0])&&(e.focus(),e.setSelectionRange(t,t));else if(e.createTextRange){var i=e.createTextRange();i.collapse(!0),i.moveEnd("character",t),i.moveStart("character",t),i.select()}}function S(e){return e?void 0!==e.selectionStart?e.selectionEnd-e.selectionStart:document.selection?document.selection.createRange().text.length:0:0}var D,E,_,R,j,P,T,q,z,H,Z,B,C=!1,F=!1,I=i.placeholder,K=i.maxlength,N=!1;i.$observe("modelViewValue",function(e){"true"===e&&(N=!0)});var W={};i.uiOptions?(W=e.$eval("["+i.uiOptions+"]"),angular.isObject(W[0])&&(W=function(e,n){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===n[t]?n[t]=angular.copy(e[t]):angular.isObject(n[t])&&angular.extend(n[t],e[t]));return n}(t,W[0]))):W=t,i.$observe("uiMask",a),angular.isDefined(i.uiMaskPlaceholder)?i.$observe("uiMaskPlaceholder",o):i.$observe("placeholder",o),u.$formatters.push(l),u.$parsers.push(s),r.bind("mousedown mouseup",k),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(null===this)throw new TypeError;var n=Object(this),t=n.length>>>0;if(0===t)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&r!==1/0&&r!==-(1/0)&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=t)return-1;for(var i=r>=0?r:Math.max(t-Math.abs(r),0);t>i;i++)if(i in n&&n[i]===e)return i;return-1})}}}}])}(); | ||
!function(){"use strict";angular.module("ui.mask",[]).value("uiMaskConfig",{maskDefinitions:{9:/\d/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},clearOnBlur:!0,eventsToHandle:["input","keyup","click","focus"]}).directive("uiMask",["uiMaskConfig",function(e){function n(e){return e===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(e.type||e.href||~e.tabIndex)}return{priority:100,require:"ngModel",restrict:"A",compile:function(){var t=e;return function(e,i,r,a){function u(e){return angular.isDefined(e)?(k(e),L?(h(),d(),!0):f()):f()}function o(e){e&&(_=e,L&&i.val(m(p(i.val()))))}function l(){return u(r.uiMask)}function c(e){return L?(j=p(e||""),H=v(j),a.$setValidity("mask",H),H&&j.length?m(j):void 0):e}function s(e){return L?(j=p(e||""),H=v(j),a.$viewValue=j.length?m(j):"",a.$setValidity("mask",H),""===j&&r.required&&a.$setValidity("required",!a.$error.required),H?W?a.$viewValue:j:void 0):e}function f(){return L=!1,g(),angular.isDefined(K)?i.attr("placeholder",K):i.removeAttr("placeholder"),angular.isDefined(N)?i.attr("maxlength",N):i.removeAttr("maxlength"),i.val(a.$modelValue),a.$viewValue=a.$modelValue,!1}function h(){j=Z=p(a.$modelValue||""),q=z=m(j),H=v(j),r.maxlength&&i.attr("maxlength",2*S[S.length-1]),K||i.attr("placeholder",_);for(var e=a.$modelValue,n=a.$formatters.length;n--;)e=a.$formatters[n](e);a.$viewValue=e||"",a.$render()}function d(){I||(i.bind("blur",y),i.bind("mousedown mouseup",M),i.bind(G.eventsToHandle.join(" "),V),i.bind("paste",x),I=!0)}function g(){I&&(i.unbind("blur",y),i.unbind("mousedown",M),i.unbind("mouseup",M),i.unbind("input",V),i.unbind("keyup",V),i.unbind("click",V),i.unbind("focus",V),i.unbind("paste",x),I=!1)}function v(e){return e.length?e.length>=T:!0}function p(e){var n="",t=C.slice();return e=e.toString(),angular.forEach(R,function(n){e=e.replace(n,"")}),angular.forEach(e.split(""),function(e){t.length&&t[0].test(e)&&(n+=e,t.shift())}),n}function m(e){var n="",t=S.slice();return angular.forEach(_.split(""),function(i,r){e.length&&r===t[0]?(n+=e.charAt(0)||"_",e=e.substr(1),t.shift()):n+=i}),n}function b(e){var n,t=angular.isDefined(r.uiMaskPlaceholder)?r.uiMaskPlaceholder:r.placeholder;return"undefined"!=typeof t&&t[e]?t[e]:(n=angular.isDefined(r.uiMaskPlaceholderChar)&&r.uiMaskPlaceholderChar?r.uiMaskPlaceholderChar:"_","space"===n.toLowerCase()?" ":n[0])}function $(){return _.replace(/[_]+/g,"_").replace(/([^_]+)([a-zA-Z0-9])([^_])/g,"$1$2_$3").split("_")}function k(e){var n=0;if(S=[],C=[],_="","string"==typeof e){T=0;var t=!1,i=0,r=e.split("");angular.forEach(r,function(e,r){G.maskDefinitions[e]?(S.push(n),_+=b(r-i),C.push(G.maskDefinitions[e]),n++,t||T++):"?"===e?(t=!0,i++):(_+=e,n++)})}S.push(S.slice().pop()+1),R=$(),L=S.length>1?!0:!1}function y(){G.clearOnBlur&&(B=0,F=0,H&&0!==j.length||(q="",i.val(""),e.$apply(function(){a.$setViewValue("")}))),j!==J&&w(i[0]),J=j}function w(e){var n;"function"!=typeof window.Event||e.fireEvent?"createEvent"in document?(n=document.createEvent("HTMLEvents"),n.initEvent("change",!1,!0),e.dispatchEvent(n)):e.fireEvent&&e.fireEvent("onchange"):(n=new Event("change",{view:window,bubbles:!0,cancelable:!1}),e.dispatchEvent(n))}function M(e){"mousedown"===e.type?i.bind("mouseout",E):i.unbind("mouseout",E)}function E(){F=P(this),i.unbind("mouseout",E)}function x(){D(this,i.val().length)}function V(n){n=n||{};var t=n.which,r=n.type;if(16!==t&&91!==t){var u,o=i.val(),l=z,c=p(o),s=Z,f=A(this)||0,h=B||0,d=f-h,g=S[0],v=S[c.length]||S.slice().shift(),b=F||0,$=P(this)>0,k=b>0,y=o.length>l.length||b&&o.length>l.length-b,w=o.length<l.length||b&&o.length===l.length-b,M=t>=37&&40>=t&&n.shiftKey,E=37===t,x=8===t||"keyup"!==r&&w&&-1===d,V=46===t||"keyup"!==r&&w&&0===d&&!k,C=(E||x||"click"===r)&&f>g;if(F=P(this),!M&&(!$||"click"!==r&&"keyup"!==r)){if("input"===r&&w&&!k&&c===s){for(;x&&f>g&&!O(f);)f--;for(;V&&v>f&&-1===S.indexOf(f);)f++;var _=S.indexOf(f);c=c.substring(0,_)+c.substring(_+1)}for(u=m(c),z=u,Z=c,i.val(u),e.$apply(function(){a.$setViewValue(c)}),y&&g>=f&&(f=g+1),C&&f--,f=f>v?v:g>f?g:f;!O(f)&&f>g&&v>f;)f+=C?-1:1;(C&&v>f||y&&!O(h))&&f++,B=f,D(this,f)}}}function O(e){return S.indexOf(e)>-1}function A(e){if(!e)return 0;if(void 0!==e.selectionStart)return e.selectionStart;if(document.selection&&n(i[0])){e.focus();var t=document.selection.createRange();return t.moveStart("character",e.value?-e.value.length:0),t.text.length}return 0}function D(e,t){if(!e)return 0;if(0!==e.offsetWidth&&0!==e.offsetHeight)if(e.setSelectionRange)n(i[0])&&(e.focus(),e.setSelectionRange(t,t));else if(e.createTextRange){var r=e.createTextRange();r.collapse(!0),r.moveEnd("character",t),r.moveStart("character",t),r.select()}}function P(e){return e?void 0!==e.selectionStart?e.selectionEnd-e.selectionStart:document.selection?document.selection.createRange().text.length:0:0}var S,C,_,R,T,j,q,H,z,Z,B,F,L=!1,I=!1,K=r.placeholder,N=r.maxlength,W=!1;r.$observe("modelViewValue",function(e){"true"===e&&(W=!0)});var G={};r.uiOptions?(G=e.$eval("["+r.uiOptions+"]"),angular.isObject(G[0])&&(G=function(e,n){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===n[t]?n[t]=angular.copy(e[t]):angular.isObject(n[t])&&angular.extend(n[t],e[t]));return n}(t,G[0]))):G=t,r.$observe("uiMask",u),angular.isDefined(r.uiMaskPlaceholder)?r.$observe("uiMaskPlaceholder",o):r.$observe("placeholder",o),angular.isDefined(r.uiMaskPlaceholderChar)&&r.$observe("uiMaskPlaceholderChar",l),a.$formatters.push(c),a.$parsers.push(s);var J=i.val();i.bind("mousedown mouseup",M),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(null===this)throw new TypeError;var n=Object(this),t=n.length>>>0;if(0===t)return-1;var i=0;if(arguments.length>1&&(i=Number(arguments[1]),i!==i?i=0:0!==i&&i!==1/0&&i!==-(1/0)&&(i=(i>0||-1)*Math.floor(Math.abs(i)))),i>=t)return-1;for(var r=i>=0?i:Math.max(t-Math.abs(i),0);t>r;r++)if(r in n&&n[r]===e)return r;return-1})}}}}])}(); |
{ | ||
"name": "angular-ui-mask", | ||
"version": "1.4.6", | ||
"version": "1.5.0", | ||
"author": "https://github.com/angular-ui/ui-mask/graphs/contributors", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -63,2 +63,7 @@ /* | ||
} | ||
function initPlaceholderChar() { | ||
return initialize(iAttrs.uiMask); | ||
} | ||
var modelViewValue = false; | ||
@@ -135,2 +140,6 @@ iAttrs.$observe('modelViewValue', function(val) { | ||
} | ||
if (angular.isDefined(iAttrs.uiMaskPlaceholderChar)) { | ||
iAttrs.$observe('uiMaskPlaceholderChar', initPlaceholderChar); | ||
} | ||
controller.$formatters.push(formatter); | ||
@@ -247,3 +256,4 @@ controller.$parsers.push(parser); | ||
function getPlaceholderChar(i) { | ||
var placeholder = angular.isDefined(iAttrs.uiMaskPlaceholder) ? iAttrs.uiMaskPlaceholder : iAttrs.placeholder; | ||
var placeholder = angular.isDefined(iAttrs.uiMaskPlaceholder) ? iAttrs.uiMaskPlaceholder : iAttrs.placeholder, | ||
defaultPlaceholderChar; | ||
@@ -253,3 +263,4 @@ if (typeof placeholder !== 'undefined' && placeholder[i]) { | ||
} else { | ||
return '_'; | ||
defaultPlaceholderChar = angular.isDefined(iAttrs.uiMaskPlaceholderChar) && iAttrs.uiMaskPlaceholderChar ? iAttrs.uiMaskPlaceholderChar : '_'; | ||
return (defaultPlaceholderChar.toLowerCase() === 'space') ? ' ' : defaultPlaceholderChar[0]; | ||
} | ||
@@ -313,3 +324,4 @@ } | ||
} | ||
var prevValue = iElement.val(); | ||
function blurHandler() { | ||
@@ -327,3 +339,30 @@ if (linkOptions.clearOnBlur) { | ||
} | ||
//Check for different value and trigger change. | ||
if (value !== prevValue) { | ||
triggerChangeEvent(iElement[0]); | ||
} | ||
prevValue = value; | ||
} | ||
function triggerChangeEvent(element) { | ||
var change; | ||
if (typeof window.Event == 'function' && !element.fireEvent) { | ||
// modern browsers and Edge | ||
change = new Event('change', { | ||
view: window, | ||
bubbles: true, | ||
cancelable: false | ||
}); | ||
element.dispatchEvent(change); | ||
} else if ('createEvent' in document) { | ||
// older browsers | ||
change = document.createEvent('HTMLEvents'); | ||
change.initEvent('change', false, true); | ||
element.dispatchEvent(change); | ||
} | ||
else if (element.fireEvent) { | ||
// IE <= 11 | ||
element.fireEvent('onchange'); | ||
} | ||
} | ||
@@ -330,0 +369,0 @@ function mouseDownUpHandler(e) { |
@@ -207,2 +207,25 @@ describe("uiMask", function () { | ||
describe("verify change is called", function () { | ||
var input = undefined; | ||
var doneCount = 0; | ||
beforeEach(function (done) { | ||
input = compileElement(inputHtml); | ||
scope.$apply("x = ''"); | ||
scope.$apply("mask = '**?9'"); | ||
input.on("change", function () { | ||
doneCount++; | ||
done(); | ||
}); | ||
input.val("aa").triggerHandler("input"); | ||
input.triggerHandler("blur"); | ||
input.val("aa").triggerHandler("input"); | ||
input.triggerHandler("blur"); | ||
}); | ||
it("should have triggered change", function () { | ||
expect(doneCount).toBe(1); | ||
}); | ||
}); | ||
describe("with model-view-value", function() { | ||
@@ -212,3 +235,3 @@ var input = undefined; | ||
input = compileElement("<form name='test'><input name='input' ng-model='x' model-view-value='true' ui-mask='{{mask}}'></form>"); | ||
input = input.find('input') | ||
input = input.find('input'); | ||
}); | ||
@@ -356,2 +379,43 @@ it("should set the mask in the model", function() { | ||
expect(input.attr("placeholder")).toBe("Phone Number"); | ||
}); | ||
it("should accept ui-mask-placeholder-char", function() { | ||
var placeholderHtml = "<input name='input' ng-model='x' ui-mask='{{mask}}' placeholder='Phone Number' ui-mask-placeholder ui-mask-placeholder-char='X'>", | ||
input = compileElement(placeholderHtml); | ||
scope.$apply("x = ''"); | ||
scope.$apply("mask = '(999) 999-9999'"); | ||
input.triggerHandler("input"); | ||
expect(input.val()).toBe("(XXX) XXX-XXXX"); | ||
expect(input.attr("placeholder")).toBe("Phone Number"); | ||
}); | ||
it("should accept ui-mask-placeholder-char with value `space`", function() { | ||
var placeholderHtml = "<input name='input' ng-model='x' ui-mask='{{mask}}' placeholder='Phone Number' ui-mask-placeholder ui-mask-placeholder-char='space'>", | ||
input = compileElement(placeholderHtml); | ||
scope.$apply("x = ''"); | ||
scope.$apply("mask = '(999) 999-9999'"); | ||
input.triggerHandler("input"); | ||
expect(input.val()).toBe("( ) - "); | ||
expect(input.attr("placeholder")).toBe("Phone Number"); | ||
}); | ||
it("should not override placeholder value when ui-mask-placeholder is not set and ui-mask-placeholder-char is `space`", function() { | ||
var placeholderHtml = "<input name='input' ng-model='x' ui-mask='{{mask}}' placeholder='{{placeholder}}' ui-mask-placeholder-char='space'>", | ||
input = compileElement(placeholderHtml); | ||
scope.$apply("x = ''"); | ||
scope.$apply("mask = '99/99/9999'"); | ||
scope.$apply("placeholder = 'DD/MM/YYYY'"); | ||
expect(input.attr("placeholder")).toBe("DD/MM/YYYY"); | ||
input.val("12").triggerHandler("input"); | ||
expect(input.val()).toBe("12/MM/YYYY"); | ||
scope.$apply("placeholder = 'MM/DD/YYYY'"); | ||
expect(input.val()).toBe("12/DD/YYYY"); | ||
input.triggerHandler("blur"); | ||
expect(input.attr("placeholder")).toBe("MM/DD/YYYY"); | ||
}) | ||
@@ -358,0 +422,0 @@ }); |
Sorry, the diff of this file is not supported yet
110631
1646