function HtmxRequestInfoTest::testGetHtmxTriggerName
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Htmx/HtmxRequestInfoTest.php \Drupal\Tests\Core\Htmx\HtmxRequestInfoTest::testGetHtmxTriggerName()
Tests the getHtmxTriggerName method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Htmx/ HtmxRequestInfoTest.php, line 122
Class
- HtmxRequestInfoTest
- Test all HtmxRequestInfoTrait methods.
Namespace
Drupal\Tests\Core\HtmxCode
public function testGetHtmxTriggerName() : void {
// Test with the header not present.
$this->assertEquals('', $this->getHtmxTriggerName());
// Test with the header present.
$this->request->headers
->set('HX-Trigger-Name', 'submit-button');
$this->assertEquals('submit-button', $this->getHtmxTriggerName());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.