Skip to content

Commit 879a075

Browse files
committed
test resolving the custom style maps
1 parent 6e9f73e commit 879a075

File tree

1 file changed

+37
-1
lines changed
  • draft-js-plugins-editor/src/Editor/__test__

1 file changed

+37
-1
lines changed

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

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('Editor', () => {
7373
});
7474
});
7575

76-
describe('with a plugin', () => {
76+
describe('with plugins', () => {
7777
let onChange;
7878
let editorState;
7979

@@ -239,6 +239,42 @@ describe('Editor', () => {
239239
expect(plugin.keyBindingFn).has.been.calledOnce();
240240
expect(plugin.keyBindingFn).has.been.calledWith('command', pluginEditor.getEditorState, pluginEditor.onChange);
241241
});
242+
243+
it('combines the customStyleMaps from all plugins', () => {
244+
const plugins = [
245+
{
246+
customStyleMap: {
247+
orange: {
248+
color: 'rgba(255, 127, 0, 1.0)',
249+
},
250+
},
251+
},
252+
{
253+
customStyleMap: {
254+
yellow: {
255+
color: 'rgba(180, 180, 0, 1.0)',
256+
},
257+
},
258+
},
259+
];
260+
const result = mount(
261+
<PluginEditor
262+
editorState={ editorState }
263+
onChange={ onChange }
264+
plugins={ plugins }
265+
/>
266+
);
267+
const expected = {
268+
orange: {
269+
color: 'rgba(255, 127, 0, 1.0)',
270+
},
271+
yellow: {
272+
color: 'rgba(180, 180, 0, 1.0)',
273+
},
274+
};
275+
const pluginEditor = result.instance();
276+
expect(pluginEditor.resolveCustomStyleMap()).to.deep.equal(expected);
277+
});
242278
});
243279

244280
describe('passed proxy to DraftEditor', () => {

0 commit comments

Comments
 (0)