Commit ca895592 authored by webchick's avatar webchick

#954804 follow-up by effulgentsia: Fix bugs related to library weighting.

parent 0e783334
......@@ -834,6 +834,36 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
}
/**
* Test the vertical_tabs form element for expected behavior.
*/
class FormsElementsVerticalTabsFunctionalTest extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Vertical tabs form element type test',
'description' => 'Test the vertical_tabs element for expected behavior',
'group' => 'Form API',
);
}
function setUp() {
parent::setUp('form_test');
}
/**
* Ensures that vertical-tabs.js is included before collapse.js.
*
* Otherwise, collapse.js adds "SHOW" or "HIDE" labels to the tabs.
*/
function testJavaScriptOrdering() {
$this->drupalGet('form_test/vertical-tabs');
$position1 = strpos($this->content, 'misc/vertical-tabs.js');
$position2 = strpos($this->content, 'misc/collapse.js');
$this->assertTrue($position1 !== FALSE && $position2 !== FALSE && $position1 < $position2, t('vertical-tabs.js is included before collapse.js'));
}
}
/**
* Test the form storage on a multistep form.
*
......
......@@ -61,6 +61,14 @@ function form_test_menu() {
'type' => MENU_CALLBACK,
);
$items['form_test/vertical-tabs'] = array(
'title' => 'Vertical tabs tests',
'page callback' => 'drupal_get_form',
'page arguments' => array('_form_test_vertical_tabs_form'),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['form_test/form-storage'] = array(
'title' => 'Form storage test',
'page callback' => 'drupal_get_form',
......@@ -537,6 +545,36 @@ function _form_test_tableselect_js_select_form($form, $form_state, $action) {
return _form_test_tableselect_form_builder($form, $form_state, $options);
}
/**
* Tests functionality of vertical tabs.
*/
function _form_test_vertical_tabs_form($form, &$form_state) {
$form['vertical_tabs'] = array(
'#type' => 'vertical_tabs',
);
$form['tab1'] = array(
'#type' => 'fieldset',
'#title' => t('Tab 1'),
'#collapsible' => TRUE,
'#group' => 'vertical_tabs',
);
$form['tab1']['field1'] = array(
'#title' => t('Field 1'),
'#type' => 'textfield',
);
$form['tab2'] = array(
'#type' => 'fieldset',
'#title' => t('Tab 2'),
'#collapsible' => TRUE,
'#group' => 'vertical_tabs',
);
$form['tab2']['field2'] = array(
'#title' => t('Field 2'),
'#type' => 'textfield',
);
return $form;
}
/**
* A multistep form for testing the form storage.
*
......
......@@ -1097,7 +1097,7 @@ function system_library() {
'title' => 'Drupal batch API',
'version' => VERSION,
'js' => array(
'misc/batch.js' => array('cache' => FALSE),
'misc/batch.js' => array('group' => JS_DEFAULT, 'cache' => FALSE),
),
'dependencies' => array(
array('system', 'drupal.progress'),
......@@ -1109,7 +1109,7 @@ function system_library() {
'title' => 'Drupal progress indicator',
'version' => VERSION,
'js' => array(
'misc/progress.js' => array('cache' => FALSE),
'misc/progress.js' => array('group' => JS_DEFAULT, 'cache' => FALSE),
),
);
......@@ -1136,7 +1136,7 @@ function system_library() {
'title' => 'Drupal collapsible fieldset',
'version' => VERSION,
'js' => array(
'misc/collapse.js' => array(),
'misc/collapse.js' => array('group' => JS_DEFAULT),
),
'dependencies' => array(
// collapse.js relies on drupalGetSummary in form.js
......@@ -1149,7 +1149,7 @@ function system_library() {
'title' => 'Drupal resizable textarea',
'version' => VERSION,
'js' => array(
'misc/textarea.js' => array(),
'misc/textarea.js' => array('group' => JS_DEFAULT),
),
);
......@@ -1158,7 +1158,7 @@ function system_library() {
'title' => 'Drupal autocomplete',
'version' => VERSION,
'js' => array(
'misc/autocomplete.js' => array(),
'misc/autocomplete.js' => array('group' => JS_DEFAULT),
),
);
......
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