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

Add a block fixtures framework to allow automated checking of block validation #18643

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:jetpack/send-a-message -->
<div class="wp-block-jetpack-send-a-message"><!-- wp:jetpack/whatsapp-button {"countryCode":"61CX","phoneNumber":"267 8888","firstMessage":"My Message"} -->
<div class="wp-block-jetpack-whatsapp-button is-color-dark"><a class="whatsapp-block__button" href="https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message" style="background-color:#25D366;color:#fff" target="_self" rel="noopener noreferrer">Chat on WhatsApp</a></div>
<!-- /wp:jetpack/whatsapp-button --></div>
<!-- /wp:jetpack/send-a-message -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"clientId": "_clientId_0",
"name": "jetpack/send-a-message",
"isValid": true,
"attributes": {},
"innerBlocks": [
{
"clientId": "_clientId_0",
"name": "jetpack/whatsapp-button",
"isValid": true,
"attributes": {
"countryCode": "61CX",
"phoneNumber": "267 8888",
"firstMessage": "My Message",
"buttonText": [
"Chat on WhatsApp"
],
"backgroundColor": "#25D366",
"colorClass": "dark",
"openInNewTab": false
},
"innerBlocks": [],
"originalContent": "<div class=\"wp-block-jetpack-whatsapp-button is-color-dark\"><a class=\"whatsapp-block__button\" href=\"https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message\" style=\"background-color:#25D366;color:#fff\" target=\"_self\" rel=\"noopener noreferrer\">Chat on WhatsApp</a></div>"
}
],
"originalContent": "<div class=\"wp-block-jetpack-send-a-message\"></div>"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"blockName": "jetpack/send-a-message",
"attrs": {},
"innerBlocks": [
{
"blockName": "jetpack/whatsapp-button",
"attrs": {
"countryCode": "61CX",
"phoneNumber": "267 8888",
"firstMessage": "My Message"
},
"innerBlocks": [],
"innerHTML": "\n\t<div class=\"wp-block-jetpack-whatsapp-button is-color-dark\"><a class=\"whatsapp-block__button\" href=\"https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message\" style=\"background-color:#25D366;color:#fff\" target=\"_self\" rel=\"noopener noreferrer\">Chat on WhatsApp</a></div>\n\t",
"innerContent": [
"\n\t<div class=\"wp-block-jetpack-whatsapp-button is-color-dark\"><a class=\"whatsapp-block__button\" href=\"https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message\" style=\"background-color:#25D366;color:#fff\" target=\"_self\" rel=\"noopener noreferrer\">Chat on WhatsApp</a></div>\n\t"
]
}
],
"innerHTML": "\n<div class=\"wp-block-jetpack-send-a-message\"></div>\n\t",
"innerContent": [
"\n<div class=\"wp-block-jetpack-send-a-message\">",
null,
"</div>\n\t"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [
"\n"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:jetpack/send-a-message -->
<div class="wp-block-jetpack-send-a-message"><!-- wp:jetpack/whatsapp-button {"countryCode":"61CX","phoneNumber":"267 8888","firstMessage":"My Message"} -->
<div class="wp-block-jetpack-whatsapp-button is-color-dark"><a class="whatsapp-block__button" href="https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message" style="background-color:#25D366;color:#fff" target="_self" rel="noopener noreferrer">Chat on WhatsApp</a></div>
<!-- /wp:jetpack/whatsapp-button --></div>
<!-- /wp:jetpack/send-a-message -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:jetpack/send-a-message -->
<div class="wp-block-jetpack-send-a-message"><!-- wp:jetpack/whatsapp-button {"countryCode":"61CX","phoneNumber":"267 8888","firstMessage":"My Message"} -->
<div class="wp-block-jetpack-whatsapp-button is-color-dark"><a class="whatsapp-block__button" href="https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message" style="background-color:#25D366;" target="_self" rel="noopener noreferrer">Chat on WhatsApp</a></div>
<!-- /wp:jetpack/whatsapp-button --></div>
<!-- /wp:jetpack/send-a-message -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"clientId": "_clientId_0",
"name": "jetpack/send-a-message",
"isValid": true,
"attributes": {},
"innerBlocks": [
{
"clientId": "_clientId_0",
"name": "jetpack/whatsapp-button",
"isValid": true,
"attributes": {
"countryCode": "61CX",
"phoneNumber": "267 8888",
"firstMessage": "My Message",
"buttonText": [
"Chat on WhatsApp"
],
"backgroundColor": "#25D366",
"colorClass": "dark",
"openInNewTab": false
},
"innerBlocks": [],
"originalContent": "<div class=\"wp-block-jetpack-whatsapp-button is-color-dark\"><a class=\"whatsapp-block__button\" href=\"https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message\" style=\"background-color:#25D366;\" target=\"_self\" rel=\"noopener noreferrer\">Chat on WhatsApp</a></div>"
}
],
"originalContent": "<div class=\"wp-block-jetpack-send-a-message\"></div>"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"blockName": "jetpack/send-a-message",
"attrs": {},
"innerBlocks": [
{
"blockName": "jetpack/whatsapp-button",
"attrs": {
"countryCode": "61CX",
"phoneNumber": "267 8888",
"firstMessage": "My Message"
},
"innerBlocks": [],
"innerHTML": "\n\t<div class=\"wp-block-jetpack-whatsapp-button is-color-dark\"><a class=\"whatsapp-block__button\" href=\"https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message\" style=\"background-color:#25D366;\" target=\"_self\" rel=\"noopener noreferrer\">Chat on WhatsApp</a></div>\n\t",
"innerContent": [
"\n\t<div class=\"wp-block-jetpack-whatsapp-button is-color-dark\"><a class=\"whatsapp-block__button\" href=\"https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message\" style=\"background-color:#25D366;\" target=\"_self\" rel=\"noopener noreferrer\">Chat on WhatsApp</a></div>\n\t"
]
}
],
"innerHTML": "\n<div class=\"wp-block-jetpack-send-a-message\"></div>\n\t",
"innerContent": [
"\n<div class=\"wp-block-jetpack-send-a-message\">",
null,
"</div>\n\t"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [
"\n"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:jetpack/send-a-message -->
<div class="wp-block-jetpack-send-a-message"><!-- wp:jetpack/whatsapp-button {"countryCode":"61CX","phoneNumber":"267 8888","firstMessage":"My Message"} -->
<div class="wp-block-jetpack-whatsapp-button is-color-dark"><a class="whatsapp-block__button" href="https://api.whatsapp.com/send?phone=612678888&amp;text=My%20Message" style="background-color:#25D366;color:#fff" target="_self" rel="noopener noreferrer">Chat on WhatsApp</a></div>
<!-- /wp:jetpack/whatsapp-button --></div>
<!-- /wp:jetpack/send-a-message -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Internal dependencies
*/
import { settings } from '../';
import { settings as parentSettings } from '../../';
import runBlockFixtureTests from '../../../../shared/test/block-fixtures';

// Need to include all the blocks involved in rendering this block.
// The main block should be the first in the array.
const blocks = [
{ name: 'jetpack/whatsapp-button', settings },
{ name: 'jetpack/send-a-message', settings: parentSettings },
];

runBlockFixtureTests( 'jetpack/whatsapp-button', blocks, __dirname );
Loading