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

Commit 1e229e9

Browse files
committed
share md change test util
1 parent c58601e commit 1e229e9

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

Diff for: src/__test__/plugin-new.test.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import Draft, { EditorState, SelectionState, convertToRaw } from "draft-js";
22
import createMarkdownPlugin from "../";
3-
4-
const applyMDtoInlineStyleChange = editorState =>
5-
EditorState.set(editorState, {
6-
lastChangeType: "md-to-inline-style",
7-
});
3+
import { applyMDtoInlineStyleChange } from "./utils";
84

95
describe("markdown", () => {
106
it("should convert asteriks to bold text", () => {

Diff for: src/__test__/plugin.test.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
CheckableListItem,
44
CheckableListItemUtils,
55
} from "draft-js-checkable-list-item";
6+
import { applyMDtoInlineStyleChange } from "./utils";
67

78
import {
89
defaultInlineWhitelist,
@@ -13,11 +14,6 @@ import {
1314
import { Map, List } from "immutable";
1415
import createMarkdownPlugin from "../";
1516

16-
const applyMDtoInlineStyleChange = editorState =>
17-
EditorState.set(editorState, {
18-
lastChangeType: "md-to-inline-style",
19-
});
20-
2117
describe("draft-js-markdown-plugin", () => {
2218
afterEach(() => {
2319
/* eslint-disable no-underscore-dangle */

Diff for: src/__test__/utils.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { EditorState } from "draft-js";
2+
3+
export const applyMDtoInlineStyleChange = editorState =>
4+
EditorState.set(editorState, {
5+
lastChangeType: "md-to-inline-style",
6+
});

0 commit comments

Comments
 (0)