Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/14/2021 08:52:00 AM (5 years ago)
Author:
imath
Message:

Introduce a new BP_Component property for block globals

This new property will help us to manage Widget Block occurrences globals and use a single filter on 'widget_block_dynamic_classname' to make sure Widget Blocks will include Legacy Widget classnames and inherit their styles.

This commit also makes sure WordPress is >= 5.0 before using the has_block function.

See #8515
Fixes #8516

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/class-bp-component.php

    r12994 r12998  
    22
    33include_once BP_TESTS_DIR . '/assets/bp-rest-api-controllers.php';
     4include_once BP_TESTS_DIR . '/assets/class-bptest-component.php';
    45
    56/**
     
    6970        ) );
    7071    }
     72
     73    /**
     74     * @group bp_blocks
     75     */
     76    public function test_component_block_globals() {
     77        $expected = array(
     78            'dynamic_widget_classname' => 'widget_example_classname',
     79        );
     80
     81        $example = new BPTest_Component(
     82            array(
     83                'globals' => array(
     84                    'block_globals' => array(
     85                        'bp/example-block' => $expected,
     86                    )
     87                ),
     88            )
     89        );
     90
     91        do_action( 'bp_setup_globals' );
     92
     93        $this->assertEquals( $expected, $example->block_globals['bp/example-block']->props );
     94    }
    7195}
Note: See TracChangeset for help on using the changeset viewer.