Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that all block fixtures end with newlines #2034

Merged
merged 1 commit into from
Jul 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__animoto.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://animoto.com/
<figcaption>Embedded content from animoto</figcaption>
</figure>
<!-- /wp:core-embed/animoto -->
<!-- /wp:core-embed/animoto -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__cloudup.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://cloudup.com/
<figcaption>Embedded content from cloudup</figcaption>
</figure>
<!-- /wp:core-embed/cloudup -->
<!-- /wp:core-embed/cloudup -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://collegehumor.com/
<figcaption>Embedded content from collegehumor</figcaption>
</figure>
<!-- /wp:core-embed/collegehumor -->
<!-- /wp:core-embed/collegehumor -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://dailymotion.com/
<figcaption>Embedded content from dailymotion</figcaption>
</figure>
<!-- /wp:core-embed/dailymotion -->
<!-- /wp:core-embed/dailymotion -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__facebook.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://facebook.com/
<figcaption>Embedded content from facebook</figcaption>
</figure>
<!-- /wp:core-embed/facebook -->
<!-- /wp:core-embed/facebook -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__flickr.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://flickr.com/
<figcaption>Embedded content from flickr</figcaption>
</figure>
<!-- /wp:core-embed/flickr -->
<!-- /wp:core-embed/flickr -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://funnyordie.com/
<figcaption>Embedded content from funnyordie</figcaption>
</figure>
<!-- /wp:core-embed/funnyordie -->
<!-- /wp:core-embed/funnyordie -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__hulu.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://hulu.com/
<figcaption>Embedded content from hulu</figcaption>
</figure>
<!-- /wp:core-embed/hulu -->
<!-- /wp:core-embed/hulu -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__imgur.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://imgur.com/
<figcaption>Embedded content from imgur</figcaption>
</figure>
<!-- /wp:core-embed/imgur -->
<!-- /wp:core-embed/imgur -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__instagram.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://instagram.com/
<figcaption>Embedded content from instagram</figcaption>
</figure>
<!-- /wp:core-embed/instagram -->
<!-- /wp:core-embed/instagram -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__issuu.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://issuu.com/
<figcaption>Embedded content from issuu</figcaption>
</figure>
<!-- /wp:core-embed/issuu -->
<!-- /wp:core-embed/issuu -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://kickstarter.com/
<figcaption>Embedded content from kickstarter</figcaption>
</figure>
<!-- /wp:core-embed/kickstarter -->
<!-- /wp:core-embed/kickstarter -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://meetup.com/
<figcaption>Embedded content from meetup-com</figcaption>
</figure>
<!-- /wp:core-embed/meetup-com -->
<!-- /wp:core-embed/meetup-com -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__mixcloud.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://mixcloud.com/
<figcaption>Embedded content from mixcloud</figcaption>
</figure>
<!-- /wp:core-embed/mixcloud -->
<!-- /wp:core-embed/mixcloud -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://photobucket.com/
<figcaption>Embedded content from photobucket</figcaption>
</figure>
<!-- /wp:core-embed/photobucket -->
<!-- /wp:core-embed/photobucket -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__polldaddy.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://polldaddy.com/
<figcaption>Embedded content from polldaddy</figcaption>
</figure>
<!-- /wp:core-embed/polldaddy -->
<!-- /wp:core-embed/polldaddy -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__reddit.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://reddit.com/
<figcaption>Embedded content from reddit</figcaption>
</figure>
<!-- /wp:core-embed/reddit -->
<!-- /wp:core-embed/reddit -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://reverbnation.com/
<figcaption>Embedded content from reverbnation</figcaption>
</figure>
<!-- /wp:core-embed/reverbnation -->
<!-- /wp:core-embed/reverbnation -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://screencast.com/
<figcaption>Embedded content from screencast</figcaption>
</figure>
<!-- /wp:core-embed/screencast -->
<!-- /wp:core-embed/screencast -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__scribd.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://scribd.com/
<figcaption>Embedded content from scribd</figcaption>
</figure>
<!-- /wp:core-embed/scribd -->
<!-- /wp:core-embed/scribd -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://slideshare.com/
<figcaption>Embedded content from slideshare</figcaption>
</figure>
<!-- /wp:core-embed/slideshare -->
<!-- /wp:core-embed/slideshare -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__smugmug.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://smugmug.com/
<figcaption>Embedded content from smugmug</figcaption>
</figure>
<!-- /wp:core-embed/smugmug -->
<!-- /wp:core-embed/smugmug -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://soundcloud.com/
<figcaption>Embedded content from soundcloud</figcaption>
</figure>
<!-- /wp:core-embed/soundcloud -->
<!-- /wp:core-embed/soundcloud -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__speaker.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://speaker.com/
<figcaption>Embedded content from speaker</figcaption>
</figure>
<!-- /wp:core-embed/speaker -->
<!-- /wp:core-embed/speaker -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__spotify.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://spotify.com/
<figcaption>Embedded content from spotify</figcaption>
</figure>
<!-- /wp:core-embed/spotify -->
<!-- /wp:core-embed/spotify -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__ted.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://ted.com/
<figcaption>Embedded content from ted</figcaption>
</figure>
<!-- /wp:core-embed/ted -->
<!-- /wp:core-embed/ted -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__tumblr.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://tumblr.com/
<figcaption>Embedded content from tumblr</figcaption>
</figure>
<!-- /wp:core-embed/tumblr -->
<!-- /wp:core-embed/tumblr -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__twitter.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://twitter.com/automattic
<figcaption>We are Automattic</figcaption>
</figure>
<!-- /wp:core-embed/twitter -->
<!-- /wp:core-embed/twitter -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://videopress.com/
<figcaption>Embedded content from videopress</figcaption>
</figure>
<!-- /wp:core-embed/videopress -->
<!-- /wp:core-embed/videopress -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__vimeo.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://vimeo.com/
<figcaption>Embedded content from vimeo</figcaption>
</figure>
<!-- /wp:core-embed/vimeo -->
<!-- /wp:core-embed/vimeo -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__vine.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://vine.com/
<figcaption>Embedded content from vine</figcaption>
</figure>
<!-- /wp:core-embed/vine -->
<!-- /wp:core-embed/vine -->
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://wordpress.tv/
<figcaption>Embedded content from wordpress-tv</figcaption>
</figure>
<!-- /wp:core-embed/wordpress-tv -->
<!-- /wp:core-embed/wordpress-tv -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__wordpress.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://wordpress.com/
<figcaption>Embedded content from WordPress</figcaption>
</figure>
<!-- /wp:core-embed/wordpress -->
<!-- /wp:core-embed/wordpress -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core-embed__youtube.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://youtube.com/
<figcaption>Embedded content from youtube</figcaption>
</figure>
<!-- /wp:core-embed/youtube -->
<!-- /wp:core-embed/youtube -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__button__center.serialized.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/button {"align":"center"} -->
<div class="wp-block-button aligncenter"><a href="https://github.com/WordPress/gutenberg">Help build Gutenberg</a></div>
<!-- /wp:core/button -->
<!-- /wp:core/button -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__code.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<pre class="wp-block-code"><code>export default function MyButton() {
return &lt;Button&gt;Click Me!&lt;/Button&gt;;
}</code></pre>
<!-- /wp:core/code -->
<!-- /wp:core/code -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__cover-image.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<h2>Guten Berg!</h2>
</section>
</section>
<!-- /wp:core/cover-image -->
<!-- /wp:core/cover-image -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__embed.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
https://example.com/
<figcaption>Embedded content from an example URL</figcaption>
</figure>
<!-- /wp:core/embed -->
<!-- /wp:core/embed -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__freeform.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<div class="wp-some-class">
HTML <span style="color: red;">content</span>
</div>
<!-- /wp:core/freeform -->
<!-- /wp:core/freeform -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__gallery.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
<img src="http://google.com/hi.png" alt="title" />
</figure>
</div>
<!-- /wp:core/gallery -->
<!-- /wp:core/gallery -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__heading__h2-em.serialized.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/heading -->
<h2>The <em>Inserter</em> Tool</h2>
<!-- /wp:core/heading -->
<!-- /wp:core/heading -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__heading__h2.serialized.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/heading -->
<h2>A picture is worth a thousand words, or so the saying goes</h2>
<!-- /wp:core/heading -->
<!-- /wp:core/heading -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__html.serialized.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- wp:core/html -->
<h1>Some HTML code</h1>
<marquee>This text will scroll from right to left</marquee>
<!-- /wp:core/html -->
<!-- /wp:core/html -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__image.serialized.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/image -->
<figure class="wp-block-image"><img src="https://cldup.com/uuUqE_dXzy.jpg" /></figure>
<!-- /wp:core/image -->
<!-- /wp:core/image -->
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<figure class="wp-block-image"><img src="https://cldup.com/YLYhpou2oq.jpg" class="aligncenter" />
<figcaption>Give it a try. Press the &quot;really wide&quot; button on the image toolbar.</figcaption>
</figure>
<!-- /wp:core/image -->
<!-- /wp:core/image -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__latest-posts.serialized.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!-- wp:core/latest-posts {"postsToShow":5,"displayPostDate":false,"layout":"list"} /-->
<!-- wp:core/latest-posts {"postsToShow":5,"displayPostDate":false,"layout":"list"} /-->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__list__ul.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
<li>Layout blocks, like Buttons, Hero Images, Separators, etc.</li>
<li>And <em>Lists</em> like this one of course :)</li>
</ul>
<!-- /wp:core/list -->
<!-- /wp:core/list -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__preformatted.serialized.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/preformatted -->
<pre class="wp-block-preformatted">Some <em>preformatted</em> text...<br>And more!</pre>
<!-- /wp:core/preformatted -->
<!-- /wp:core/preformatted -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__pullquote.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<p>Testing pullquote block...</p>
<footer>...with a caption</footer>
</blockquote>
<!-- /wp:core/pullquote -->
<!-- /wp:core/pullquote -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__quote__style-1.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<p>The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.</p>
<footer>Matt Mullenweg, 2017</footer>
</blockquote>
<!-- /wp:core/quote -->
<!-- /wp:core/quote -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__quote__style-2.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<p>There is no greater agony than bearing an untold story inside you.</p>
<footer>Maya Angelou</footer>
</blockquote>
<!-- /wp:core/quote -->
<!-- /wp:core/quote -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__separator.serialized.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/separator -->
<hr class="wp-block-separator" />
<!-- /wp:core/separator -->
<!-- /wp:core/separator -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__table.serialized.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
</tr>
</tbody>
</table>
<!-- /wp:core/table -->
<!-- /wp:core/table -->
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/text {"align":"right"} -->
<p style="text-align:right;">... like this one, which is separate from the above and right aligned.</p>
<!-- /wp:core/text -->
<!-- /wp:core/text -->
2 changes: 1 addition & 1 deletion blocks/test/fixtures/core__verse.serialized.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- wp:core/verse -->
<pre class="wp-block-verse">A <em>verse</em>…<br>And more!</pre>
<!-- /wp:core/verse -->
<!-- /wp:core/verse -->
8 changes: 4 additions & 4 deletions blocks/test/full-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ describe( 'full post content fixture', () => {
) );
}

const serializedActual = serialize( blocksActual );
// `serialize` doesn't have a trailing newline, but the fixture
// files should.
const serializedActual = serialize( blocksActual ) + '\n';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we trim here in case serialize changes in the future to add its own trailing newline or... update this logic if/when that time comes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update when the time comes; require an exact match so that we know if this behavior changes.

I think the current behavior is correct for post_content, FWIW.

let serializedExpected = readFixtureFile( f + '.serialized.html' );

if ( ! serializedExpected ) {
Expand All @@ -180,9 +182,7 @@ describe( 'full post content fixture', () => {
}

try {
expect( serializedActual ).toEqual(
serializedExpected.replace( /\n$/, '' )
);
expect( serializedActual ).toEqual( serializedExpected );
} catch ( err ) {
throw new Error( format(
'File \'%s.serialized.html\' does not match expected value:\n\n%s',
Expand Down