@@ -6,22 +6,22 @@ import {
66} from "draft-js-checkable-list-item" ;
77
88import { Map , List } from "immutable" ;
9- import createMarkdownShortcutsPlugin from "../" ;
9+ import createMarkdownPlugin from "../" ;
1010
11- describe ( "draft-js-markdown-shortcuts- plugin" , ( ) => {
11+ describe ( "draft-js-markdown-plugin" , ( ) => {
1212 afterEach ( ( ) => {
1313 /* eslint-disable no-underscore-dangle */
14- createMarkdownShortcutsPlugin . __ResetDependency__ ( "adjustBlockDepth" ) ;
15- createMarkdownShortcutsPlugin . __ResetDependency__ ( "handleBlockType" ) ;
16- createMarkdownShortcutsPlugin . __ResetDependency__ ( "handleInlineStyle" ) ;
17- createMarkdownShortcutsPlugin . __ResetDependency__ ( "handleNewCodeBlock" ) ;
18- createMarkdownShortcutsPlugin . __ResetDependency__ ( "insertEmptyBlock" ) ;
19- createMarkdownShortcutsPlugin . __ResetDependency__ ( "handleLink" ) ;
20- createMarkdownShortcutsPlugin . __ResetDependency__ ( "handleImage" ) ;
21- createMarkdownShortcutsPlugin . __ResetDependency__ ( "leaveList" ) ;
22- createMarkdownShortcutsPlugin . __ResetDependency__ ( "changeCurrentBlockType" ) ;
23- createMarkdownShortcutsPlugin . __ResetDependency__ ( "replaceText" ) ;
24- createMarkdownShortcutsPlugin . __ResetDependency__ ( "checkReturnForState" ) ;
14+ createMarkdownPlugin . __ResetDependency__ ( "adjustBlockDepth" ) ;
15+ createMarkdownPlugin . __ResetDependency__ ( "handleBlockType" ) ;
16+ createMarkdownPlugin . __ResetDependency__ ( "handleInlineStyle" ) ;
17+ createMarkdownPlugin . __ResetDependency__ ( "handleNewCodeBlock" ) ;
18+ createMarkdownPlugin . __ResetDependency__ ( "insertEmptyBlock" ) ;
19+ createMarkdownPlugin . __ResetDependency__ ( "handleLink" ) ;
20+ createMarkdownPlugin . __ResetDependency__ ( "handleImage" ) ;
21+ createMarkdownPlugin . __ResetDependency__ ( "leaveList" ) ;
22+ createMarkdownPlugin . __ResetDependency__ ( "changeCurrentBlockType" ) ;
23+ createMarkdownPlugin . __ResetDependency__ ( "replaceText" ) ;
24+ createMarkdownPlugin . __ResetDependency__ ( "checkReturnForState" ) ;
2525 /* eslint-enable no-underscore-dangle */
2626 } ) ;
2727
@@ -93,11 +93,11 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
9393
9494 describe ( args . length === 0 ? "without config" : "with config" , ( ) => {
9595 beforeEach ( ( ) => {
96- plugin = createMarkdownShortcutsPlugin ( ...args ) ;
96+ plugin = createMarkdownPlugin ( ...args ) ;
9797 } ) ;
9898
9999 it ( "is loaded" , ( ) => {
100- expect ( typeof createMarkdownShortcutsPlugin ) . toBe ( "function" ) ;
100+ expect ( typeof createMarkdownPlugin ) . toBe ( "function" ) ;
101101 } ) ;
102102 it ( "initialize" , ( ) => {
103103 plugin . initialize ( store ) ;
@@ -128,7 +128,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
128128 expect ( store . setEditorState ) . not . toHaveBeenCalled ( ) ;
129129 } ) ;
130130 it ( "leaves from list" , ( ) => {
131- createMarkdownShortcutsPlugin . __Rewire__ ( "leaveList" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
131+ createMarkdownPlugin . __Rewire__ ( "leaveList" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
132132 currentRawContentState = {
133133 entityMap : { } ,
134134 blocks : [
@@ -148,10 +148,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
148148 expect ( store . setEditorState ) . toHaveBeenCalledWith ( newEditorState ) ;
149149 } ) ;
150150 const testInsertNewBlock = type => ( ) => {
151- createMarkdownShortcutsPlugin . __Rewire__ (
152- "insertEmptyBlock" ,
153- modifierSpy
154- ) ; // eslint-disable-line no-underscore-dangle
151+ createMarkdownPlugin . __Rewire__ ( "insertEmptyBlock" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
155152 currentRawContentState = {
156153 entityMap : { } ,
157154 blocks : [
@@ -189,10 +186,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
189186 } ) ;
190187 } ) ;
191188 it ( "handles new code block" , ( ) => {
192- createMarkdownShortcutsPlugin . __Rewire__ (
193- "handleNewCodeBlock" ,
194- modifierSpy
195- ) ; // eslint-disable-line no-underscore-dangle
189+ createMarkdownPlugin . __Rewire__ ( "handleNewCodeBlock" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
196190 currentRawContentState = {
197191 entityMap : { } ,
198192 blocks : [
@@ -212,7 +206,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
212206 expect ( store . setEditorState ) . toHaveBeenCalledWith ( newEditorState ) ;
213207 } ) ;
214208 it ( "handle code block closing" , ( ) => {
215- createMarkdownShortcutsPlugin . __Rewire__ (
209+ createMarkdownPlugin . __Rewire__ (
216210 "changeCurrentBlockType" ,
217211 modifierSpy
218212 ) ; // eslint-disable-line no-underscore-dangle
@@ -234,7 +228,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
234228 expect ( modifierSpy ) . toHaveBeenCalledTimes ( 1 ) ;
235229 } ) ;
236230 it ( "insert new line char from code-block" , ( ) => {
237- createMarkdownShortcutsPlugin . __Rewire__ ( "insertText" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
231+ createMarkdownPlugin . __Rewire__ ( "insertText" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
238232 currentRawContentState = {
239233 entityMap : { } ,
240234 blocks : [
@@ -317,10 +311,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
317311 describe ( "onTab" , ( ) => {
318312 beforeEach ( ( ) => {
319313 subject = ( ) => {
320- createMarkdownShortcutsPlugin . __Rewire__ (
321- "adjustBlockDepth" ,
322- modifierSpy
323- ) ; // eslint-disable-line no-underscore-dangle
314+ createMarkdownPlugin . __Rewire__ ( "adjustBlockDepth" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
324315 return plugin . onTab ( event , store ) ;
325316 } ;
326317 } ) ;
@@ -349,7 +340,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
349340 ] . forEach ( modifier => {
350341 describe ( modifier , ( ) => {
351342 beforeEach ( ( ) => {
352- createMarkdownShortcutsPlugin . __Rewire__ ( modifier , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
343+ createMarkdownPlugin . __Rewire__ ( modifier , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
353344 } ) ;
354345 it ( "returns handled" , ( ) => {
355346 expect ( subject ( ) ) . toBe ( "handled" ) ;
@@ -397,7 +388,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
397388 ] . forEach ( modifier => {
398389 describe ( modifier , ( ) => {
399390 beforeEach ( ( ) => {
400- createMarkdownShortcutsPlugin . __Rewire__ ( modifier , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
391+ createMarkdownPlugin . __Rewire__ ( modifier , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
401392 } ) ;
402393 it ( "returns handled" , ( ) => {
403394 expect ( subject ( ) ) . toBe ( "handled" ) ;
@@ -416,10 +407,7 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
416407 describe ( "pasted just text" , ( ) => {
417408 beforeEach ( ( ) => {
418409 pastedText = "hello" ;
419- createMarkdownShortcutsPlugin . __Rewire__ (
420- "replaceText" ,
421- modifierSpy
422- ) ; // eslint-disable-line no-underscore-dangle
410+ createMarkdownPlugin . __Rewire__ ( "replaceText" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
423411 } ) ;
424412 it ( "returns handled" , ( ) => {
425413 expect ( subject ( ) ) . toBe ( "handled" ) ;
@@ -461,13 +449,11 @@ describe("draft-js-markdown-shortcuts-plugin", () => {
461449 ] ,
462450 } ;
463451 /* eslint-disable no-underscore-dangle */
464- createMarkdownShortcutsPlugin . __Rewire__ ( "replaceText" , ( ) =>
452+ createMarkdownPlugin . __Rewire__ ( "replaceText" , ( ) =>
465453 createEditorState ( rawContentState , currentSelectionState )
466454 ) ;
467- createMarkdownShortcutsPlugin . __Rewire__ (
468- "checkReturnForState" ,
469- ( ) =>
470- createEditorState ( otherRawContentState , currentSelectionState )
455+ createMarkdownPlugin . __Rewire__ ( "checkReturnForState" , ( ) =>
456+ createEditorState ( otherRawContentState , currentSelectionState )
471457 ) ;
472458 /* eslint-enable no-underscore-dangle */
473459 } ) ;
0 commit comments