Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
Add extra test for orphan cells #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Soreine committed Sep 20, 2017
1 parent 2e721a5 commit cd742ec
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/schema-orphan-cells/expected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

nodes:
# A cell without surrounding row get wrapped in rows
- kind: block
type: table
data:
align:
- left
nodes:
- kind: block
type: table_row
nodes:
- kind: block
type: table_cell
nodes:
- kind: text
text: "Cell 1"
- kind: block
type: table
data:
align:
- left
nodes:
- kind: block
type: table_row
nodes:
- kind: block
type: table_cell
nodes:
- kind: text
text: "Cell 2"
13 changes: 13 additions & 0 deletions tests/schema-orphan-cells/input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

nodes:
# A cell without surrounding row get wrapped in rows
- kind: block
type: table_cell
nodes:
- kind: text
text: "Cell 1"
- kind: block
type: table_cell
nodes:
- kind: text
text: "Cell 2"
8 changes: 8 additions & 0 deletions tests/schema-orphan-cells/transform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const Slate = require('slate');

module.exports = function(plugin, state) {
const schema = new Slate.Schema(plugin.schema);
return state.transform()
.normalize(schema)
.apply();
};

0 comments on commit cd742ec

Please sign in to comment.