@@ -32,7 +32,11 @@ describe('Mentions', () => {
3232
3333    it ( 'not lose focus if click on dropdown' ,  ( )  =>  { 
3434      const  onBlur  =  jest . fn ( ) ; 
35-       const  wrapper  =  createMentions ( {  autoFocus : true ,  defaultValue : '@' ,  onBlur } ) ; 
35+       const  wrapper  =  createMentions ( { 
36+         autoFocus : true , 
37+         defaultValue : '@' , 
38+         onBlur, 
39+       } ) ; 
3640
3741      // Inject to trigger measure 
3842      wrapper . instance ( ) . startMeasure ( 'b' ,  '@' ,  1 ) ; 
@@ -45,22 +49,22 @@ describe('Mentions', () => {
4549      wrapper . find ( 'textarea' ) . simulate ( 'focus' ) ;  // This is not good but code focus not work in simulate 
4650      jest . runAllTimers ( ) ; 
4751
48-       expect ( onBlur ) . not . toBeCalled ( ) ; 
52+       expect ( onBlur ) . not . toHaveBeenCalled ( ) ; 
4953    } ) ; 
5054
5155    it ( 'focus' ,  ( )  =>  { 
5256      const  onFocus  =  jest . fn ( ) ; 
5357      const  wrapper  =  createMentions ( {  onFocus } ) ; 
5458      wrapper . find ( 'textarea' ) . simulate ( 'focus' ) ; 
55-       expect ( onFocus ) . toBeCalled ( ) ; 
59+       expect ( onFocus ) . toHaveBeenCalled ( ) ; 
5660    } ) ; 
5761
5862    it ( 'blur' ,  ( )  =>  { 
5963      const  onBlur  =  jest . fn ( ) ; 
6064      const  wrapper  =  createMentions ( {  onBlur } ) ; 
6165      wrapper . find ( 'textarea' ) . simulate ( 'blur' ) ; 
6266      jest . runAllTimers ( ) ; 
63-       expect ( onBlur ) . toBeCalled ( ) ; 
67+       expect ( onBlur ) . toHaveBeenCalled ( ) ; 
6468    } ) ; 
6569
6670    it ( 'focus() & blur()' ,  ( )  =>  { 
@@ -69,7 +73,9 @@ describe('Mentions', () => {
6973      expect ( document . activeElement ) . toBe ( wrapper . find ( 'textarea' ) . instance ( ) ) ; 
7074
7175      wrapper . instance ( ) . blur ( ) ; 
72-       expect ( document . activeElement ) . not . toBe ( wrapper . find ( 'textarea' ) . instance ( ) ) ; 
76+       expect ( document . activeElement ) . not . toBe ( 
77+         wrapper . find ( 'textarea' ) . instance ( ) , 
78+       ) ; 
7379    } ) ; 
7480  } ) ; 
7581
@@ -85,6 +91,9 @@ describe('Mentions', () => {
8591
8692      wrapper . setProps ( {  value : 'cat'  } ) ; 
8793      expect ( wrapper . find ( 'textarea' ) . props ( ) . value ) . toBe ( 'cat' ) ; 
94+ 
95+       wrapper . setProps ( {  value : undefined  } ) ; 
96+       expect ( wrapper . find ( 'textarea' ) . props ( ) . value ) . toBe ( '' ) ; 
8897    } ) ; 
8998
9099    it ( 'onChange' ,  ( )  =>  { 
@@ -93,7 +102,7 @@ describe('Mentions', () => {
93102      wrapper . find ( 'textarea' ) . simulate ( 'change' ,  { 
94103        target : {  value : 'bamboo'  } , 
95104      } ) ; 
96-       expect ( onChange ) . toBeCalledWith ( 'bamboo' ) ; 
105+       expect ( onChange ) . toHaveBeenCalledWith ( 'bamboo' ) ; 
97106    } ) ; 
98107  } ) ; 
99108
@@ -105,7 +114,9 @@ describe('Mentions', () => {
105114    } ) ; 
106115
107116    it ( 'function' ,  ( )  =>  { 
108-       const  wrapper  =  createMentions ( {  filterOption : ( _ ,  {  value } )  =>  value . includes ( 'a' )  } ) ; 
117+       const  wrapper  =  createMentions ( { 
118+         filterOption : ( _ ,  {  value } )  =>  value . includes ( 'a' ) , 
119+       } ) ; 
109120      simulateInput ( wrapper ,  '@notExist' ) ; 
110121      expect ( wrapper . find ( 'DropdownMenu' ) . props ( ) . options . length ) . toBe ( 2 ) ; 
111122    } ) ; 
0 commit comments