Skip to content

Commit

Permalink
Merge pull request #1940 from vektor-inc/develop
Browse files Browse the repository at this point in the history
[ Change version ] 1.70.0.0
  • Loading branch information
kurudrive authored Mar 28, 2024
2 parents 224e064 + aa79850 commit e0e78b8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 32 deletions.
4 changes: 2 additions & 2 deletions languages/vk-blocks-pro.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the VK Blocks Pro plugin.
msgid ""
msgstr ""
"Project-Id-Version: VK Blocks Pro 1.69.1.2\n"
"Project-Id-Version: VK Blocks Pro 1.70.0.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/vk-blocks-pro\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-03-27T11:38:40+00:00\n"
"POT-Creation-Date: 2024-03-27T11:46:22+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.6.0\n"
"X-Domain: vk-blocks-pro\n"
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ e.g.

== Changelog ==

= 1.70.0 =
[ Specification Change ] core/social-link, core/site-logo, core/site-title and core/site-tagline correspond to margin-extension
[ Add function ][ Breadcrumb ] Add the ability to input breadcrumb separators.

= 1.69.1 =
Expand Down
8 changes: 4 additions & 4 deletions src/utils/is-excludes-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export const isExcludesBlocks = ({ blockName, addExclude }) => {
'core/block',
'core/rss',
'core/search',
'core/social-link',
//'core/social-link',
'core/tag-cloud',
'core/site-logo',
'core/site-title',
'core/site-tagline',
//'core/site-logo',
//'core/site-title',
//'core/site-tagline',
'core/template-part',
'core/post-title',
'core/post-excerpt',
Expand Down
62 changes: 37 additions & 25 deletions test/phpunit/pro/test-blog-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function wpTearDownAfterClass() {
wp_delete_post( self::$attachment_id, true );
}

public function test_vk_blocks_blog_card_render_callback(){
public function test_vk_blocks_blog_card_render_callback() {

print PHP_EOL;
print '------------------------------------' . PHP_EOL;
Expand All @@ -62,8 +62,8 @@ public function test_vk_blocks_blog_card_render_callback(){
$tests = array(
// 内部リンク
array(
'content' => '
<!-- wp:vk-blocks/blog-card {"url":"'.get_permalink(self::$post->ID).'"} -->
'content' => '
<!-- wp:vk-blocks/blog-card {"url":"' . get_permalink( self::$post->ID ) . '"} -->
<div %s>
<!-- wp:vk-blocks/blog-card-title /-->
<!-- wp:vk-blocks/blog-card-featured-image /-->
Expand All @@ -74,21 +74,22 @@ public function test_vk_blocks_blog_card_render_callback(){
<!-- /wp:vk-blocks/blog-card -->',
'expected' => '
<div %s>
<h5 class="wp-block-vk-blocks-blog-card-title"><a href="'.get_permalink(self::$post->ID).'" target="_self" >'.get_the_title( self::$post->ID ).'</a></h5>
<figure class="wp-block-vk-blocks-blog-card-featured-image"><a href="'. get_permalink(self::$post->ID) .'" target="_self" ><img src=\''. get_the_post_thumbnail_url( self::$post->ID, 'large' ) .'\' style="object-fit:cover;" /></a></figure>
<div class="wp-block-vk-blocks-blog-card-excerpt"><p class="wp-block-vk-blocks-blog-card-excerpt__excerpt">'.get_the_excerpt( self::$post->ID ).'</p></div>
<figure class="wp-block-vk-blocks-blog-card-site-logo"><a href="'.home_url().'" target="_self" ><img src=\''. get_site_icon_url( 32 ) .'\' /></a></figure>
<p class="wp-block-vk-blocks-blog-card-site-title"><a href="'. home_url() .'" target="_self" >'. get_bloginfo( 'name' ) .'</a></p>
<h5 class="wp-block-vk-blocks-blog-card-title"><a href="' . get_permalink( self::$post->ID ) . '" target="_self" >' . get_the_title( self::$post->ID ) . '</a></h5>
<figure class="wp-block-vk-blocks-blog-card-featured-image"><a href="' . get_permalink( self::$post->ID ) . '" target="_self" ><img src=\'' . get_the_post_thumbnail_url( self::$post->ID, 'large' ) . '\' style="object-fit:cover;" /></a></figure>
<div class="wp-block-vk-blocks-blog-card-excerpt"><p class="wp-block-vk-blocks-blog-card-excerpt__excerpt">' . get_the_excerpt( self::$post->ID ) . '</p></div>
<figure class="wp-block-vk-blocks-blog-card-site-logo"><a href="' . home_url() . '" target="_self" ><img src=\'' . get_site_icon_url( 32 ) . '\' /></a></figure>
<p class="wp-block-vk-blocks-blog-card-site-title"><a href="' . home_url() . '" target="_self" >' . get_bloginfo( 'name' ) . '</a></p>
</div>
',
),
// 外部リンク 埋め込み不可
// 2024.3.28 以前は GitHub のURLでテストしていたが、GitHub は埋め込みができるようになったため、URLを変更
array(
'content' => '
<!-- wp:vk-blocks/blog-card {"url":"https://github.com/vektor-inc/vk-blocks-pro/blob/master/vk-blocks.php"} -->
<div %s></div>
<!-- /wp:vk-blocks/blog-card -->',
'expected' => '<div %s>https://github.com/vektor-inc/vk-blocks-pro/blob/master/vk-blocks.php</div>',
'content' => '
<!-- wp:vk-blocks/blog-card {"url":"https://vektor-inc.co.jp/data/photo_ishikawa.jpg"} -->
<div class="wp-block-vk-blocks-blog-card"></div>
<!-- /wp:vk-blocks/blog-card -->',
'expected' => '<div %s>https://vektor-inc.co.jp/data/photo_ishikawa.jpg</div>',
),
);

Expand All @@ -99,36 +100,47 @@ public function test_vk_blocks_blog_card_render_callback(){

foreach ( $tests as $test ) {

// Get block wrapper attributes ( HTML attributes like as : class="wp-block-vk-blocks-blog-card" ).
$get_block_wrapper_attributes = get_block_wrapper_attributes();
$parse_blocks = parse_blocks(sprintf($test['content'], $get_block_wrapper_attributes));
// ラッパーア属性を結合したコンテンツ要素
$block_content = sprintf( $test['content'], $get_block_wrapper_attributes );
// ブロック情報を配列に変換
$parse_blocks = parse_blocks( $block_content );
// Render Blog card block.
$render_block_content = render_block( $parse_blocks[1] );

if ( is_wp_version_compatible( '6.3' ) ) {
$get_block_wrapper_attributes = 'class="wp-block-vk-blocks-blog-card is-layout-flow wp-block-blog-card-is-layout-flow"';
} else {
$get_block_wrapper_attributes = 'class="wp-block-vk-blocks-blog-card"';
}
if ( is_array($test['expected']) ) {

if ( is_array( $test['expected'] ) ) {
// Expected が配列の場合
$correct = array();
$correct[1] = sprintf($test['expected']['can_embed'], $get_block_wrapper_attributes);
$correct[2] = sprintf($test['expected']['cannot_embed'], $get_block_wrapper_attributes);
// 埋め込み成功
$correct[1] = sprintf( $test['expected']['can_embed'], $get_block_wrapper_attributes );
// 埋め込み失敗
$correct[2] = sprintf( $test['expected']['cannot_embed'], $get_block_wrapper_attributes );
} else {
$correct = sprintf($test['expected'], $get_block_wrapper_attributes);
$correct = sprintf( $test['expected'], $get_block_wrapper_attributes );
}

// print PHP_EOL;
print '$render_block_content :'; var_dump($render_block_content);
print '$render_block_content :';
var_dump( $render_block_content );
// print PHP_EOL;
// print PHP_EOL;
print 'correct :';
var_dump($correct);
print 'correct :';
var_dump( $correct );
// print PHP_EOL;

if ( is_array($correct) ) {
$this->assertContains($render_block_content, $correct);
if ( is_array( $correct ) ) {
// 成功 / 失敗 がある場合
$this->assertContains( $render_block_content, $correct );
} else {
$this->assertSame( $correct, $render_block_content );
}

}
}
};
}
2 changes: 1 addition & 1 deletion vk-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: VK Blocks Pro
* Plugin URI: https://github.com/vektor-inc/vk-blocks
* Description: This is a plugin that extends Block Editor.
* Version: 1.69.1.2
* Version: 1.70.0.0
* Stable tag: 1.69.1.2
* Requires at least: 6.1
* Author: Vektor,Inc.
Expand Down

0 comments on commit e0e78b8

Please sign in to comment.