Skip to content

Commit

Permalink
Remove fallback mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed May 28, 2024
1 parent 3600eea commit 9d54dd6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
5 changes: 0 additions & 5 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2364,9 +2364,6 @@ function _wp_footnotes_force_filtered_html_on_import_filter( $arg ) {
* block attribute keys that are compared to the given block's attributes using
* a strict equality check.
*
* If no `isActive` property is defined, all `attributes` specified by a variation
* are compared to the given block's to determine if the variation is active.
*
* @param WP_Block_Type $block_type Block Type.
* @param array $block_attributes Block attributes.
* @return array|null The active block variation, or null if no active variation is found.
Expand All @@ -2379,8 +2376,6 @@ function get_active_block_variation( $block_type, $block_attributes ) {
! empty( $variation['isActive'] )
) {
$attributes = $variation['isActive'];
} else if ( isset( $variation['attributes'] ) ) {
$attributes = array_keys( $variation['attributes'] );
} else {
// We have no way to determine if this is the active variation.
continue;
Expand Down
45 changes: 0 additions & 45 deletions tests/phpunit/tests/blocks/getActiveBlockVariation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,6 @@ public function test_get_active_block_variation_match_with_is_active() {
$this->assertSame( 'variation_with_is_active', $active_variation['name'] );
}

/**
* @ticket 61265
*/
public function test_get_active_block_variation_match_with_empty_is_active() {
$block_attributes = array(
'attribute1' => 'var2-attr1',
'attribute2' => 'var2-attr2',
'attribute3' => 'var2-attr3',
);

$active_variation = get_active_block_variation( self::$block_type, $block_attributes );
$this->assertSame( 'variation_with_empty_is_active', $active_variation['name'] );
}

/**
* @ticket 61265
*/
public function test_get_active_block_variation_match_without_is_active() {
$block_attributes = array(
'attribute1' => 'var3-attr1',
'attribute2' => 'var3-attr2',
'attribute3' => 'var3-attr3',
);

$active_variation = get_active_block_variation( self::$block_type, $block_attributes );
$this->assertSame( 'variation_without_is_active', $active_variation['name'] );
}

/**
* Mock variation callback.
*
Expand All @@ -114,23 +86,6 @@ public static function mock_variation_callback() {
'attribute3',
),
),
array(
'name' => 'variation_with_empty_is_active',
'attributes' => array(
'attribute1' => 'var2-attr1',
'attribute2' => 'var2-attr2',
'attribute3' => 'var2-attr3',
),
'isActive' => array(),
),
array(
'name' => 'variation_without_is_active',
'attributes' => array(
'attribute1' => 'var3-attr1',
'attribute2' => 'var3-attr2',
'attribute3' => 'var3-attr3',
),
),
);
}
}

0 comments on commit 9d54dd6

Please sign in to comment.