Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7f1f6a0
Introduce data provider to allow extending test coverage
ockham Aug 13, 2025
054756d
Add test coverage for Button block's text attribute
ockham Aug 13, 2025
b328dee
Block Bindings: Simplify replace_html() method
ockham Aug 13, 2025
21e80e2
Add WP_Block_Bindings_Processor class
ockham Aug 18, 2025
1c70bc3
Use WP_Block_Bindings_Processor for block bindings
ockham Aug 18, 2025
8f76759
Add kses back :/
ockham Aug 18, 2025
b7b7ca5
WPCS
ockham Aug 18, 2025
bb7c906
Remove obsolete var
ockham Aug 18, 2025
103a5c4
Indentation
ockham Aug 18, 2025
3f2e32b
Return true upon success
ockham Aug 18, 2025
85b6354
Add basic PHPDoc
ockham Aug 18, 2025
b67890e
Add more PHPDoc
ockham Aug 19, 2025
6bc4fd5
Add basic test coverage
ockham Aug 19, 2025
d943cd8
Allow setting attributes
ockham Aug 19, 2025
527c5d8
Increase test coverage
ockham Aug 19, 2025
86e836d
Increase test coverage
ockham Aug 20, 2025
dad7380
Add more commentary and warnings
ockham Aug 20, 2025
88af5ff
Do not explose block bindings processor class
sirreal Aug 21, 2025
a56f978
Remove block bindings processor class
sirreal Aug 21, 2025
7c3fc45
wpcs
sirreal Aug 21, 2025
66fef38
Make the hidden class instance static
sirreal Aug 21, 2025
24a0b0d
Use Reflection to make tests work again
ockham Aug 25, 2025
2e7df73
Block Bindings Processor: Tweak test to break with current implementa…
ockham Aug 25, 2025
e2f0a38
Block Bindings Processor: Base implementation on WP_HTML_Text_Replace…
ockham Aug 25, 2025
b045050
Remove now-obsolete build() alias method
ockham Aug 25, 2025
e739c6c
Rename test file
ockham Aug 25, 2025
6a4a3a3
Correct @since PHPDoc
ockham Aug 25, 2025
4dbb0e5
More descriptive variable names
ockham Aug 26, 2025
a18e435
Remove static var
ockham Aug 26, 2025
3410f40
Make sure we're not stopped on atomic/void/self-closing element
ockham Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test coverage for Button block's text attribute
  • Loading branch information
ockham committed Aug 26, 2025
commit 054756df5d5b1028a81ab7aa31499e59935ef13c
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ private function replace_html( string $block_content, string $attribute_name, $s
// Store the parent tag and its attributes to be able to restore them later in the button.
// The button block has a wrapper while the paragraph and heading blocks don't.
if ( 'core/button' === $this->name ) {
$button_wrapper = $block_reader->get_tag();
$button_wrapper = strtolower( $block_reader->get_tag() );
$button_wrapper_attribute_names = $block_reader->get_attribute_names_with_prefix( '' );
$button_wrapper_attrs = array();
foreach ( $button_wrapper_attribute_names as $name ) {
Expand Down
11 changes: 10 additions & 1 deletion tests/phpunit/tests/block-bindings/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ public function data_update_block_with_value_from_source() {
<!-- /wp:paragraph -->
HTML,
'<p>test source value</p>'
)
),
'button block' => array(
'text',
<<<HTML
<!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">This should not appear</a></div>
<!-- /wp:button -->
HTML,
'<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">test source value</a></div>'
),
);
}

Expand Down