Skip to content

Commit

Permalink
Updated test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Oct 15, 2018
1 parent 7914000 commit 22507a4
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 5 deletions.
3 changes: 3 additions & 0 deletions packages/block-library/src/cover-image/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ describe( 'core/cover-image', () => {
const wrapper = blockEditRender( name, settings );

expect( wrapper ).toMatchSnapshot();
expect( console ).toHaveWarnedWith(
'The Cover Image block is deprecated and will be removed. Please use the Cover block instead.'
);
} );
} );
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`core/cover-image block edit matches snapshot 1`] = `
exports[`core/cover block edit matches snapshot 1`] = `
<div
class="components-placeholder editor-media-placeholder wp-block-cover-image"
class="components-placeholder editor-media-placeholder wp-block-cover"
>
<div
class="components-placeholder__label"
Expand All @@ -21,12 +21,12 @@ exports[`core/cover-image block edit matches snapshot 1`] = `
d="M2.25 1h15.5c.69 0 1.25.56 1.25 1.25v15.5c0 .69-.56 1.25-1.25 1.25H2.25C1.56 19 1 18.44 1 17.75V2.25C1 1.56 1.56 1 2.25 1zM17 17V3H3v14h14zM10 6c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm3 5s0-6 3-6v10c0 .55-.45 1-1 1H5c-.55 0-1-.45-1-1V8c2 0 3 4 3 4s1-3 3-3 3 2 3 2z"
/>
</svg>
Cover Image
Cover
</div>
<div
class="components-placeholder__instructions"
>
Drag an image, upload a new one or select a file from your library.
Drag an image or a video, upload a new one or select a file from your library.
</div>
<div
class="components-placeholder__fieldset"
Expand Down Expand Up @@ -82,7 +82,7 @@ exports[`core/cover-image block edit matches snapshot 1`] = `
Upload
</button>
<input
accept="image/*"
accept="image/*,video/*"
style="display:none"
type="file"
/>
Expand Down
9 changes: 9 additions & 0 deletions test/integration/full-content/fixtures/core__cover.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- wp:cover {"url":"https://cldup.com/uuUqE_dXzy.jpg","dimRatio":40} -->
<div class="wp-block-cover has-background-dim has-background-dim-40" style="background-image:url(https://cldup.com/uuUqE_dXzy.jpg)">
<div class="wp-block-cover__inner-container">
<!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
<p style="text-align:center" class="has-large-font-size">Cover!</p>
<!-- /wp:paragraph -->
</div>
</div>
<!-- /wp:cover -->
31 changes: 31 additions & 0 deletions test/integration/full-content/fixtures/core__cover.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"clientId": "_clientId_0",
"name": "core/cover",
"isValid": true,
"attributes": {
"title": "",
"url": "https://cldup.com/uuUqE_dXzy.jpg",
"hasParallax": false,
"dimRatio": 40,
"backgroundType": "image"
},
"innerBlocks": [
{
"clientId": "_clientId_0",
"name": "core/paragraph",
"isValid": true,
"attributes": {
"content": "Cover!",
"align": "center",
"dropCap": false,
"placeholder": "Write title…",
"fontSize": "large"
},
"innerBlocks": [],
"originalContent": "<p style=\"text-align:center\" class=\"has-large-font-size\">Cover!</p>"
}
],
"originalContent": "<div class=\"wp-block-cover has-background-dim has-background-dim-40\" style=\"background-image:url(https://cldup.com/uuUqE_dXzy.jpg)\">\n\t<div class=\"wp-block-cover__inner-container\">\n\t\t\n\t</div>\n</div>"
}
]
28 changes: 28 additions & 0 deletions test/integration/full-content/fixtures/core__cover.parsed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"blockName": "core/cover",
"attrs": {
"url": "https://cldup.com/uuUqE_dXzy.jpg",
"dimRatio": 40
},
"innerBlocks": [
{
"blockName": "core/paragraph",
"attrs": {
"align": "center",
"placeholder": "Write title…",
"fontSize": "large"
},
"innerBlocks": [],
"innerHTML": "\n\t\t<p style=\"text-align:center\" class=\"has-large-font-size\">Cover!</p>\n\t\t"
}
],
"innerHTML": "\n<div class=\"wp-block-cover has-background-dim has-background-dim-40\" style=\"background-image:url(https://cldup.com/uuUqE_dXzy.jpg)\">\n\t<div class=\"wp-block-cover__inner-container\">\n\t\t\n\t</div>\n</div>\n"
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:cover {"url":"https://cldup.com/uuUqE_dXzy.jpg","dimRatio":40} -->
<div class="wp-block-cover has-background-dim-40 has-background-dim" style="background-image:url(https://cldup.com/uuUqE_dXzy.jpg)"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
<p style="text-align:center" class="has-large-font-size">Cover!</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover -->

0 comments on commit 22507a4

Please sign in to comment.