function ExposedFilterAJAXTest::testExposedFilteringThemeNegotiation

Same name and namespace in other branches
  1. 11.x core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\ExposedFilterAJAXTest::testExposedFilteringThemeNegotiation()

Tests if exposed filtering via AJAX theme negotiation works.

File

core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php, line 138

Class

ExposedFilterAJAXTest
Tests the basic AJAX functionality of Views exposed forms.

Namespace

Drupal\Tests\views\FunctionalJavascript

Code

public function testExposedFilteringThemeNegotiation() : void {
  // Install 'claro' and configure it as administrative theme.
  $this->container
    ->get('theme_installer')
    ->install([
    'claro',
  ]);
  $this->config('system.theme')
    ->set('admin', 'claro')
    ->save();
  // Visit the View page.
  $this->drupalGet('admin/content');
  // Search for "Page One".
  $this->submitForm([
    'title' => 'Page One',
  ], 'Filter');
  $this->assertSession()
    ->assertExpectedAjaxRequest(1);
  // Verify that the theme is the 'claro' admin theme and not the default
  // theme ('stark').
  $settings = $this->getDrupalSettings();
  $this->assertNotNull($settings['ajaxPageState']['theme_token']);
  $this->assertEquals('claro', $settings['ajaxPageState']['theme']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.