Issue #3370222 by Lendude, solideogloria: Grouped filters with a value of zero do not show when editing the filter

merge-requests/3189/merge
Lee Rowlands 2023-07-10 09:51:07 +10:00
parent be366aec48
commit 08bde872c0
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
2 changed files with 18 additions and 1 deletions

View File

@ -1166,7 +1166,7 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
}
}
if (!empty($this->options['group_info']['group_items'][$item_id]['value'][$child])) {
if (isset($this->options['group_info']['group_items'][$item_id]['value'][$child])) {
$row['value'][$child]['#default_value'] = $this->options['group_info']['group_items'][$item_id]['value'][$child];
}
}

View File

@ -111,6 +111,23 @@ class GroupedExposedFilterTest extends WebDriverTestBase {
$this->assertNotEmpty($weight->find('named', ['option', $value]));
}
$this->assertEmpty($weight->find('named', ['option', 5]));
// Set the date value to a zero value and make sure it's stored.
$between_from = $page->findField('options[group_info][group_items][1][value][min]');
$between_from->setValue('0');
$apply_button = $page->find('css', '.views-ui-dialog button.button--primary');
$this->assertNotEmpty($apply_button);
$apply_button->press();
$web_assert->assertWaitOnAjaxRequest();
// Open the dialog for the grouped filter.
$page->clickLink('Content: Authored on (grouped)');
$web_assert->assertWaitOnAjaxRequest();
// Test that the 'min' field is shown and that it contains the right value.
$between_from = $page->findField('options[group_info][group_items][1][value][min]');
$this->assertNotEmpty($between_from->isVisible());
$this->assertEquals('0', $between_from->getValue());
}
}