function HtmxAttributesTest::testHxVals
Test vals method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Htmx/ HtmxAttributesTest.php, line 244
Class
- HtmxAttributesTest
- Test all attribute-related Htmx public methods.
Namespace
Drupal\Tests\Core\HtmxCode
public function testHxVals() : void {
$values = [
'myValue' => 'My Value',
];
$this->htmx
->vals($values);
$render = $this->apply();
$this->assertTrue(isset($render['#attributes']['data-hx-vals']));
$this->assertEquals('{"myValue":"My Value"}', $render['#attributes']['data-hx-vals']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.