@@ -136,18 +136,22 @@ describe('Editor', () => {
136
136
const pluginEditor = result . instance ( ) ;
137
137
const draftEditor = result . node ;
138
138
const plugin = plugins [ 0 ] ;
139
+ const expectedSecondArgument = {
140
+ getEditorState : pluginEditor . getEditorState ,
141
+ setEditorState : pluginEditor . onChange ,
142
+ } ;
139
143
draftEditor . props . handleKeyCommand ( 'command' ) ;
140
144
expect ( plugin . handleKeyCommand ) . has . been . calledOnce ( ) ;
141
- expect ( plugin . handleKeyCommand ) . has . been . calledWith ( 'command' , pluginEditor . getEditorState , pluginEditor . onChange ) ;
145
+ expect ( plugin . handleKeyCommand ) . has . been . calledWith ( 'command' , expectedSecondArgument ) ;
142
146
draftEditor . props . handlePastedText ( 'command' ) ;
143
147
expect ( plugin . handlePastedText ) . has . been . calledOnce ( ) ;
144
- expect ( plugin . handlePastedText ) . has . been . calledWith ( 'command' , pluginEditor . getEditorState , pluginEditor . onChange ) ;
148
+ expect ( plugin . handlePastedText ) . has . been . calledWith ( 'command' , expectedSecondArgument ) ;
145
149
draftEditor . props . handleReturn ( 'command' ) ;
146
150
expect ( plugin . handleReturn ) . has . been . calledOnce ( ) ;
147
- expect ( plugin . handleReturn ) . has . been . calledWith ( 'command' , pluginEditor . getEditorState , pluginEditor . onChange ) ;
151
+ expect ( plugin . handleReturn ) . has . been . calledWith ( 'command' , expectedSecondArgument ) ;
148
152
draftEditor . props . handleDrop ( 'command' ) ;
149
153
expect ( plugin . handleDrop ) . has . been . calledOnce ( ) ;
150
- expect ( plugin . handleDrop ) . has . been . calledWith ( 'command' , pluginEditor . getEditorState , pluginEditor . onChange ) ;
154
+ expect ( plugin . handleDrop ) . has . been . calledWith ( 'command' , expectedSecondArgument ) ;
151
155
} ) ;
152
156
153
157
it ( 'calls the handle- and on-hooks of the first plugin and not the second in case it was handeled' , ( ) => {
@@ -232,12 +236,16 @@ describe('Editor', () => {
232
236
const pluginEditor = result . instance ( ) ;
233
237
const draftEditor = result . node ;
234
238
const plugin = plugins [ 0 ] ;
239
+ const expectedSecondArgument = {
240
+ getEditorState : pluginEditor . getEditorState ,
241
+ setEditorState : pluginEditor . onChange ,
242
+ } ;
235
243
draftEditor . props . blockRendererFn ( 'command' ) ;
236
244
expect ( plugin . blockRendererFn ) . has . been . calledOnce ( ) ;
237
- expect ( plugin . blockRendererFn ) . has . been . calledWith ( 'command' , pluginEditor . getEditorState , pluginEditor . onChange ) ;
245
+ expect ( plugin . blockRendererFn ) . has . been . calledWith ( 'command' , expectedSecondArgument ) ;
238
246
draftEditor . props . keyBindingFn ( 'command' ) ;
239
247
expect ( plugin . keyBindingFn ) . has . been . calledOnce ( ) ;
240
- expect ( plugin . keyBindingFn ) . has . been . calledWith ( 'command' , pluginEditor . getEditorState , pluginEditor . onChange ) ;
248
+ expect ( plugin . keyBindingFn ) . has . been . calledWith ( 'command' , expectedSecondArgument ) ;
241
249
} ) ;
242
250
243
251
it ( 'combines the customStyleMaps from all plugins' , ( ) => {
0 commit comments