forked from ianstormtaylor/slate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix reporting of marks on a markableVoid (ianstormtaylor#5186)
Add a few unit tests for Editor.marks(), including one for markable void that fails
- Loading branch information
1 parent
fbc9838
commit e416d00
Showing
6 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'slate': patch | ||
--- | ||
|
||
Report marks applied to a markableVoid if selection is collapsed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/slate/test/interfaces/Editor/marks/markable-void-collapsed.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** @jsx jsx */ | ||
import { Editor } from 'slate' | ||
import { jsx } from '../../..' | ||
|
||
export const input = ( | ||
<editor> | ||
<block> | ||
<text>word</text> | ||
<inline void markable> | ||
<text bold /> | ||
<cursor /> | ||
</inline> | ||
<text /> | ||
</block> | ||
</editor> | ||
) | ||
export const test = editor => { | ||
editor.markableVoid = node => node.markable | ||
return Editor.marks(editor) | ||
} | ||
export const output = { bold: true } |
32 changes: 32 additions & 0 deletions
32
packages/slate/test/interfaces/Editor/marks/markable-voids-mixed.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** @jsx jsx */ | ||
import { Editor } from 'slate' | ||
import { jsx } from '../../..' | ||
|
||
export const input = ( | ||
<editor> | ||
<block> | ||
<text>word</text> | ||
<inline void markable> | ||
<anchor /> | ||
<text bold /> | ||
</inline> | ||
<text bold> | ||
<anchor /> | ||
bold | ||
</text> | ||
<inline void markable> | ||
<text bold italic /> | ||
</inline> | ||
<text bold italic> | ||
bold italic | ||
<focus /> | ||
</text> | ||
<text /> | ||
</block> | ||
</editor> | ||
) | ||
export const test = editor => { | ||
editor.markableVoid = node => node.markable | ||
return Editor.marks(editor) | ||
} | ||
export const output = { bold: true } |
24 changes: 24 additions & 0 deletions
24
packages/slate/test/interfaces/Editor/marks/mixed-text.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** @jsx jsx */ | ||
import { Editor } from 'slate' | ||
import { jsx } from '../../..' | ||
|
||
export const input = ( | ||
<editor> | ||
<block> | ||
plain | ||
<text bold> | ||
<anchor /> | ||
bold | ||
</text> | ||
<text bold italic> | ||
bold italic | ||
<focus /> | ||
</text> | ||
</block> | ||
<block>block two</block> | ||
</editor> | ||
) | ||
export const test = editor => { | ||
return Editor.marks(editor) | ||
} | ||
export const output = { bold: true } |
24 changes: 24 additions & 0 deletions
24
packages/slate/test/interfaces/Editor/marks/text-collapsed.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** @jsx jsx */ | ||
import { Editor } from 'slate' | ||
import { jsx } from '../../..' | ||
|
||
export const input = ( | ||
<editor> | ||
<block> | ||
plain | ||
<text bold> | ||
text that is | ||
<cursor /> | ||
bold | ||
</text> | ||
<text bold italic> | ||
bold italic | ||
</text> | ||
</block> | ||
<block>block two</block> | ||
</editor> | ||
) | ||
export const test = editor => { | ||
return Editor.marks(editor) | ||
} | ||
export const output = { bold: true } |