ckeditor5-1.0.x-dev/tests/src/FunctionalJavascript/CKEditor5ContribTest.php
tests/src/FunctionalJavascript/CKEditor5ContribTest.php
<?php
namespace Drupal\Tests\ckeditor5\FunctionalJavascript;
/**
* Tests for CKEditor5 to ensure contrib can extend functionality.
*
* @group ckeditor5
*/
class CKEditor5ContribTest extends CKEditor5TestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'ckeditor5',
'ckeditor5_test',
];
/**
* Tests that the contrib plugin is added to the CKEditor5 toolbar.
*/
public function testContribPluginAdded() {
$page = $this->getSession()->getPage();
$assert_session = $this->assertSession();
$this->createNewTextFormat($page, $assert_session);
// Press arrow down key to add the button to the active toolbar.
$this->assertNotEmpty($assert_session->waitForElement('css', '.ckeditor5-toolbar-item-simpleBox'));
$this->triggerKeyUp('.ckeditor5-toolbar-item-simpleBox', 'ArrowDown');
$this->saveNewTextFormat($page, $assert_session);
$this->drupalGet('node/add');
// The toolbar UI should have a button with text instead of an icon.
$this->assertNotEmpty($assert_session->waitForText('Simple box'));
}
}
