File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 339339 this .cachedPlaceHolder = this .currentPlaceholder = val;
340340 },
341341
342- value (val ) {
342+ value (val , oldVal ) {
343343 if (this .multiple ) {
344344 this .resetInputHeight ();
345345 if (val .length > 0 || (this .$refs .input && this .query !== ' ' )) {
356356 if (this .filterable && ! this .multiple ) {
357357 this .inputLength = 20 ;
358358 }
359+ if (! valueEquals (val, oldVal)) {
360+ this .dispatch (' ElFormItem' , ' el.form.change' , val);
361+ }
359362 },
360363
361364 visible (val ) {
503506 emitChange (val ) {
504507 if (! valueEquals (this .value , val)) {
505508 this .$emit (' change' , val);
506- this .dispatch (' ElFormItem' , ' el.form.change' , val);
507509 }
508510 },
509511
Original file line number Diff line number Diff line change @@ -380,15 +380,19 @@ describe('Form', () => {
380380 expect ( valid ) . to . false ;
381381 setTimeout ( _ => {
382382 expect ( field . validateMessage ) . to . equal ( '请选择活动区域' ) ;
383- // programatic modification of bound value does not triggers change validation
383+ // programatic modification triggers change validation
384384 vm . form . region = 'shanghai' ;
385385 setTimeout ( _ => {
386- expect ( field . validateMessage ) . to . equal ( '请选择活动区域' ) ;
387- // user modification of bound value triggers change validation
388- vm . $refs . opt . $el . click ( ) ;
386+ expect ( field . validateMessage ) . to . equal ( '' ) ;
387+ vm . form . region = '' ;
389388 setTimeout ( _ => {
390- expect ( field . validateMessage ) . to . equal ( '' ) ;
391- done ( ) ;
389+ expect ( field . validateMessage ) . to . equal ( '请选择活动区域' ) ;
390+ // user modification of bound value triggers change validation
391+ vm . $refs . opt . $el . click ( ) ;
392+ setTimeout ( _ => {
393+ expect ( field . validateMessage ) . to . equal ( '' ) ;
394+ done ( ) ;
395+ } , 100 ) ;
392396 } , 100 ) ;
393397 } , 100 ) ;
394398 } , 100 ) ;
You can’t perform that action at this time.
0 commit comments