File tree Expand file tree Collapse file tree
packages/devextreme-react/src/core/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1042,6 +1042,38 @@ describe('cfg-component option control', () => {
10421042 expect ( ( optionsManager as any ) . setValue ) . toHaveBeenCalledTimes ( 1 ) ;
10431043 } ) ;
10441044
1045+ it ( 'does not crash when option change handler unmounts component (T1327953)' , ( ) => {
1046+ const optionsManager = new OptionsManagerModule . OptionsManager ( ) ;
1047+ const config = {
1048+ name : '' ,
1049+ predefinedOptions : { } ,
1050+ initialOptions : { } ,
1051+ options : {
1052+ value : 1 ,
1053+ onValueChange : ( ) => {
1054+ optionsManager . dispose ( ) ;
1055+ } ,
1056+ } ,
1057+ templates : [ ] ,
1058+ configs : { } ,
1059+ configCollections : { } ,
1060+ } ;
1061+
1062+ optionsManager . setInstance ( {
1063+ skipOptionsRollBack : false ,
1064+ option : jest . fn ( ) ,
1065+ resetOption : jest . fn ( ) ,
1066+ on : jest . fn ( ) ,
1067+ off : jest . fn ( ) ,
1068+ beginUpdate : jest . fn ( ) ,
1069+ endUpdate : jest . fn ( ) ,
1070+ } , config , [ 'value' ] , [ ] ) ;
1071+
1072+ expect ( ( ) => {
1073+ optionsManager . onOptionChanged ( { name : 'value' , value : 2 , fullName : 'value' } ) ;
1074+ } ) . not . toThrow ( ) ;
1075+ } ) ;
1076+
10451077 it ( 'apply cfg-component option change if value really change' , ( ) => {
10461078 const TestContainer = ( props : any ) => {
10471079 const { value } = props ;
You can’t perform that action at this time.
0 commit comments