function HtmxAttributesTest::testHxDisable

Test disable method.

Attributes

#[TestWith([ FALSE, ])] #[TestWith([ TRUE, ])]

File

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

Class

HtmxAttributesTest
Test all attribute-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testHxDisable(bool $useMerge) : void {
  $selector = 'div.some-class';
  $expectedName = $useMerge ? 'data-hx-disable:merge' : 'data-hx-disable';
  $this->htmx
    ->disable($selector, $useMerge);
  $render = $this->apply();
  $this->assertTrue(isset($render['#attributes'][$expectedName]));
  $this->assertEquals($selector, $render['#attributes'][$expectedName]);
}

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