You are here

public function LayoutBuilderInlineBlockTest::testInlineBlocksVisibility in Block Style Plugins 8.2

Tests that styles are correctly included/excluded from inline blocks.

File

tests/src/FunctionalJavascript/LayoutBuilderInlineBlockTest.php, line 59

Class

LayoutBuilderInlineBlockTest
Tests that the inline block feature works with styles.

Namespace

Drupal\Tests\block_style_plugins\FunctionalJavascript

Code

public function testInlineBlocksVisibility() {
  $assert = $this
    ->assertSession();
  $this
    ->drupalGet('node/1/layout');

  // Add a basic block with the body field set.
  $this
    ->addInlineBlockToLayout('Block title', 'The DEFAULT block body');

  // Force the finicky contextual links to be visible.
  $this
    ->getSession()
    ->executeScript("jQuery('" . static::INLINE_BLOCK_LOCATOR . " .contextual .trigger').each(function () {this.style.setProperty('position', 'relative', 'important')})");

  // Click the contextual link.
  $this
    ->clickContextualLink(static::INLINE_BLOCK_LOCATOR, 'Style settings');
  $assert
    ->assertWaitOnAjaxRequest();

  // There should not be an option for the excluded style.
  $assert
    ->pageTextContains('Simple Class');
  $assert
    ->pageTextContains('Dropdown with Include');
  $assert
    ->pageTextNotContains('Checkbox with Exclude');
  $assert
    ->pageTextNotContains('Styles Created by Yaml');
}