function HtmxRequestInfoTest::testGetHtmxSource

Tests the getHtmxTrigger method.

File

core/tests/Drupal/Tests/Core/Htmx/HtmxRequestInfoTest.php, line 98

Class

HtmxRequestInfoTest
Test all HtmxRequestInfoTrait methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testGetHtmxSource() : void {
  // Test with the header not present.
  $this->assertEquals('', $this->getHtmxSource());
  // Test with the header present.
  $this->request->headers
    ->set('HX-Source', 'input#submit-button');
  $this->assertEquals('input#submit-button', $this->getHtmxSource());
}

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