function HtmxAttributesTest::testHxPost
Test post method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Htmx/ HtmxAttributesTest.php, line 74
Class
- HtmxAttributesTest
- Test all attribute-related Htmx public methods.
Namespace
Drupal\Tests\Core\HtmxCode
public function testHxPost() : void {
$this->htmx
->post($this->url);
$render = $this->apply();
// The paths in GitLabCI include a subfolder.
$this->assertTrue(isset($render['#attributes']['data-hx-post']));
$this->assertStringEndsWith('/common-test/destination', $render['#attributes']['data-hx-post']);
// Verify no parameters.
$this->htmx
->post();
$render = $this->apply();
$this->assertTrue(isset($render['#attributes']['data-hx-post']));
$this->assertEquals('', $render['#attributes']['data-hx-post']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.