function FormHelperTest::testProcessStates
@covers ::processStates
@dataProvider providerElements
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormHelperTest.php, line 92
Class
- FormHelperTest
- @coversDefaultClass \Drupal\Core\Form\FormHelper[[api-linebreak]] @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testProcessStates($elements, $key) : void {
$json = Json::encode($elements['#states']);
FormHelper::processStates($elements);
$this->assertEquals([
'core/drupal.states',
], $elements['#attached']['library']);
$this->assertEquals($json, $elements[$key]['data-drupal-states']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.