1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-11 01:33:58 +02:00

fix html serializer tests

This commit is contained in:
Ian Storm Taylor
2016-07-17 16:02:12 -07:00
parent c489eee418
commit 0b001cd09d
11 changed files with 212 additions and 190 deletions

View File

@@ -1,23 +1,25 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'blockquote': {
case 'blockquote': { return {
return { kind: 'block',
kind: 'block', type: 'quote',
type: 'quote', nodes: next(el.children)
nodes: next(el.children) }
} }
} }
} }
} }
} ]
] }

View File

@@ -1,17 +1,19 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
data: { key: 'value' }, type: 'paragraph',
nodes: next(el.children) data: { key: 'value' },
nodes: next(el.children)
}
} }
} }
} }
} }
} ]
] }

View File

@@ -1,16 +1,18 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
isVoid: true type: 'paragraph',
isVoid: true
}
} }
} }
} }
} }
} ]
] }

View File

@@ -1,16 +1,18 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} }
} }
} }
} ]
] }

View File

@@ -1,30 +1,32 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'a': {
case 'a': { return {
return { kind: 'inline',
kind: 'inline', type: 'link',
type: 'link', nodes: next(el.children)
nodes: next(el.children) }
} }
} case 'b': {
case 'b': { return {
return { kind: 'inline',
kind: 'inline', type: 'hashtag',
type: 'hashtag', nodes: next(el.children)
nodes: next(el.children) }
} }
} }
} }
} }
} ]
] }

View File

@@ -1,26 +1,28 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'a': {
case 'a': { return {
return { kind: 'inline',
kind: 'inline', type: 'link',
type: 'link', nodes: next(el.children),
nodes: next(el.children), data: {
data: { href: el.attribs.href
href: el.attribs.href }
} }
} }
} }
} }
} }
} ]
] }

View File

@@ -1,23 +1,25 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'a': {
case 'a': { return {
return { kind: 'inline',
kind: 'inline', type: 'link',
type: 'link', isVoid: true
isVoid: true }
} }
} }
} }
} }
} ]
] }

View File

@@ -1,23 +1,25 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'a': {
case 'a': { return {
return { kind: 'inline',
kind: 'inline', type: 'link',
type: 'link', nodes: next(el.children)
nodes: next(el.children) }
} }
} }
} }
} }
} ]
] }

View File

@@ -1,30 +1,32 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'em': {
case 'em': { return {
return { kind: 'mark',
kind: 'mark', type: 'italic',
type: 'italic', nodes: next(el.children)
nodes: next(el.children) }
} }
} case 'strong': {
case 'strong': { return {
return { kind: 'mark',
kind: 'mark', type: 'bold',
type: 'bold', nodes: next(el.children)
nodes: next(el.children) }
} }
} }
} }
} }
} ]
] }

View File

@@ -1,30 +1,32 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'em': {
case 'em': { return {
return { kind: 'mark',
kind: 'mark', type: 'italic',
type: 'italic', nodes: next(el.children)
nodes: next(el.children) }
} }
} case 'strong': {
case 'strong': { return {
return { kind: 'mark',
kind: 'mark', type: 'bold',
type: 'bold', nodes: next(el.children)
nodes: next(el.children) }
} }
} }
} }
} }
} ]
] }

View File

@@ -1,23 +1,25 @@
export default [ export default {
{ rules: [
deserialize(el, next) { {
switch (el.tagName) { deserialize(el, next) {
case 'p': { switch (el.tagName) {
return { case 'p': {
kind: 'block', return {
type: 'paragraph', kind: 'block',
nodes: next(el.children) type: 'paragraph',
nodes: next(el.children)
}
} }
} case 'em': {
case 'em': { return {
return { kind: 'mark',
kind: 'mark', type: 'italic',
type: 'italic', nodes: next(el.children)
nodes: next(el.children) }
} }
} }
} }
} }
} ]
] }