
| Current Path : /var/www/html/rocksensor1/web/core/modules/block/tests/src/FunctionalJavascript/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/modules/block/tests/src/FunctionalJavascript/BlockAddTest.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests\block\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the JS functionality in the block add form.
*
* @group block
*/
class BlockAddTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'block',
'user',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests the AJAX for the theme selector.
*/
public function testBlockAddThemeSelector(): void {
\Drupal::service('theme_installer')->install(['claro']);
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
]));
$this->drupalGet('admin/structure/block/add/system_powered_by_block');
$assert_session = $this->assertSession();
// Pick a theme with a region that does not exist in another theme.
$assert_session->selectExists('Theme')->selectOption('claro');
$assert_session->assertWaitOnAjaxRequest();
$assert_session->selectExists('Region')->selectOption('pre_content');
// Switch to a theme that doesn't contain the region selected above.
$assert_session->selectExists('Theme')->selectOption('stark');
$assert_session->assertWaitOnAjaxRequest();
$assert_session->pageTextNotContains('The submitted value Pre-content in the Region element is not allowed.');
$assert_session->optionExists('Region', '- Select -');
}
}