Skip to content

Commit

Permalink
When a new line exists at the end of an HTML fixture file the parser …
Browse files Browse the repository at this point in the history
…interprets this as an empty block. The result is an empty block object in the resulting parsed JSON. (#30981)

Trimming the output string of the HTML prevents this from occurring.
We're also re-generating the fixtures to remove the empty blocks.
  • Loading branch information
ramonjd authored Apr 20, 2021
1 parent 20b9705 commit b3fe0be
Show file tree
Hide file tree
Showing 195 changed files with 172 additions and 1,339 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "<!-- wp:core/4-invalid /-->\n",
"innerContent": [ "<!-- wp:core/4-invalid /-->\n" ]
"innerHTML": "<!-- wp:core/4-invalid /-->",
"innerContent": [
"<!-- wp:core/4-invalid /-->"
]
}
]
7 changes: 0 additions & 7 deletions packages/e2e-tests/fixtures/blocks/core__audio.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,5 @@
"innerContent": [
"\n<figure class=\"wp-block-audio alignright\">\n <audio controls=\"\" src=\"data:audio/mpeg;base64,/+MYxAAAAANIAAAAAExBTUUzLjk4LjIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"></audio>\n</figure>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,5 @@
"innerContent": [
"\n<figure class=\"wp-block-audio\"><audio controls></audio></figure>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
7 changes: 0 additions & 7 deletions packages/e2e-tests/fixtures/blocks/core__block.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,5 @@
"innerBlocks": [],
"innerHTML": "",
"innerContent": []
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"attrs": {},
"innerBlocks": [],
"innerHTML": "</div>",
"innerContent": [ "</div>" ]
"innerContent": [
"</div>"
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,5 @@
"innerContent": [
"\n<div class=\"wp-block-button aligncenter\"><a class=\"wp-block-button__link\" href=\"https://github.com/WordPress/gutenberg\">Help build Gutenberg</a></div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,5 @@
"innerContent": [
"\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link no-border-radius has-text-color has-background\" style=\"background-color:#aa5a20;color:#1b9b6c\">My button</a></div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
7 changes: 0 additions & 7 deletions packages/e2e-tests/fixtures/blocks/core__buttons.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,5 @@
null,
"\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,5 @@
null,
"\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
7 changes: 0 additions & 7 deletions packages/e2e-tests/fixtures/blocks/core__calendar.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,5 @@
"innerBlocks": [],
"innerHTML": "",
"innerContent": []
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,5 @@
"innerBlocks": [],
"innerHTML": "",
"innerContent": []
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
7 changes: 0 additions & 7 deletions packages/e2e-tests/fixtures/blocks/core__code.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,5 @@
"innerContent": [
"\n<pre class=\"wp-block-code\"><code>export default function MyButton() {\n\treturn &lt;Button&gt;Click Me!&lt;/Button&gt;;\n}</code></pre>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
15 changes: 6 additions & 9 deletions packages/e2e-tests/fixtures/blocks/core__column.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n\t<p>Column One, Paragraph One</p>\n\t",
"innerContent": [ "\n\t<p>Column One, Paragraph One</p>\n\t" ]
"innerContent": [
"\n\t<p>Column One, Paragraph One</p>\n\t"
]
},
{
"blockName": "core/paragraph",
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n\t<p>Column One, Paragraph Two</p>\n\t",
"innerContent": [ "\n\t<p>Column One, Paragraph Two</p>\n\t" ]
"innerContent": [
"\n\t<p>Column One, Paragraph Two</p>\n\t"
]
}
],
"innerHTML": "\n<div class=\"wp-block-column\">\n\t\n\t\n</div>\n",
Expand All @@ -26,12 +30,5 @@
null,
"\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n\t<p>Column One, Paragraph One</p>\n\t",
"innerContent": [ "\n\t<p>Column One, Paragraph One</p>\n\t" ]
"innerContent": [
"\n\t<p>Column One, Paragraph One</p>\n\t"
]
},
{
"blockName": "core/paragraph",
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n\t<p>Column One, Paragraph Two</p>\n\t",
"innerContent": [ "\n\t<p>Column One, Paragraph Two</p>\n\t" ]
"innerContent": [
"\n\t<p>Column One, Paragraph Two</p>\n\t"
]
}
],
"innerHTML": "\n<div class=\"wp-block-column\" style=\"flex-basis:33.33%\">\n\t\n\t\n</div>\n",
Expand All @@ -28,12 +32,5 @@
null,
"\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
7 changes: 0 additions & 7 deletions packages/e2e-tests/fixtures/blocks/core__columns.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,5 @@
null,
"\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,5 @@
null,
"\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
7 changes: 0 additions & 7 deletions packages/e2e-tests/fixtures/blocks/core__cover.parsed.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,5 @@
null,
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,5 @@
"innerContent": [
"\n<section class=\"wp-block-cover-image has-background-dim\" style=\"background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==)\"><h2><strong>Cover Image</strong></h2></section>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,5 @@
"innerContent": [
"\n<div class=\"wp-block-cover-image has-background-dim\" style=\"background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==)\"><p class=\"wp-block-cover-image-text\"><strong>Cover Block</strong></p></div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,5 @@
"innerContent": [
"\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==)\"><p class=\"wp-block-cover-text\"><strong>Cover Block</strong></p></div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,5 @@
null,
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,5 @@
null,
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
"innerContent": [
"\n"
]
},
{
"blockName": "core/cover",
Expand All @@ -54,7 +56,9 @@
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n\t\t<p></p>\n\t\t",
"innerContent": [ "\n\t\t<p></p>\n\t\t" ]
"innerContent": [
"\n\t\t<p></p>\n\t\t"
]
}
],
"innerHTML": "\n<div\n\tclass=\"wp-block-cover alignfull\"\n\tstyle=\"background-image: url( https://example.com/some-background-image.png ); min-height: 48vw; background-position: 50% 40%;\"\n>\n\t<div class=\"wp-block-cover__inner-container\">\n\t\t\n\t</div>\n</div>\n",
Expand All @@ -69,7 +73,9 @@
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
"innerContent": [
"\n"
]
},
{
"blockName": "core/cover",
Expand Down Expand Up @@ -99,12 +105,5 @@
null,
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,5 @@
null,
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,5 @@
null,
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [ "\n" ]
}
]
Loading

0 comments on commit b3fe0be

Please sign in to comment.