forked from keystonejs/keystone
-
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.
Document field normalization, fixes and tests (keystonejs#4556)
* WIP * Finish things * Fix some stuff * Some more things * Remove debugger thing * Improve backspace on start of lists * Test infra * More tests * Tests for heading * Divider tests * code block tests * List tests and fixes * Some more tests * columns tests * Little columns test change * First component-blocks test * Clean up test utils * Remove some dead code * Normalization, insert break and delete backward tests for component blocks * Fix things * Cleanup some component-blocks things * Split out component blocks * Finish component block tests * Blockquote button fixes and update TODO * Heading fixes and TODO updates * Linting * Fix things * Divider improvements * Make caret transparent in divider * Update packages-next/fields-document/src/DocumentEditor/component-blocks/form.tsx * Fix an import * Actually fix an import * Fix another thing * Add an import Co-authored-by: Jed Watson <jed.watson@me.com>
- Loading branch information
Showing
40 changed files
with
5,159 additions
and
1,816 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
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
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
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
158 changes: 158 additions & 0 deletions
158
packages-next/fields-document/src/DocumentEditor/blockquote.test.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,158 @@ | ||
/** @jsx jsx */ | ||
import { jsx, makeEditor } from './tests/utils'; | ||
|
||
test('inserting a blockquote with a shortcut works', () => { | ||
let editor = makeEditor( | ||
<editor> | ||
<paragraph> | ||
<text> | ||
{'>'} | ||
<cursor /> | ||
</text> | ||
</paragraph> | ||
</editor> | ||
); | ||
|
||
editor.insertText(' '); | ||
editor.insertText('some content'); | ||
expect(editor).toMatchInlineSnapshot(` | ||
<editor> | ||
<blockquote> | ||
<paragraph> | ||
<text> | ||
some content | ||
<cursor /> | ||
</text> | ||
</paragraph> | ||
</blockquote> | ||
<paragraph> | ||
<text> | ||
</text> | ||
</paragraph> | ||
</editor> | ||
`); | ||
}); | ||
|
||
test('backspace at start of blockquote', () => { | ||
let editor = makeEditor( | ||
<editor> | ||
<blockquote> | ||
<paragraph> | ||
<text> | ||
<cursor /> | ||
some content | ||
</text> | ||
</paragraph> | ||
</blockquote> | ||
<paragraph> | ||
<text /> | ||
</paragraph> | ||
</editor> | ||
); | ||
|
||
editor.deleteBackward('character'); | ||
expect(editor).toMatchInlineSnapshot(` | ||
<editor> | ||
<paragraph> | ||
<text> | ||
<cursor /> | ||
some content | ||
</text> | ||
</paragraph> | ||
<paragraph> | ||
<text> | ||
</text> | ||
</paragraph> | ||
</editor> | ||
`); | ||
}); | ||
|
||
test('enter on empty line at end of blockquote exits blockquote', () => { | ||
let editor = makeEditor( | ||
<editor> | ||
<blockquote> | ||
<paragraph> | ||
<text> | ||
<cursor /> | ||
some content | ||
</text> | ||
</paragraph> | ||
</blockquote> | ||
<paragraph> | ||
<text /> | ||
</paragraph> | ||
</editor> | ||
); | ||
|
||
editor.deleteBackward('character'); | ||
expect(editor).toMatchInlineSnapshot(` | ||
<editor> | ||
<paragraph> | ||
<text> | ||
<cursor /> | ||
some content | ||
</text> | ||
</paragraph> | ||
<paragraph> | ||
<text> | ||
</text> | ||
</paragraph> | ||
</editor> | ||
`); | ||
}); | ||
|
||
test('enter on empty line in middle splits the blockquote', () => { | ||
let editor = makeEditor( | ||
<editor> | ||
<blockquote> | ||
<paragraph> | ||
<text>some content</text> | ||
</paragraph> | ||
<paragraph> | ||
<text> | ||
<cursor /> | ||
</text> | ||
</paragraph> | ||
<paragraph> | ||
<text>some content</text> | ||
</paragraph> | ||
</blockquote> | ||
<paragraph> | ||
<text /> | ||
</paragraph> | ||
</editor> | ||
); | ||
|
||
editor.insertBreak(); | ||
expect(editor).toMatchInlineSnapshot(` | ||
<editor> | ||
<blockquote> | ||
<paragraph> | ||
<text> | ||
some content | ||
</text> | ||
</paragraph> | ||
</blockquote> | ||
<paragraph> | ||
<text> | ||
<cursor /> | ||
</text> | ||
</paragraph> | ||
<blockquote> | ||
<paragraph> | ||
<text> | ||
some content | ||
</text> | ||
</paragraph> | ||
</blockquote> | ||
<paragraph> | ||
<text> | ||
</text> | ||
</paragraph> | ||
</editor> | ||
`); | ||
}); |
Oops, something went wrong.