Verified Commit 52b0cd54 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3370222 by Lendude, solideogloria: Grouped filters with a value of zero...

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

(cherry picked from commit 08bde872)
parent b0dc0e49
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1165,7 +1165,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form
            }
          }

          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];
          }
        }
+17 −0
Original line number Diff line number Diff line
@@ -111,6 +111,23 @@ public function testGroupedFilterValuesUI() {
      $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());
  }

}