@@ -660,115 +660,6 @@ describe("draft-js-markdown-plugin", () => {
660660 expect ( store . setEditorState ) . toHaveBeenCalledWith ( newEditorState ) ;
661661 } ) ;
662662 } ) ;
663- describe ( "handlePastedText" , ( ) => {
664- let pastedText ;
665- let html ;
666- beforeEach ( ( ) => {
667- pastedText = `_hello world_
668- Hello` ;
669- html = undefined ;
670- subject = ( ) =>
671- plugin . handlePastedText (
672- pastedText ,
673- html ,
674- store . getEditorState ( ) ,
675- store
676- ) ;
677- } ) ;
678- [
679- "replaceText" ,
680- // TODO(@mxstbr): This broke when switching mocha->jest, fix it!
681- // 'insertEmptyBlock',
682- "handleBlockType" ,
683- "handleImage" ,
684- "handleLink" ,
685- "handleInlineStyle" ,
686- ] . forEach ( modifier => {
687- describe ( modifier , ( ) => {
688- beforeEach ( ( ) => {
689- createMarkdownPlugin . __Rewire__ ( modifier , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
690- } ) ;
691- it ( "returns handled" , ( ) => {
692- expect ( subject ( ) ) . toBe ( "handled" ) ;
693- expect ( modifierSpy ) . toHaveBeenCalled ( ) ;
694- } ) ;
695- } ) ;
696- } ) ;
697- describe ( "nothing in clipboard" , ( ) => {
698- beforeEach ( ( ) => {
699- pastedText = "" ;
700- } ) ;
701- it ( "returns not-handled" , ( ) => {
702- expect ( subject ( ) ) . toBe ( "not-handled" ) ;
703- } ) ;
704- } ) ;
705- describe ( "pasted just text" , ( ) => {
706- beforeEach ( ( ) => {
707- pastedText = "hello" ;
708- createMarkdownPlugin . __Rewire__ ( "replaceText" , modifierSpy ) ; // eslint-disable-line no-underscore-dangle
709- } ) ;
710- it ( "returns handled" , ( ) => {
711- expect ( subject ( ) ) . toBe ( "handled" ) ;
712- expect ( modifierSpy ) . toHaveBeenCalledWith (
713- currentEditorState ,
714- "hello"
715- ) ;
716- } ) ;
717- } ) ;
718- describe ( "pasted just text with new line code" , ( ) => {
719- beforeEach ( ( ) => {
720- pastedText = "hello\nworld" ;
721- const rawContentState = {
722- entityMap : { } ,
723- blocks : [
724- {
725- key : "item1" ,
726- text : "" ,
727- type : "unstyled" ,
728- depth : 0 ,
729- inlineStyleRanges : [ ] ,
730- entityRanges : [ ] ,
731- data : { } ,
732- } ,
733- ] ,
734- } ;
735- const otherRawContentState = {
736- entityMap : { } ,
737- blocks : [
738- {
739- key : "item2" ,
740- text : "H1" ,
741- type : "header-one" ,
742- depth : 0 ,
743- inlineStyleRanges : [ ] ,
744- entityRanges : [ ] ,
745- data : { } ,
746- } ,
747- ] ,
748- } ;
749- /* eslint-disable no-underscore-dangle */
750- createMarkdownPlugin . __Rewire__ ( "replaceText" , ( ) =>
751- createEditorState ( rawContentState , currentSelectionState )
752- ) ;
753- createMarkdownPlugin . __Rewire__ ( "checkReturnForState" , ( ) =>
754- createEditorState ( otherRawContentState , currentSelectionState )
755- ) ;
756- /* eslint-enable no-underscore-dangle */
757- } ) ;
758- it ( "return handled" , ( ) => {
759- expect ( subject ( ) ) . toBe ( "handled" ) ;
760- } ) ;
761- } ) ;
762- describe ( "passed `html` argument" , ( ) => {
763- beforeEach ( ( ) => {
764- pastedText = "# hello" ;
765- html = "<h1>hello</h1>" ;
766- } ) ;
767- it ( "returns not-handled" , ( ) => {
768- expect ( subject ( ) ) . toBe ( "not-handled" ) ;
769- } ) ;
770- } ) ;
771- } ) ;
772663 } ) ;
773664 } ) ;
774665} ) ;
0 commit comments