This repository was archived by the owner on Oct 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ describe("draft-js-markdown-plugin", () => {
180180 expect ( subject ( ) ) . toBe ( "not-handled" ) ;
181181 } ) ;
182182
183- it ( "resets curent inline style" , ( ) => {
183+ it ( "resets current inline style" , ( ) => {
184184 currentRawContentState = {
185185 entityMap : { } ,
186186 blocks : [
@@ -545,6 +545,39 @@ describe("draft-js-markdown-plugin", () => {
545545 " "
546546 ) ;
547547 } ) ;
548+ it ( "unstickys inline style" , ( ) => {
549+ currentRawContentState = {
550+ entityMap : { } ,
551+ blocks : [
552+ {
553+ key : "item1" ,
554+ text : "item1" ,
555+ type : "unstyled" ,
556+ depth : 0 ,
557+ inlineStyleRanges : [
558+ { offset : 0 , length : 5 , style : "BOLD" } ,
559+ ] ,
560+ entityRanges : [ ] ,
561+ data : { } ,
562+ } ,
563+ ] ,
564+ } ;
565+
566+ currentSelectionState = currentSelectionState . merge ( {
567+ focusOffset : 5 ,
568+ anchorOffset : 5 ,
569+ } ) ;
570+
571+ expect ( subject ( ) ) . toBe ( "handled" ) ;
572+ expect ( store . setEditorState ) . toHaveBeenCalled ( ) ;
573+ newEditorState = store . setEditorState . mock . calls [ 0 ] [ 0 ] ;
574+ const block = newEditorState . getCurrentContent ( ) . getLastBlock ( ) ;
575+ const length = block . getLength ( ) ;
576+ expect ( block . getInlineStyleAt ( length - 1 ) . toJS ( ) ) . toEqual ( [ ] ) ;
577+ expect ( block . getInlineStyleAt ( length - 2 ) . toJS ( ) ) . toEqual ( [
578+ "BOLD" ,
579+ ] ) ;
580+ } ) ;
548581 } ) ;
549582 } ) ;
550583 describe ( "character is not a space" , ( ) => {
You can’t perform that action at this time.
0 commit comments