function HtmxAttributesTest::testStatus

Test status method.

File

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

Class

HtmxAttributesTest
Test all attribute-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testStatus() : void {
  // Test with a placeholder status code.
  $this->htmx
    ->status('status-code', 'swap:innerHTML target:#errors');
  $render = $this->apply();
  $this->assertTrue(isset($render['#attributes']['data-hx-status:status-code']));
  $this->assertEquals('swap:innerHTML target:#errors', $render['#attributes']['data-hx-status:status-code']);
}

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