Commit 2e02af79 authored by lauriii's avatar lauriii

Issue #2667716 by dagmar, YoyoS, Lendude, swentel: Cannot sort a large group...

Issue #2667716 by dagmar, YoyoS, Lendude, swentel: Cannot sort a large group of filters items when using the Exposed Grouped information
parent 4ea838b4
......@@ -1082,7 +1082,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form
'#title' => $this->t('Weight'),
'#title_display' => 'invisible',
'#type' => 'weight',
'#delta' => 10,
'#delta' => count($this->options['group_info']['group_items']),
'#default_value' => $default_weight++,
'#attributes' => ['class' => ['weight']],
],
......
......@@ -81,6 +81,25 @@ public function testGroupedFilterValuesUI() {
$between_to = $page->findField('options[group_info][group_items][1][value][max]');
$this->assertNotEmpty($between_to->isVisible());
$this->assertEquals('2016-01-01', $between_to->getValue());
$weight = $page->findField('options[group_info][group_items][1][weight]');
// If there are 3 items, values from -3 to 3 should be available.
$this->assertFalse($weight->find('named', ['option', -4]));
foreach (range(-3, 3) as $value) {
$this->assertTrue($weight->find('named', ['option', $value]));
}
$this->assertFalse($weight->find('named', ['option', 4]));
$page->pressButton("Add another item");
$web_assert->waitForField('options[group_info][group_items][4][title]');
// A new items was added, weight options should now be -4 to 4.
$this->assertFalse($weight->find('named', ['option', -5]));
foreach (range(-4, 4) as $value) {
$this->assertTrue($weight->find('named', ['option', $value]));
}
$this->assertFalse($weight->find('named', ['option', 5]));
}
}
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