Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ private function data_wp_bind_processor( WP_Interactivity_API_Directives_Process
$entries = $this->get_directive_entries( $p, 'bind' );
foreach ( $entries as $entry ) {
if ( empty( $entry['suffix'] ) || null !== $entry['unique_id'] ) {
return;
continue;
}

$result = $this->evaluate( $entry );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ public function test_wp_bind_ignores_empty_bound_attribute() {
$this->assertSame( $html, $new_html );
}

/**
* Tests that `data-wp-bind` ignores directives with no suffix but still
* processes valid bind directives on the same element.
*
* @ticket 64518
*
* @covers ::process_directives
*/
public function test_wp_bind_ignores_empty_suffix_but_processes_valid_binds() {
$html = '<div data-wp-bind="myPlugin::state.id" data-wp-bind--id="myPlugin::state.id">Text</div>';
list($p) = $this->process_directives( $html );
$this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
}

/**
* Tests that `data-wp-bind` does nothing when referencing non-existent
* references.
Expand Down Expand Up @@ -416,4 +430,18 @@ public function test_wp_bind_ignores_unique_ids() {
$this->assertNull( $p->get_attribute( 'id' ) );
$this->assertNull( $p->get_attribute( 'id---unique-id' ) );
}

/**
* Tests that `data-wp-bind` ignores directives with unique IDs but still
* processes valid bind directives on the same element.
*
* @ticket 64518
*
* @covers ::process_directives
*/
public function test_wp_bind_ignores_unique_id_but_processes_valid_binds() {
$html = '<div data-wp-bind--id---unique-id="myPlugin::state.id" data-wp-bind--id="myPlugin::state.id">Text</div>';
list($p) = $this->process_directives( $html );
$this->assertSame( 'some-id', $p->get_attribute( 'id' ) );
}
}
Loading