You are here

public function CheckboxWithExcludeTest::testBreadcrumbBlockCheckbox in Block Style Plugins 8.2

Same name and namespace in other branches
  1. 8 tests/src/Functional/CheckboxWithExcludeTest.php \Drupal\Tests\block_style_plugins\Functional\CheckboxWithExcludeTest::testBreadcrumbBlockCheckbox()

Test a style is successfully shown for a block.

Test that the "Breadcrumb" block does include style options for the checkbox.

File

tests/src/Functional/CheckboxWithExcludeTest.php, line 82

Class

CheckboxWithExcludeTest
Test the CheckboxWithExclude plugin.

Namespace

Drupal\Tests\block_style_plugins\Functional

Code

public function testBreadcrumbBlockCheckbox() {
  $assert = $this
    ->assertSession();

  // Go to the block instance configuration page.
  $this
    ->drupalGet('admin/structure/block/manage/breadcrumbtest');

  // Check that the style options are available.
  $assert
    ->responseContains('Check this box');
  $assert
    ->fieldExists('third_party_settings[block_style_plugins][checkbox_with_exclude][checkbox_class]');
  $this
    ->submitForm([
    'third_party_settings[block_style_plugins][checkbox_with_exclude][checkbox_class]' => 1,
  ], 'Save block');

  // Go to the home page.
  $this
    ->drupalGet('<front>');

  // Assert that the block was placed and has the custom class.
  $assert
    ->responseContains('id="block-breadcrumbtest"');
  $assert
    ->responseNotContains('checkbox_class');

  // Go back to the block instance configuration page.
  $this
    ->drupalGet('admin/structure/block/manage/breadcrumbtest');

  // Check that the class is set in the style field.
  $assert
    ->checkboxChecked('third_party_settings[block_style_plugins][checkbox_with_exclude][checkbox_class]');
}