Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 96ac1a7

Browse files
committed
Add test case
1 parent b34da34 commit 96ac1a7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/__test__/plugin.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,27 @@ describe("draft-js-markdown-plugin", () => {
613613
expect(subject()).toBe("not-handled");
614614
});
615615
});
616+
it("handles new code block on space", () => {
617+
createMarkdownPlugin.__Rewire__("handleNewCodeBlock", modifierSpy); // eslint-disable-line no-underscore-dangle
618+
currentRawContentState = {
619+
entityMap: {},
620+
blocks: [
621+
{
622+
key: "item1",
623+
text: "```",
624+
type: "unstyled",
625+
depth: 0,
626+
inlineStyleRanges: [],
627+
entityRanges: [],
628+
data: {},
629+
},
630+
],
631+
};
632+
character = " ";
633+
expect(subject()).toBe("handled");
634+
expect(modifierSpy).toHaveBeenCalledTimes(1);
635+
expect(store.setEditorState).toHaveBeenCalledWith(newEditorState);
636+
});
616637
});
617638
describe("handlePastedText", () => {
618639
let pastedText;

0 commit comments

Comments
 (0)