-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fixture Tests: Correctly generate fixture files for form-related blocks #56719
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:form-input {"label":"Name","required":true} --> | ||
<label class="wp-block-form-input-label"><span class="wp-block-form-input-label__content">Name</span><input class="wp-block-form-input" type="text" name="Name" required aria-required="true"/></label> | ||
<!-- wp:form-input --> | ||
<label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Label</span><input class="wp-block-form-input__input" type="text" name="label" aria-required="false"/></label> | ||
<!-- /wp:form-input --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
test/integration/fixtures/blocks/core__form-input.parsed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
[ | ||
{ | ||
"blockName": "core/form-input", | ||
"attrs": { | ||
"label": "Name", | ||
"required": true | ||
}, | ||
"attrs": {}, | ||
"innerBlocks": [], | ||
"innerHTML": "\n<label class=\"wp-block-form-input-label\"><span class=\"wp-block-form-input-label__content\">Name</span><input class=\"wp-block-form-input\" type=\"text\" name=\"Name\" required aria-required=\"true\"/></label>\n", | ||
"innerHTML": "\n<label class=\"wp-block-form-input__label\"><span class=\"wp-block-form-input__label-content\">Label</span><input class=\"wp-block-form-input__input\" type=\"text\" name=\"label\" aria-required=\"false\"/></label>\n", | ||
"innerContent": [ | ||
"\n<label class=\"wp-block-form-input-label\"><span class=\"wp-block-form-input-label__content\">Name</span><input class=\"wp-block-form-input\" type=\"text\" name=\"Name\" required aria-required=\"true\"/></label>\n" | ||
"\n<label class=\"wp-block-form-input__label\"><span class=\"wp-block-form-input__label-content\">Label</span><input class=\"wp-block-form-input__input\" type=\"text\" name=\"label\" aria-required=\"false\"/></label>\n" | ||
] | ||
} | ||
] |
4 changes: 2 additions & 2 deletions
4
test/integration/fixtures/blocks/core__form-input.serialized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:form-input {"label":"Name","required":true} --> | ||
<label class="wp-block-form-input-label"><span class="wp-block-form-input-label__content">Name</span><input class="wp-block-form-input" type="text" name="Name" required aria-required="true"/></label> | ||
<!-- wp:form-input --> | ||
<label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Label</span><input class="wp-block-form-input__input" type="text" name="label" aria-required="false"/></label> | ||
<!-- /wp:form-input --> |
5 changes: 5 additions & 0 deletions
5
test/integration/fixtures/blocks/core__form-submission-notification.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- wp:form-submission-notification --> | ||
<div class="wp-block-form-submission-notification form-notification-type-success"><!-- wp:paragraph {"style":{"elements":{"link":{"color":{"text":"#000000"}}}},"backgroundColor":"#00D084","textColor":"#000000"} --> | ||
<p class="has-000000-color has-00-d-084-background-color has-text-color has-background has-link-color">Your form has been submitted successfully.</p> | ||
<!-- /wp:paragraph --></div> | ||
<!-- /wp:form-submission-notification --> |
31 changes: 31 additions & 0 deletions
31
test/integration/fixtures/blocks/core__form-submission-notification.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[ | ||
{ | ||
"name": "core/form-submission-notification", | ||
"isValid": true, | ||
"attributes": { | ||
"type": "success" | ||
}, | ||
"innerBlocks": [ | ||
{ | ||
"name": "core/paragraph", | ||
"isValid": true, | ||
"attributes": { | ||
"content": "Your form has been submitted successfully.", | ||
"dropCap": false, | ||
"backgroundColor": "#00D084", | ||
"textColor": "#000000", | ||
"style": { | ||
"elements": { | ||
"link": { | ||
"color": { | ||
"text": "#000000" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"innerBlocks": [] | ||
} | ||
] | ||
} | ||
] |
35 changes: 35 additions & 0 deletions
35
test/integration/fixtures/blocks/core__form-submission-notification.parsed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[ | ||
{ | ||
"blockName": "core/form-submission-notification", | ||
"attrs": {}, | ||
"innerBlocks": [ | ||
{ | ||
"blockName": "core/paragraph", | ||
"attrs": { | ||
"style": { | ||
"elements": { | ||
"link": { | ||
"color": { | ||
"text": "#000000" | ||
} | ||
} | ||
} | ||
}, | ||
"backgroundColor": "#00D084", | ||
"textColor": "#000000" | ||
}, | ||
"innerBlocks": [], | ||
"innerHTML": "\n<p class=\"has-000000-color has-00-d-084-background-color has-text-color has-background has-link-color\">Your form has been submitted successfully.</p>\n", | ||
"innerContent": [ | ||
"\n<p class=\"has-000000-color has-00-d-084-background-color has-text-color has-background has-link-color\">Your form has been submitted successfully.</p>\n" | ||
] | ||
} | ||
], | ||
"innerHTML": "\n<div class=\"wp-block-form-submission-notification form-notification-type-success\"></div>\n", | ||
"innerContent": [ | ||
"\n<div class=\"wp-block-form-submission-notification form-notification-type-success\">", | ||
null, | ||
"</div>\n" | ||
] | ||
} | ||
] |
5 changes: 5 additions & 0 deletions
5
test/integration/fixtures/blocks/core__form-submission-notification.serialized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- wp:form-submission-notification --> | ||
<div class="wp-block-form-submission-notification form-notification-type-success"><!-- wp:paragraph {"backgroundColor":"#00D084","textColor":"#000000","style":{"elements":{"link":{"color":{"text":"#000000"}}}}} --> | ||
<p class="has-000000-color has-00-d-084-background-color has-text-color has-background has-link-color">Your form has been submitted successfully.</p> | ||
<!-- /wp:paragraph --></div> | ||
<!-- /wp:form-submission-notification --> |
7 changes: 7 additions & 0 deletions
7
test/integration/fixtures/blocks/core__form-submit-button.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- wp:form-submit-button --> | ||
<div class="wp-block-form-submit-button"><!-- wp:buttons --> | ||
<div class="wp-block-buttons"><!-- wp:button {"tagName":"button","type":"submit"} --> | ||
<div class="wp-block-button"><button type="submit" class="wp-block-button__link wp-element-button">Submit</button></div> | ||
<!-- /wp:button --></div> | ||
<!-- /wp:buttons --></div> | ||
<!-- /wp:form-submit-button --> |
26 changes: 26 additions & 0 deletions
26
test/integration/fixtures/blocks/core__form-submit-button.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[ | ||
{ | ||
"name": "core/form-submit-button", | ||
"isValid": true, | ||
"attributes": {}, | ||
"innerBlocks": [ | ||
{ | ||
"name": "core/buttons", | ||
"isValid": true, | ||
"attributes": {}, | ||
"innerBlocks": [ | ||
{ | ||
"name": "core/button", | ||
"isValid": true, | ||
"attributes": { | ||
"tagName": "button", | ||
"type": "submit", | ||
"text": "Submit" | ||
}, | ||
"innerBlocks": [] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
38 changes: 38 additions & 0 deletions
38
test/integration/fixtures/blocks/core__form-submit-button.parsed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[ | ||
{ | ||
"blockName": "core/form-submit-button", | ||
"attrs": {}, | ||
"innerBlocks": [ | ||
{ | ||
"blockName": "core/buttons", | ||
"attrs": {}, | ||
"innerBlocks": [ | ||
{ | ||
"blockName": "core/button", | ||
"attrs": { | ||
"tagName": "button", | ||
"type": "submit" | ||
}, | ||
"innerBlocks": [], | ||
"innerHTML": "\n<div class=\"wp-block-button\"><button type=\"submit\" class=\"wp-block-button__link wp-element-button\">Submit</button></div>\n", | ||
"innerContent": [ | ||
"\n<div class=\"wp-block-button\"><button type=\"submit\" class=\"wp-block-button__link wp-element-button\">Submit</button></div>\n" | ||
] | ||
} | ||
], | ||
"innerHTML": "\n<div class=\"wp-block-buttons\"></div>\n", | ||
"innerContent": [ | ||
"\n<div class=\"wp-block-buttons\">", | ||
null, | ||
"</div>\n" | ||
] | ||
} | ||
], | ||
"innerHTML": "\n<div class=\"wp-block-form-submit-button\"></div>\n", | ||
"innerContent": [ | ||
"\n<div class=\"wp-block-form-submit-button\">", | ||
null, | ||
"</div>\n" | ||
] | ||
} | ||
] |
7 changes: 7 additions & 0 deletions
7
test/integration/fixtures/blocks/core__form-submit-button.serialized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- wp:form-submit-button --> | ||
<div class="wp-block-form-submit-button"><!-- wp:buttons --> | ||
<div class="wp-block-buttons"><!-- wp:button {"tagName":"button","type":"submit"} --> | ||
<div class="wp-block-button"><button type="submit" class="wp-block-button__link wp-element-button">Submit</button></div> | ||
<!-- /wp:button --></div> | ||
<!-- /wp:buttons --></div> | ||
<!-- /wp:form-submit-button --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
<!-- wp:form --> | ||
<form><!-- wp:form-input {"label":"Name","required":true} --> | ||
<label class="wp-block-form-input-label"><span class="wp-block-form-input-label__content">Name</span><input class="wp-block-form-input" type="text" name="Name" required aria-required="true"/></label> | ||
<form class="wp-block-form" enctype="text/plain"> | ||
<!-- wp:form-input {"label":"Name","required":true} --> | ||
<label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Name</span><input class="wp-block-form-input__input" type="text" name="name" required aria-required="true"/></label> | ||
<!-- /wp:form-input --> | ||
|
||
<!-- wp:form-input {"type":"email","label":"Email","required":true} --> | ||
<label class="wp-block-form-input-label"><span class="wp-block-form-input-label__content">Email</span><input class="wp-block-form-input" type="email" name="Email" required aria-required="true"/></label> | ||
<label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Email</span><input class="wp-block-form-input__input" type="email" name="email" required aria-required="true"/></label> | ||
<!-- /wp:form-input --> | ||
|
||
<!-- wp:form-input {"type":"url","label":"Website"} --> | ||
<label class="wp-block-form-input-label"><span class="wp-block-form-input-label__content">Website</span><input class="wp-block-form-input" type="url" name="Website" aria-required="false"/></label> | ||
<label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Website</span><input class="wp-block-form-input__input" type="url" name="website" aria-required="false"/></label> | ||
<!-- /wp:form-input --> | ||
|
||
<!-- wp:form-input {"type":"textarea","label":"Comment","required":true} --> | ||
<label class="wp-block-form-input-label"><span class="wp-block-form-input-label__content">Comment</span><textarea class="wp-block-form-input" name="Comment" required aria-required="true"></textarea></label> | ||
<label class="wp-block-form-input__label"><span class="wp-block-form-input__label-content">Comment</span><textarea class="wp-block-form-input__input" name="comment" required aria-required="true"></textarea></label> | ||
<!-- /wp:form-input --> | ||
|
||
<!-- wp:form-input {"type":"submit","label":"Submit"} --> | ||
<div class="wp-block-buttons"><div class="wp-block-button"><button class="wp-block-button__link wp-element-button">Submit</button></div></div> | ||
<!-- /wp:form-input --></form> | ||
<!-- wp:form-submit-button --> | ||
<div class="wp-block-form-submit-button"><!-- wp:buttons --> | ||
<div class="wp-block-buttons"><!-- wp:button {"tagName":"button","type":"submit"} --> | ||
<div class="wp-block-button"><button type="submit" class="wp-block-button__link wp-element-button">Submit</button></div> | ||
<!-- /wp:button --></div> | ||
<!-- /wp:buttons --></div> | ||
<!-- /wp:form-submit-button --> | ||
</form> | ||
<!-- /wp:form --> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
wp_kses_post()
function does not allowform
tag by default. So we need to allow attributes to be included in the serialized form block.