function HtmxAttributesTest::testHxSimpleAttributes

Test remaining methods.

Attributes

#[DataProvider('hxSimpleStringAttributesDataProvider')]

File

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

Class

HtmxAttributesTest
Test all attribute-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testHxSimpleAttributes(string $method, null|string|array $value, string $attribute, string|bool $expected) : void {
  if (is_null($value)) {
    $this->htmx
      ->{$method}();
  }
  else {
    $this->htmx
      ->{$method}($value);
  }
  $render = $this->apply();
  $this->assertTrue(isset($render['#attributes'][$attribute]));
  $this->assertEquals($expected, $render['#attributes'][$attribute]);
}

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