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