Make WordPress Core


Ignore:
Timestamp:
12/16/2021 02:45:32 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Add unit tests for theme features that block themes should support by default.

By default, block themes should have a few theme supports enabled:

  • post-thumbnails
  • responsive-embeds
  • editor-styles
  • html5 for comment-form, comment-list, style, script
  • automatic-feed-links

They should also load core block assets only when the blocks are rendered. This commit adds the associated tests.

Follow-up to [52369].

Props costdev.
See #54597.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r52369 r52383  
    41694169 * Adds default theme supports for block themes when the 'setup_theme' action fires.
    41704170 *
     4171 * See {@see 'setup_theme'}.
     4172 *
    41714173 * @since 5.9.0
    41724174 * @access private
    41734175 */
    41744176function _add_default_theme_supports() {
    4175     if ( wp_is_block_theme() ) {
    4176         add_theme_support( 'post-thumbnails' );
    4177         add_theme_support( 'responsive-embeds' );
    4178         add_theme_support( 'editor-styles' );
    4179         add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'style', 'script' ) );
    4180         add_theme_support( 'automatic-feed-links' );
    4181         add_filter( 'should_load_separate_core_block_assets', '__return_true' );
    4182     }
    4183 }
     4177    if ( ! wp_is_block_theme() ) {
     4178        return;
     4179    }
     4180
     4181    add_theme_support( 'post-thumbnails' );
     4182    add_theme_support( 'responsive-embeds' );
     4183    add_theme_support( 'editor-styles' );
     4184    add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'style', 'script' ) );
     4185    add_theme_support( 'automatic-feed-links' );
     4186
     4187    add_filter( 'should_load_separate_core_block_assets', '__return_true' );
     4188}
Note: See TracChangeset for help on using the changeset viewer.