Commit 2acf463d authored by Dries's avatar Dries

- Patch #674626 by asimmonds: fixed text format filter list not being ordered correctly.

parent 03d9f681
......@@ -182,6 +182,7 @@ function filter_admin_format_form($form, &$form_state, $format) {
'#default_value' => $filters[$name]->weight,
'#parents' => array('filters', $name, 'weight'),
);
$form['filters']['order'][$name]['#weight'] = $filters[$name]->weight;
}
// Filter settings.
......
......@@ -231,6 +231,9 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$result = db_query('SELECT * FROM {cache_filter}')->fetchObject();
$this->assertFalse($result, t('Cache cleared.'));
$elements = $this->xpath('//select[@name="filters[' . $first_filter . '][weight]"]/following::select[@name="filters[' . $second_filter . '][weight]"]');
$this->assertTrue(!empty($elements), t('Order confirmed in admin interface.'));
// Reorder filters.
$edit = array();
$edit['filters[' . $second_filter . '][weight]'] = 1;
......@@ -239,6 +242,9 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$this->assertFieldByName('filters[' . $second_filter . '][weight]', 1, t('Order saved successfully.'));
$this->assertFieldByName('filters[' . $first_filter . '][weight]', 2, t('Order saved successfully.'));
$elements = $this->xpath('//select[@name="filters[' . $second_filter . '][weight]"]/following::select[@name="filters[' . $first_filter . '][weight]"]');
$this->assertTrue(!empty($elements), t('Reorder confirmed in admin interface.'));
$result = db_query('SELECT * FROM {filter} WHERE format = :format ORDER BY weight ASC', array(':format' => $filtered));
$filters = array();
foreach ($result as $filter) {
......@@ -246,7 +252,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$filters[] = $filter;
}
}
$this->assertTrue(($filters[0]->name == $second_filter && $filters[1]->name == $first_filter), t('Order confirmed.'));
$this->assertTrue(($filters[0]->name == $second_filter && $filters[1]->name == $first_filter), t('Order confirmed in database.'));
// Add format.
$edit = array();
......
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