function HtmxAttributesTest::testHxGet

Test get method.

File

core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php, line 58

Class

HtmxAttributesTest
Test all attribute-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testHxGet() : void {
  $this->htmx
    ->get($this->url);
  $render = $this->apply();
  // The paths in GitLabCI include a subfolder.
  $this->assertTrue(isset($render['#attributes']['data-hx-get']));
  $this->assertStringEndsWith('/common-test/destination', $render['#attributes']['data-hx-get']);
  // Verify no parameters.
  $this->htmx
    ->get();
  $render = $this->apply();
  $this->assertTrue(isset($render['#attributes']['data-hx-get']));
  $this->assertEquals('', $render['#attributes']['data-hx-get']);
}

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