function FieldsetHelperTestCase::testFieldsetHelperAlterThemeFieldset in Fieldset helper 6
Test alter fieldset element which can also create fieldset ids for modules like CCK.
File
- ./
fieldset_helper.test, line 121
Class
Code
function testFieldsetHelperAlterThemeFieldset() {
// Test generate fieldset id from #title
$element = array(
'#type' => 'fieldset',
'#title' => t('Collapsible fieldset'),
'#collapsible' => TRUE,
);
$element = fieldset_helper_alter_theme_fieldset($element);
$this
->assertTrue($element['#attributes']['id'] == 'fieldset-collapsible-fieldset', t('Fieldset has id.'));
// Test not generating fieldset id if one already exists/
$element = array(
'#type' => 'fieldset',
'#attributes' => array(
'id' => 'my-custom-ID',
),
'#collapsible' => TRUE,
);
$element = fieldset_helper_alter_theme_fieldset($element);
$this
->assertTrue($element['#attributes']['id'] == 'my-custom-ID', t('Fieldset id is not over-written.'));
}