Commit c2ac32c9 authored by alexpott's avatar alexpott

Issue #2226323 by kpv | danylevskyi: Fixed CompositeFormElementTrait causes...

Issue #2226323 by kpv | danylevskyi: Fixed CompositeFormElementTrait causes identical HTML ids for element and its wrapper.
parent f48a4676
......@@ -32,6 +32,7 @@ public static function preRenderCompositeFormElement($element) {
if (isset($element['#title']) || isset($element['#description'])) {
// @see #type 'fieldgroup'
$element['#attributes']['id'] = $element['#id'] . '--wrapper';
$element['#theme_wrappers'][] = 'fieldset';
$element['#attributes']['class'][] = 'fieldgroup';
$element['#attributes']['class'][] = 'form-composite';
......
......@@ -87,6 +87,21 @@ function testOptions() {
}
}
/**
* Tests wrapper ids for checkboxes and radios.
*/
function testWrapperIds() {
$this->drupalGet('form-test/checkboxes-radios');
// Verify that wrapper id is different from element id.
foreach (array('checkboxes', 'radios') as $type) {
$element_ids = $this->xpath('//div[@id=:id]', array(':id' => 'edit-' . $type));
$wrapper_ids = $this->xpath('//fieldset[@id=:id]', array(':id' => 'edit-' . $type . '--wrapper'));
$this->assertTrue(count($element_ids) == 1, format_string('A single element id found for type %type', array('%type' => $type)));
$this->assertTrue(count($wrapper_ids) == 1, format_string('A single wrapper id found for type %type', array('%type' => $type)));
}
}
/**
* Tests button classes.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment