function ImageTestProviderTrait::testResize
Tests the image resize plugin.
Confirms that enabling the resize plugin introduces the resize class to images within CKEditor 5.
@dataProvider providerResize
Parameters
bool $is_resize_enabled: Boolean flag to test enabled or disabled.
File
-
core/
modules/ ckeditor5/ tests/ src/ FunctionalJavascript/ ImageTestProviderTrait.php, line 262
Class
- ImageTestProviderTrait
- Provides test methods using data providers for image tests.
Namespace
Drupal\Tests\ckeditor5\FunctionalJavascriptCode
public function testResize(bool $is_resize_enabled) : void {
// Disable resize plugin because it is enabled by default.
if (!$is_resize_enabled) {
Editor::load('test_format')->setSettings([
'toolbar' => [
'items' => [
'drupalInsertImage',
],
],
'plugins' => [
'ckeditor5_imageResize' => [
'allow_resize' => FALSE,
],
],
])
->save();
}
$page = $this->getSession()
->getPage();
$assert_session = $this->assertSession();
$this->drupalGet('node/add');
$page->fillField('title[0][value]', 'My test content');
$this->addImage();
$image_figure = $assert_session->waitForElementVisible('css', 'figure');
$this->assertSame($is_resize_enabled, $image_figure->hasClass('ck-widget_with-resizer'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.