You are here

public function StyleJumpMenuTest::testJumpMenuCanBeConfiguredToOpenInNewWindow in Views Jump Menu 8

Tests jump menu output when items are set to open in a new window.

File

tests/src/Functional/Plugin/StyleJumpMenuTest.php, line 143

Class

StyleJumpMenuTest
Tests the Jump Menu style views plugin.

Namespace

Drupal\Tests\views_jump_menu\Functional\Plugin

Code

public function testJumpMenuCanBeConfiguredToOpenInNewWindow() {

  // Explicitly enable the "open in new window" flag.
  $testViewConfig = \Drupal::configFactory()
    ->getEditable('views.view.test_style_jump_menu');
  $testViewConfigArray = $testViewConfig
    ->getOriginal();
  $testViewConfigArray['display']['default']['display_options']['style']['options']['new_window'] = TRUE;
  $testViewConfig
    ->setData($testViewConfigArray);
  $testViewConfig
    ->save();

  // Navigate to the test view.
  $this
    ->drupalGet('test-style-jump-menu');

  // Assert that there is a drupalSetting for this particular select list, and
  // by default, it is set to open in a new window.
  $this
    ->assertRaw('viewsJumpMenu":{"test-style-jump-menu-page-test-jump-menu-jump-menu":{"new_window":true}}');
}