Skip to content

Commit

Permalink
Details Block: Remove experimental flag and stabilize (#50997)
Browse files Browse the repository at this point in the history
* Details Block: Enable by default on Gutenberg plugin without opt-in

* Add fixture

* Stabilize the block
  • Loading branch information
t-hamano authored May 27, 2023
1 parent da158af commit 0488e29
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 20 deletions.
1 change: 0 additions & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ Add an image or video with a text overlay. ([Source](https://github.com/WordPres
Hide and show additional content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/details))

- **Name:** core/details
- **Experimental:** true
- **Category:** text
- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** showContent, summary
Expand Down
3 changes: 0 additions & 3 deletions lib/experimental/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ function gutenberg_enable_experiments() {
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-group-grid-variation', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGroupGridVariation = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-details-blocks', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableDetailsBlocks = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-pattern-enhancements', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnablePatternEnhancements = true', 'before' );
}
Expand Down
12 changes: 0 additions & 12 deletions lib/experiments-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,6 @@ function gutenberg_initialize_experiments_settings() {
)
);

add_settings_field(
'gutenberg-details-blocks',
__( 'Details block', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Test the Details block', 'gutenberg' ),
'id' => 'gutenberg-details-blocks',
)
);

add_settings_field(
'gutenberg-theme-previews',
__( 'Block Theme Previews', 'gutenberg' ),
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/details/block.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"__experimental": true,
"name": "core/details",
"title": "Details",
"category": "text",
Expand Down
4 changes: 1 addition & 3 deletions packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const getAllBlocks = () => {
columns,
commentAuthorAvatar,
cover,
details,
embed,
file,
group,
Expand Down Expand Up @@ -226,9 +227,6 @@ const getAllBlocks = () => {
queryTitle,
postAuthorBiography,
];
if ( window?.__experimentalEnableDetailsBlocks ) {
blocks.push( details );
}
return blocks.filter( Boolean );
};

Expand Down
7 changes: 7 additions & 0 deletions test/integration/fixtures/blocks/core__details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- wp:details {"summary":"Details Summary"} -->
<details class="wp-block-details"><summary>Details Summary</summary>
<!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
<p>Details Content</p>
<!-- /wp:paragraph -->
</details>
<!-- /wp:details -->
22 changes: 22 additions & 0 deletions test/integration/fixtures/blocks/core__details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"name": "core/details",
"isValid": true,
"attributes": {
"showContent": false,
"summary": "Details Summary"
},
"innerBlocks": [
{
"name": "core/paragraph",
"isValid": true,
"attributes": {
"content": "Details Content",
"dropCap": false,
"placeholder": "Type / to add a hidden block"
},
"innerBlocks": []
}
]
}
]
25 changes: 25 additions & 0 deletions test/integration/fixtures/blocks/core__details.parsed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"blockName": "core/details",
"attrs": {
"summary": "Details Summary"
},
"innerBlocks": [
{
"blockName": "core/paragraph",
"attrs": {
"placeholder": "Type / to add a hidden block"
},
"innerBlocks": [],
"innerHTML": "\n\t<p>Details Content</p>\n\t",
"innerContent": [ "\n\t<p>Details Content</p>\n\t" ]
}
],
"innerHTML": "\n<details class=\"wp-block-details\"><summary>Details Summary</summary>\n\t\n</details>\n",
"innerContent": [
"\n<details class=\"wp-block-details\"><summary>Details Summary</summary>\n\t",
null,
"\n</details>\n"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- wp:details {"summary":"Details Summary"} -->
<details class="wp-block-details"><summary>Details Summary</summary><!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
<p>Details Content</p>
<!-- /wp:paragraph --></details>
<!-- /wp:details -->

1 comment on commit 0488e29

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 0488e29.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5097756566
📝 Reported issues:

Please sign in to comment.