CKEditor5OffCanvasTest.php in Drupal 10
File
core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5OffCanvasTest.php
View source
<?php
namespace Drupal\Tests\ckeditor5\FunctionalJavascript;
class CKEditor5OffCanvasTest extends CKEditor5TestBase {
protected static $modules = [
'node',
'ckeditor5',
'ckeditor5_test',
];
public function testOffCanvasStyles() {
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$this
->addNewTextFormat($page, $assert_session);
$this
->drupalGet('/ckeditor5_test/off_canvas');
$page
->clickLink('Add Node');
$assert_session
->waitForElementVisible('css', '#drupal-off-canvas');
$assert_session
->assertWaitOnAjaxRequest();
$styles = $assert_session
->elementExists('css', 'style#ckeditor5-off-canvas-reset');
$this
->stringContains('#drupal-off-canvas [data-drupal-ck-style-fence]', $styles
->getText());
$assert_session
->elementExists('css', '.ck');
$ckeditor_toolbar_bg_color = $this
->getSession()
->evaluateScript('window.getComputedStyle(document.querySelector(\'.ck.ck-toolbar\')).backgroundColor');
$this
->assertEquals('rgb(250, 250, 250)', $ckeditor_toolbar_bg_color, 'Toolbar background-color should be unaffected by off-canvas');
$assert_session
->elementExists('css', '.ck .ck-content');
$ckeditor_editable_bg_color = $this
->getSession()
->evaluateScript('window.getComputedStyle(document.querySelector(\'.ck.ck-content\')).backgroundColor');
$this
->assertEquals('rgb(255, 255, 255)', $ckeditor_editable_bg_color, 'Content background-color should be unaffected by off-canvas');
}
}