Make WordPress Core


Ignore:
Timestamp:
10/21/2025 12:07:16 PM (4 months ago)
Author:
luisherranz
Message:

Interactivity API: Support unique IDs in server-side directives processing.

Server-side logic to support unique IDs in the Interactivity API directives to match what the client is doing (https://github.com/WordPress/gutenberg/pull/72161).

Props santosguillamot, darerodz, luisherranz.
Fixes #64106.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-bind.php

    r58321 r61020  
    399399        $this->assertSame( true, $p->get_attribute( 'id' ) );
    400400    }
     401
     402    /**
     403     * Tests ignores unique IDs in bind directive.
     404     *
     405     * @ticket 64106
     406     *
     407     * @covers ::process_directives
     408     */
     409    public function test_wp_bind_ignores_unique_ids() {
     410        $html    = '<div data-wp-bind--id="myPlugin::state.trueValue"></div>';
     411        list($p) = $this->process_directives( $html );
     412        $this->assertSame( true, $p->get_attribute( 'id' ) );
     413
     414        $html    = '<div data-wp-bind--id---unique-id="myPlugin::state.trueValue"></div>';
     415        list($p) = $this->process_directives( $html );
     416        $this->assertNull( $p->get_attribute( 'id' ) );
     417        $this->assertNull( $p->get_attribute( 'id---unique-id' ) );
     418    }
    401419}
Note: See TracChangeset for help on using the changeset viewer.