Skip to content

Commit 1992e85

Browse files
committed
fix testsuite
1 parent 2376dd6 commit 1992e85

File tree

1 file changed

+14
-6
lines changed
  • draft-js-plugins-editor/src/Editor/__test__

1 file changed

+14
-6
lines changed

draft-js-plugins-editor/src/Editor/__test__/index.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,22 @@ describe('Editor', () => {
136136
const pluginEditor = result.instance();
137137
const draftEditor = result.node;
138138
const plugin = plugins[0];
139+
const expectedSecondArgument = {
140+
getEditorState: pluginEditor.getEditorState,
141+
setEditorState: pluginEditor.onChange,
142+
};
139143
draftEditor.props.handleKeyCommand('command');
140144
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);
142146
draftEditor.props.handlePastedText('command');
143147
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);
145149
draftEditor.props.handleReturn('command');
146150
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);
148152
draftEditor.props.handleDrop('command');
149153
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);
151155
});
152156

153157
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', () => {
232236
const pluginEditor = result.instance();
233237
const draftEditor = result.node;
234238
const plugin = plugins[0];
239+
const expectedSecondArgument = {
240+
getEditorState: pluginEditor.getEditorState,
241+
setEditorState: pluginEditor.onChange,
242+
};
235243
draftEditor.props.blockRendererFn('command');
236244
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);
238246
draftEditor.props.keyBindingFn('command');
239247
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);
241249
});
242250

243251
it('combines the customStyleMaps from all plugins', () => {

0 commit comments

Comments
 (0)