function HtmxAttributesTest::testHxOn

Test on method.

Attributes

#[DataProvider('hxOnDataProvider')]

File

core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php, line 139

Class

HtmxAttributesTest
Test all attribute-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testHxOn(string $event, string $expected) : void {
  $this->htmx
    ->on($event, 'someAction');
  $render = $this->apply();
  $this->assertTrue(isset($render['#attributes'][$expected]));
  $this->assertEquals('someAction', $render['#attributes'][$expected]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.