LayoutBuilderInlineBlockTest.php in Block Style Plugins 8.2
File
tests/src/FunctionalJavascript/LayoutBuilderInlineBlockTest.php
View source
<?php
namespace Drupal\Tests\block_style_plugins\FunctionalJavascript;
use Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase;
class LayoutBuilderInlineBlockTest extends InlineBlockTestBase {
protected static $modules = [
'node',
'layout_builder',
'block_style_plugins',
'block_style_plugins_test',
'contextual',
];
protected $defaultTheme = 'classy';
protected function setUp() : void {
parent::setUp();
$user = $this
->drupalCreateUser([
'configure any layout',
'administer node display',
'administer node fields',
'access contextual links',
'create and edit custom blocks',
]);
$user
->save();
$this
->drupalLogin($user);
$field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
$this
->drupalGet("{$field_ui_prefix}/display/default");
$this
->submitForm([
'layout[enabled]' => TRUE,
'layout[allow_custom]' => TRUE,
], 'Save');
}
public function testInlineBlocksVisibility() {
$assert = $this
->assertSession();
$this
->drupalGet('node/1/layout');
$this
->addInlineBlockToLayout('Block title', 'The DEFAULT block body');
$this
->getSession()
->executeScript("jQuery('" . static::INLINE_BLOCK_LOCATOR . " .contextual .trigger').each(function () {this.style.setProperty('position', 'relative', 'important')})");
$this
->clickContextualLink(static::INLINE_BLOCK_LOCATOR, 'Style settings');
$assert
->assertWaitOnAjaxRequest();
$assert
->pageTextContains('Simple Class');
$assert
->pageTextContains('Dropdown with Include');
$assert
->pageTextNotContains('Checkbox with Exclude');
$assert
->pageTextNotContains('Styles Created by Yaml');
}
}