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 schema normalization bug for child_max_invalid
- Loading branch information
1 parent
03d531b
commit b33605e
Showing
4 changed files
with
178 additions
and
18 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
55 changes: 55 additions & 0 deletions
55
packages/slate/test/schema/custom/child-min-max-invalid-default.js
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,55 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../helpers/h' | ||
|
||
export const schema = { | ||
blocks: { | ||
paragraph: {}, | ||
title: {}, | ||
quote: { | ||
nodes: [ | ||
{ | ||
match: [{ type: 'title' }], | ||
min: 1, | ||
max: 1, | ||
}, | ||
{ | ||
match: [{ type: 'paragraph' }], | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<quote> | ||
<block type="title"> | ||
<text /> | ||
</block> | ||
<block type="title"> | ||
<text /> | ||
</block> | ||
<paragraph> | ||
<text /> | ||
</paragraph> | ||
</quote> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = ( | ||
<value> | ||
<document> | ||
<quote> | ||
<block type="title"> | ||
<text /> | ||
</block> | ||
<paragraph> | ||
<text /> | ||
</paragraph> | ||
</quote> | ||
</document> | ||
</value> | ||
) |
63 changes: 63 additions & 0 deletions
63
packages/slate/test/schema/custom/child-min-max-invalid-similar-valid.js
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,63 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../helpers/h' | ||
|
||
export const schema = { | ||
blocks: { | ||
heading: {}, | ||
quote: { | ||
nodes: [ | ||
{ | ||
match: [ | ||
{ | ||
type: 'heading', | ||
data: { level: v => v === 1 }, | ||
}, | ||
], | ||
min: 1, | ||
max: 1, | ||
}, | ||
{ | ||
match: [ | ||
{ | ||
type: 'heading', | ||
data: { level: v => v === 2 }, | ||
}, | ||
], | ||
min: 1, | ||
max: 1, | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<quote> | ||
<block type="heading" data={{ level: 1 }}> | ||
<text /> | ||
</block> | ||
<block type="heading" data={{ level: 2 }}> | ||
<text /> | ||
</block> | ||
</quote> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = ( | ||
<value> | ||
<document> | ||
<quote> | ||
<block type="heading" data={{ level: 1 }}> | ||
<text /> | ||
</block> | ||
<block type="heading" data={{ level: 2 }}> | ||
<text /> | ||
</block> | ||
</quote> | ||
</document> | ||
</value> | ||
) |
39 changes: 39 additions & 0 deletions
39
packages/slate/test/schema/custom/child-min-max-invalid-valid.js
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,39 @@ | ||
/** @jsx h */ | ||
|
||
import h from '../../helpers/h' | ||
|
||
export const schema = { | ||
blocks: { | ||
paragraph: {}, | ||
title: {}, | ||
quote: { | ||
nodes: [ | ||
{ | ||
match: [{ type: 'title' }], | ||
min: 1, | ||
max: 1, | ||
}, | ||
{ | ||
match: [{ type: 'paragraph' }], | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
|
||
export const input = ( | ||
<value> | ||
<document> | ||
<quote> | ||
<block type="title"> | ||
<text /> | ||
</block> | ||
<paragraph> | ||
<text /> | ||
</paragraph> | ||
</quote> | ||
</document> | ||
</value> | ||
) | ||
|
||
export const output = input |