1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-19 06:18:16 +01: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 [
{
deserialize(el, next) {
switch (el.tagName) {
case 'p': {
return {
kind: 'block',
type: 'paragraph',
nodes: next(el.children)
export default {
rules: [
{
deserialize(el, next) {
switch (el.tagName) {
case 'p': {
return {
kind: 'block',
type: 'paragraph',
nodes: next(el.children)
}
}
}
case 'blockquote': {
return {
kind: 'block',
type: 'quote',
nodes: next(el.children)
case 'blockquote': {
return {
kind: 'block',
type: 'quote',
nodes: next(el.children)
}
}
}
}
}
}
]
]
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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