function HtmxRequestInfoTest::testGetHtmxPrompt

Tests the getHtmxPrompt method.

File

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

Class

HtmxRequestInfoTest
Test all HtmxRequestInfoTrait methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testGetHtmxPrompt() : void {
  // Test with the header not present.
  $this->assertEquals('', $this->getHtmxPrompt());
  // Test with the header present.
  $this->request->headers
    ->set('HX-Prompt', 'Enter a value');
  $this->assertEquals('Enter a value', $this->getHtmxPrompt());
}

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