File tree Expand file tree Collapse file tree 3 files changed +36
-8
lines changed Expand file tree Collapse file tree 3 files changed +36
-8
lines changed Original file line number Diff line number Diff line change 1010 mixins: [ abstractField ],
1111
1212 ready () {
13- if ($ .fn .mask )
14- $ (this .$el ).mask (" destroy" ).mask (this .schema .mask , this .schema .maskOptions );
13+ if ($ .fn .mask ) {
14+ $ (this .$el ).unmask ().mask (this .schema .mask , this .schema .maskOptions );
15+ }
1516 else
1617 console .warn (" JQuery MaskedInput library is missing. Please download from https://github.com/digitalBush/jquery.maskedinput and load the script in the HTML head section!" );
1718 }
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ describe("fieldMasked.vue", () => {
2828
2929 before ( ( ) => {
3030 createField ( schema , model , false ) ;
31+ vm . $appendTo ( document . body ) ;
3132 input = el . getElementsByTagName ( "input" ) [ 0 ] ;
3233 } ) ;
3334
@@ -54,15 +55,25 @@ describe("fieldMasked.vue", () => {
5455 schema . readonly = true ;
5556 vm . $nextTick ( ( ) => {
5657 expect ( input . readOnly ) . to . be . true ;
57- done ( ) ;
58+
59+ // Rollback
60+ schema . readonly = false ;
61+ vm . $nextTick ( ( ) => {
62+ done ( ) ;
63+ } ) ;
5864 } ) ;
5965 } ) ;
6066
6167 it ( "should set disabled" , ( done ) => {
6268 field . disabled = true ;
6369 vm . $nextTick ( ( ) => {
6470 expect ( input . disabled ) . to . be . true ;
65- done ( ) ;
71+
72+ // Rollback
73+ field . disabled = false ;
74+ vm . $nextTick ( ( ) => {
75+ done ( ) ;
76+ } ) ;
6677 } ) ;
6778 } ) ;
6879
@@ -86,6 +97,25 @@ describe("fieldMasked.vue", () => {
8697
8798 } ) ;
8899
100+ it ( "should be formatted data in model" , ( done ) => {
101+ input . value = "123456789" ;
102+ // Call the paste event what trigger the formatter
103+ let $input = window . jQuery ( input ) ;
104+ $input . trigger ( window . jQuery . Event ( "paste" ) ) ;
105+
106+ setTimeout ( ( ) => {
107+ expect ( input . value ) . to . be . equal ( "(12) 345-6789" ) ;
108+ trigger ( input , "input" ) ;
109+
110+ vm . $nextTick ( ( ) => {
111+ expect ( model . phone ) . to . be . equal ( "(12) 345-6789" ) ;
112+ done ( ) ;
113+ } ) ;
114+
115+ } , 10 ) ;
116+
117+ } ) ;
118+
89119 } ) ;
90120
91121} ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ describe("fieldNoUiSlider.vue", () => {
2828
2929 before ( ( ) => {
3030 createField ( schema , model , false ) ;
31+ vm . $appendTo ( document . body ) ;
3132 input = el . getElementsByClassName ( "slider" ) [ 0 ] ;
3233 } ) ;
3334
@@ -40,10 +41,6 @@ describe("fieldNoUiSlider.vue", () => {
4041 expect ( input . disabled ) . to . be . undefined ;
4142 } ) ;
4243
43- before ( ( ) => {
44- vm . $appendTo ( document . body ) ;
45- } ) ;
46-
4744 it ( "should contain an handle element" , ( done ) => {
4845 if ( window . noUiSlider ) {
4946 vm . $nextTick ( ( ) => {
You can’t perform that action at this time.
0 commit comments