From 017adf8b4fafcddeb1acb138ebafd88d3048de20 Mon Sep 17 00:00:00 2001 From: tellyworth Date: Wed, 24 Jun 2020 15:34:35 +1000 Subject: [PATCH] Remove the gutenberg-block-directory experimental flag (#23389) * Remove the gutenberg-block-directory experimental flag This removes the flag and its UI, enabling the block directory by default. Note that it does not change the API namespace, which is still `__experimental`. * Remove the experiment toggle in block directory e2e. * Move e2e tests into the editor folder and out of experiments. Co-authored-by: dufresnesteven --- lib/block-directory.php | 1 - lib/experiments-page.php | 12 ------------ lib/rest-api.php | 8 -------- .../__snapshots__/block-directory-add.test.js.snap | 0 .../plugins}/block-directory-add.test.js | 6 ------ phpunit/bootstrap.php | 6 ------ 6 files changed, 33 deletions(-) rename packages/e2e-tests/specs/{experiments => editor/plugins}/__snapshots__/block-directory-add.test.js.snap (100%) rename packages/e2e-tests/specs/{experiments => editor/plugins}/block-directory-add.test.js (96%) diff --git a/lib/block-directory.php b/lib/block-directory.php index f1956f8bfbe83..cf6a933d3dd19 100644 --- a/lib/block-directory.php +++ b/lib/block-directory.php @@ -6,7 +6,6 @@ */ if ( - gutenberg_is_experiment_enabled( 'gutenberg-block-directory' ) && ! has_action( 'admin_enqueue_scripts', 'enqueue_block_editor_assets_block_directory' ) ) { /** diff --git a/lib/experiments-page.php b/lib/experiments-page.php index 07a7f2a200a7b..f7ae531dc3cc6 100644 --- a/lib/experiments-page.php +++ b/lib/experiments-page.php @@ -62,17 +62,6 @@ function gutenberg_initialize_experiments_settings() { 'id' => 'gutenberg-navigation', ) ); - add_settings_field( - 'gutenberg-block-directory', - __( 'Block Directory', 'gutenberg' ), - 'gutenberg_display_experiment_field', - 'gutenberg-experiments', - 'gutenberg_experiments_section', - array( - 'label' => __( 'Enable block directory search', 'gutenberg' ), - 'id' => 'gutenberg-block-directory', - ) - ); add_settings_field( 'gutenberg-full-site-editing', __( 'Full Site Editing', 'gutenberg' ), @@ -143,7 +132,6 @@ function gutenberg_display_experiment_section() { function gutenberg_experiments_editor_settings( $settings ) { $experiments_settings = array( '__experimentalEnableLegacyWidgetBlock' => gutenberg_is_experiment_enabled( 'gutenberg-widget-experiments' ), - '__experimentalBlockDirectory' => gutenberg_is_experiment_enabled( 'gutenberg-block-directory' ), '__experimentalEnableFullSiteEditing' => gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing' ), '__experimentalEnableFullSiteEditingDemo' => gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing-demo' ), ); diff --git a/lib/rest-api.php b/lib/rest-api.php index 0f05798de87d0..7f1d5886c783b 100644 --- a/lib/rest-api.php +++ b/lib/rest-api.php @@ -119,10 +119,6 @@ function gutenberg_register_rest_widget_areas() { * @since 6.5.0 */ function gutenberg_register_rest_block_directory() { - if ( ! gutenberg_is_experiment_enabled( 'gutenberg-block-directory' ) ) { - return; - } - $block_directory_controller = new WP_REST_Block_Directory_Controller(); $block_directory_controller->register_routes(); } @@ -159,10 +155,6 @@ function gutenberg_register_rest_customizer_nonces() { * Registers the Plugins REST API routes. */ function gutenberg_register_plugins_endpoint() { - if ( ! gutenberg_is_experiment_enabled( 'gutenberg-block-directory' ) ) { - return; - } - $plugins = new WP_REST_Plugins_Controller(); $plugins->register_routes(); } diff --git a/packages/e2e-tests/specs/experiments/__snapshots__/block-directory-add.test.js.snap b/packages/e2e-tests/specs/editor/plugins/__snapshots__/block-directory-add.test.js.snap similarity index 100% rename from packages/e2e-tests/specs/experiments/__snapshots__/block-directory-add.test.js.snap rename to packages/e2e-tests/specs/editor/plugins/__snapshots__/block-directory-add.test.js.snap diff --git a/packages/e2e-tests/specs/experiments/block-directory-add.test.js b/packages/e2e-tests/specs/editor/plugins/block-directory-add.test.js similarity index 96% rename from packages/e2e-tests/specs/experiments/block-directory-add.test.js rename to packages/e2e-tests/specs/editor/plugins/block-directory-add.test.js index 7c55976f65da5..af9d615086779 100644 --- a/packages/e2e-tests/specs/experiments/block-directory-add.test.js +++ b/packages/e2e-tests/specs/editor/plugins/block-directory-add.test.js @@ -8,10 +8,6 @@ import { getEditedPostContent, createJSONResponse, } from '@wordpress/e2e-test-utils'; -/** - * Internal dependencies - */ -import { useExperimentalFeatures } from '../../experimental-features'; // Urls to mock const SEARCH_URLS = [ @@ -173,8 +169,6 @@ const matchUrl = ( reqUrl, urls ) => { }; describe( 'adding blocks from block directory', () => { - useExperimentalFeatures( [ '#gutenberg-block-directory' ] ); - beforeEach( async () => { await createNewPost(); } ); diff --git a/phpunit/bootstrap.php b/phpunit/bootstrap.php index b3f564d120e22..30cb39dad4fdd 100644 --- a/phpunit/bootstrap.php +++ b/phpunit/bootstrap.php @@ -70,12 +70,6 @@ function fail_if_died( $message ) { } tests_add_filter( 'wp_die_handler', 'fail_if_died' ); -$GLOBALS['wp_tests_options'] = array( - 'gutenberg-experiments' => array( - 'gutenberg-block-directory' => '1', - ), -); - // Start up the WP testing environment. require $_tests_dir . '/includes/bootstrap.php';