Skip to content

Commit

Permalink
Fix existing test and add remaining variation fields to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gwwar committed Feb 22, 2021
1 parent 6b17d34 commit 68a576b
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public function get_item_schema() {
'required' => false,
),
'isDefault' => array(
'description' => __( 'Indicates whether the current variation is the default one. Defaults to `false`' ),
'description' => __( 'Indicates whether the current variation is the default one.' ),
'type' => 'boolean',
'required' => false,
'default' => false,
Expand All @@ -558,7 +558,82 @@ public function get_item_schema() {
'type' => 'object',
),
),
//TODO: innerBlocks, example, scope, keywords, isActive
'innerBlocks' => array(
'description' => __( 'Initial configuration of nested blocks.' ),
'type' => 'array',
'items' => array(
'type' => 'object',
'properties' => array(
'name' => array(
'description' => __( 'The name of the inner block.' ),
'type' => 'string',
),
'attributes' => array(
'description' => __( 'The attributes of the inner block.' ),
'type' => 'object',
),
'innerBlocks' => array(
'description' => __( "A list of the inner block's own inner blocks. This is a recursive definition following the parent innerBlocks schema." ),
'type' => 'array',
),
),
),
),
'example' => array(
'description' => __( 'Example provides structured data for the block preview. Set this to `null` to disable the preview shown for the block type.' ),
'type' => array( 'object', 'null' ),
'default' => null,
'properties' => array(
'attributes' => array(
'description' => __( 'The attributes used in the example.' ),
'type' => 'object',
),
'innerBlocks' => array(
'description' => __( 'The list of inner blocks used in the example.' ),
'type' => 'array',
'items' => array(
'type' => 'object',
'properties' => array(
'name' => array(
'description' => __( 'The name of the inner block.' ),
'type' => 'string',
),
'attributes' => array(
'description' => __( 'The attributes of the inner block.' ),
'type' => 'object',
),
'innerBlocks' => array(
'description' => __( "A list of the inner block's own inner blocks. This is a recursive definition following the parent innerBlocks schema." ),
'type' => 'array',
),
),
),
),
),
),
'scope' => array(
'description' => __( 'The list of scopes where the variation is applicable. When not provided, it assumes all available scopes.' ),
'type' => array( 'array', 'null' ),
'default' => null,
'items' => array(
'type' => 'string',
'enum' => array( 'block', 'inserter', 'transform' ),
),
'readonly' => true,
),
'keywords' => array(
'description' => __( 'An array of terms (which can be translated) that help users discover the variation while searching' ),
'type' => 'array',
'items' => array(
'type' => 'string',
),
'default' => array(),
),
'icon' => array(
'description' => __( 'An icon helping to visualize the variation.' ),
'type' => array( 'string', 'null' ),
'default' => null,
),
),
),
'readonly' => true,
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/tests/admin/includesPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ function test_get_block_editor_server_block_settings() {
'category' => 'common',
'styles' => array(),
'keywords' => array(),
'variations' => array(),
),
$blocks[ $name ]
);
Expand Down

0 comments on commit 68a576b

Please sign in to comment.