forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Comments Query Loop: Update default template (WordPress#40165)
* Change isLink and fontSize defaults The fontSize prop default is set to 'small'. The isLink prop is set to true. Blocks with changes are: - Comment Author Name - Comment Date - Comment Edit Link - Comment Reply Link * Improve default template * Update fixtures * Update php-unit tests * Remove trailing comma
- Loading branch information
Showing
23 changed files
with
407 additions
and
91 deletions.
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
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
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
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 |
---|---|---|
|
@@ -39,6 +39,7 @@ public function setUp() { | |
array( | ||
'comment_author' => 'Test', | ||
'comment_author_email' => '[email protected]', | ||
'comment_author_url' => 'https://example.com/author-url/', | ||
'comment_content' => 'Hello world', | ||
) | ||
); | ||
|
@@ -112,8 +113,8 @@ function test_rendering_comment_template() { | |
// Here we use the function prefixed with 'gutenberg_*' because it's added | ||
// in the build step. | ||
$this->assertEquals( | ||
gutenberg_render_block_core_comment_template( null, null, $block ), | ||
'<ol ><li><div class="wp-block-comment-author-name">Test</div><div class="wp-block-comment-content">Hello world</div></li></ol>' | ||
'<ol ><li><div class="has-small-font-size wp-block-comment-author-name"><a rel="external ugc" href="https://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div></li></ol>', | ||
gutenberg_render_block_core_comment_template( null, null, $block ) | ||
); | ||
} | ||
|
||
|
@@ -132,6 +133,7 @@ function test_rendering_comment_template_nested() { | |
'comment_parent' => self::$comment_ids[0], | ||
'comment_author' => 'Test', | ||
'comment_author_email' => '[email protected]', | ||
'comment_author_url' => 'https://example.com/author-url/', | ||
'comment_content' => 'Hello world', | ||
) | ||
); | ||
|
@@ -143,6 +145,7 @@ function test_rendering_comment_template_nested() { | |
'comment_parent' => $nested_comment_ids[0], | ||
'comment_author' => 'Test', | ||
'comment_author_email' => '[email protected]', | ||
'comment_author_url' => 'https://example.com/author-url/', | ||
'comment_content' => 'Hello world', | ||
) | ||
); | ||
|
@@ -160,7 +163,7 @@ function test_rendering_comment_template_nested() { | |
|
||
$this->assertEquals( | ||
gutenberg_render_block_core_comment_template( null, null, $block ), | ||
'<ol ><li><div class="wp-block-comment-author-name">Test</div><div class="wp-block-comment-content">Hello world</div><ol><li><div class="wp-block-comment-author-name">Test</div><div class="wp-block-comment-content">Hello world</div><ol><li><div class="wp-block-comment-author-name">Test</div><div class="wp-block-comment-content">Hello world</div></li></ol></li></ol></li></ol>' | ||
'<ol ><li><div class="has-small-font-size wp-block-comment-author-name"><a rel="external ugc" href="https://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div><ol><li><div class="has-small-font-size wp-block-comment-author-name"><a rel="external ugc" href="https://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div><ol><li><div class="has-small-font-size wp-block-comment-author-name"><a rel="external ugc" href="https://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div></li></ol></li></ol></li></ol>' | ||
); | ||
} | ||
/** | ||
|
@@ -180,6 +183,7 @@ function test_build_comment_query_vars_from_block_sets_cpage_var() { | |
array( | ||
'comment_author' => 'Test', | ||
'comment_author_email' => '[email protected]', | ||
'comment_author_url' => 'https://example.com/author-url/', | ||
'comment_content' => 'Hello world', | ||
) | ||
); | ||
|
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
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__comment-author-name__deprecated-v1.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 +1 @@ | ||
<!-- wp:comment-author-name {"fontFamily":"cambria-georgia"} /--> | ||
<!-- wp:comment-author-name {"isLink":false,"fontFamily":"cambria-georgia"} /--> |
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
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__comment-date__deprecated-v1.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 +1 @@ | ||
<!-- wp:comment-date {"fontFamily":"cambria-georgia"} /--> | ||
<!-- wp:comment-date {"isLink":false,"fontFamily":"cambria-georgia"} /--> |
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
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__comment-edit-link.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 +1 @@ | ||
<!-- wp:comment-edit-link {"linkTarget":"_blank","backgroundColor":"recommended-color-03","fontFamily":"system-monospace","fontSize":"extra-large","style":{"typography":{"fontStyle":"normal","fontWeight":"700","lineHeight":"2","textTransform":"uppercase","letterSpacing":"13px"},"elements":{"link":{"color":{"text":"#ed1717"}}}}} /--> | ||
<!-- wp:comment-edit-link {"linkTarget":"_blank","fontSize":"extra-large","backgroundColor":"recommended-color-03","fontFamily":"system-monospace","style":{"typography":{"fontStyle":"normal","fontWeight":"700","lineHeight":"2","textTransform":"uppercase","letterSpacing":"13px"},"elements":{"link":{"color":{"text":"#ed1717"}}}}} /--> |
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
2 changes: 1 addition & 1 deletion
2
test/integration/fixtures/blocks/core__comment-reply-link.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 +1 @@ | ||
<!-- wp:comment-reply-link {"textAlign":"right","fontFamily":"cambria-georgia","fontSize":"extra-large","style":{"typography":{"lineHeight":"0.8","textTransform":"uppercase","letterSpacing":"10px"},"elements":{"link":{"color":{"text":"var:preset|color|blue"}}},"color":{"background":"#c82222"}}} /--> | ||
<!-- wp:comment-reply-link {"textAlign":"right","fontSize":"extra-large","fontFamily":"cambria-georgia","style":{"typography":{"lineHeight":"0.8","textTransform":"uppercase","letterSpacing":"10px"},"elements":{"link":{"color":{"text":"var:preset|color|blue"}}},"color":{"background":"#c82222"}}} /--> |
36 changes: 30 additions & 6 deletions
36
test/integration/fixtures/blocks/core__comments-query-loop.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,17 +1,41 @@ | ||
<!-- wp:comments-query-loop --> | ||
<div class="wp-block-comments-query-loop"> | ||
<!-- wp:comment-template --> | ||
<!-- wp:comment-author-avatar /--> | ||
<!-- wp:columns --> | ||
<div class="wp-block-columns"> | ||
<!-- wp:column {"width":"40px"} --> | ||
<div class="wp-block-column" style="flex-basis:40px"> | ||
<!-- wp:avatar {"size":40,"style":{"border":{"radius":"20px"}}} /--> | ||
</div> | ||
<!-- /wp:column --> | ||
|
||
<!-- wp:comment-author-name /--> | ||
<!-- wp:column --> | ||
<div class="wp-block-column"> | ||
<!-- wp:comment-author-name /--> | ||
|
||
<!-- wp:comment-date /--> | ||
<!-- wp:group {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}}},"layout":{"type":"flex"}} --> | ||
<div class="wp-block-group" style="margin-top:0px;margin-bottom:0px"> | ||
<!-- wp:comment-date /--> | ||
|
||
<!-- wp:comment-content /--> | ||
<!-- wp:comment-edit-link /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:comment-reply-link /--> | ||
<!-- wp:comment-content /--> | ||
|
||
<!-- wp:comment-edit-link /--> | ||
<!-- wp:comment-reply-link /--> | ||
</div> | ||
<!-- /wp:column --> | ||
</div> | ||
<!-- /wp:columns --> | ||
<!-- /wp:comment-template --> | ||
|
||
<!-- wp:comments-pagination --> | ||
<!-- wp:comments-pagination-previous /--> | ||
|
||
<!-- wp:comments-pagination-numbers /--> | ||
|
||
<!-- wp:comments-pagination-next /--> | ||
<!-- /wp:comments-pagination --> | ||
</div> | ||
<!-- /wp:comments-query-loop --> |
Oops, something went wrong.