diff --git a/test/rendering/fixtures/custom-block-void/index.js b/test/rendering/fixtures/custom-block-void/index.js new file mode 100644 index 000000000..e508818c3 --- /dev/null +++ b/test/rendering/fixtures/custom-block-void/index.js @@ -0,0 +1,10 @@ + +import React from 'react' + +function Image(props) { + return +} + +export function renderNode(node) { + if (node.type == 'image') return Image +} diff --git a/test/rendering/fixtures/custom-block-void/input.yaml b/test/rendering/fixtures/custom-block-void/input.yaml new file mode 100644 index 000000000..c02f43e13 --- /dev/null +++ b/test/rendering/fixtures/custom-block-void/input.yaml @@ -0,0 +1,11 @@ + +nodes: + - kind: block + type: image + isVoid: true + data: + src: https://img.washingtonpost.com/wp-apps/imrs.php?src=https://img.washingtonpost.com/news/speaking-of-science/wp-content/uploads/sites/36/2015/10/as12-49-7278-1024x1024.jpg&w=1484 + nodes: + - kind: text + ranges: + - text: another diff --git a/test/rendering/fixtures/custom-block-void/output.html b/test/rendering/fixtures/custom-block-void/output.html new file mode 100644 index 000000000..591712d02 --- /dev/null +++ b/test/rendering/fixtures/custom-block-void/output.html @@ -0,0 +1,13 @@ + +
+
+ + +
+
+
+
+ +
+
+
diff --git a/test/rendering/fixtures/custom-mark/index.js b/test/rendering/fixtures/custom-mark/index.js new file mode 100644 index 000000000..119a06836 --- /dev/null +++ b/test/rendering/fixtures/custom-mark/index.js @@ -0,0 +1,10 @@ + +import React from 'react' + +const BOLD = { + fontWeight: 'bold' +} + +export function renderMark(mark) { + if (mark.type == 'bold') return BOLD +} diff --git a/test/rendering/fixtures/custom-mark/input.yaml b/test/rendering/fixtures/custom-mark/input.yaml new file mode 100644 index 000000000..e5830723f --- /dev/null +++ b/test/rendering/fixtures/custom-mark/input.yaml @@ -0,0 +1,12 @@ + +nodes: + - kind: block + type: default + nodes: + - kind: text + ranges: + - text: one + - text: two + marks: + - type: bold + - text: three diff --git a/test/rendering/fixtures/custom-mark/output.html b/test/rendering/fixtures/custom-mark/output.html new file mode 100644 index 000000000..46f6c9544 --- /dev/null +++ b/test/rendering/fixtures/custom-mark/output.html @@ -0,0 +1,10 @@ + +
+
+ + one + two + three + +
+
diff --git a/test/rendering/fixtures/empty-text/index.js b/test/rendering/fixtures/empty-text/index.js new file mode 100644 index 000000000..dbf0139ef --- /dev/null +++ b/test/rendering/fixtures/empty-text/index.js @@ -0,0 +1,4 @@ + +/** + * Nothing, pure defaults. + */ diff --git a/test/rendering/fixtures/empty-text/input.yaml b/test/rendering/fixtures/empty-text/input.yaml new file mode 100644 index 000000000..bf22c57f4 --- /dev/null +++ b/test/rendering/fixtures/empty-text/input.yaml @@ -0,0 +1,8 @@ + +nodes: + - kind: block + type: default + nodes: + - kind: text + ranges: + - text: "" diff --git a/test/rendering/fixtures/empty-text/output.html b/test/rendering/fixtures/empty-text/output.html new file mode 100644 index 000000000..ab6f37ef0 --- /dev/null +++ b/test/rendering/fixtures/empty-text/output.html @@ -0,0 +1,8 @@ + +
+
+ +
+
+
+
diff --git a/test/rendering/index.js b/test/rendering/index.js index 8189e3a6b..a14d7b336 100644 --- a/test/rendering/index.js +++ b/test/rendering/index.js @@ -52,8 +52,9 @@ function clean(html) { $('*').each((i, el) => { $(el).removeAttr('data-key') $(el).removeAttr('data-offset-key') - $(el).removeAttr('style') }) + $('[contenteditable]').removeAttr('style') + return $.html() }