Commit fe4db364 authored by Marcin Grabias's avatar Marcin Grabias
Browse files

Issue #3356855 by Graber: Selection cleared on pager nav when AJAX is enabled

parent 7a9d61fd
Loading
Loading
Loading
Loading
+13 −4
Original line number Original line Diff line number Diff line
@@ -301,10 +301,19 @@ class ViewsBulkOperationsBulkForm extends FieldPluginBase implements CacheableDe
   */
   */
  protected function getExposedInput(array $exposed_input = []): array {
  protected function getExposedInput(array $exposed_input = []): array {
    if (empty($exposed_input)) {
    if (empty($exposed_input)) {
      // To avoid unnecessary reset of selection, we apply default values. We do
      // To avoid unnecessary reset of selection, we apply default values.
      // that, because default values can be provided or not in the request, and
      // We do that, because default values can be provided or not
      // it doesn't change results.
      // in the request, and it doesn't change results.
      $exposed_input = \array_merge($this->view->getExposedInput(), $this->view->exposed_raw_input);
      $exposed_input = $this->view->getExposedInput();

      // Remove ajax_page_state that leaks to exposed input if AJAX is
      // enabled on the view.
      unset($exposed_input['ajax_page_state']);
      foreach ($this->view->exposed_raw_input as $key => $value) {
        if (!array_key_exists($key, $exposed_input)) {
          $exposed_input[$key] = $value;
        }
      }
    }
    }
    // Sort values to avoid problems when comparing old and current exposed
    // Sort values to avoid problems when comparing old and current exposed
    // input.
    // input.
+1 −0
Original line number Original line Diff line number Diff line
@@ -137,6 +137,7 @@ class ViewsBulkOperationsBulkFormTest extends WebDriverTestBase {
      $this->selectedIndexes[] = $selected_index + $this->testViewParams['items_per_page'];
      $this->selectedIndexes[] = $selected_index + $this->testViewParams['items_per_page'];
      $this->page->checkField('views_bulk_operations_bulk_form[' . $selected_index . ']');
      $this->page->checkField('views_bulk_operations_bulk_form[' . $selected_index . ']');
    }
    }
    $this->assertSession->assertWaitOnAjaxRequest();


    // Execute test operation.
    // Execute test operation.
    $this->page->pressButton('Simple test action');
    $this->page->pressButton('Simple test action');