diff --git a/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php b/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php index 6e3ba9a4f5..1d6af7c3da 100644 --- a/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php +++ b/core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php @@ -36,12 +36,12 @@ protected function setUp() { parent::setUp(); // Create a text format and associate CKEditor. - $filtered_html_format = FilterFormat::create([ + $this->filtered_html_format = FilterFormat::create([ 'format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, ]); - $filtered_html_format->save(); + $this->filtered_html_format->save(); Editor::create([ 'format' => 'filtered_html', @@ -139,4 +139,37 @@ public function testDrupalImageDialog() { $web_assert->elementContains('css', '.ui-dialog .ui-dialog-titlebar', 'Insert Image'); } + /** + * Tests if the Image Caption plugin appears and works as expected. + */ + public function testDrupalImageCaptionDialog() { + $web_assert = $this->assertSession(); + + // Disable the filter caption. + $this->filtered_html_format->setFilterConfig('filter_caption', [ + 'status' => FALSE, + ]); + $this->filtered_html_format->save(); + + // If the filter caption is disabled, the caption's checkbox + // should not be present. + $this->drupalGet('node/add/page'); + $this->click('.cke_button__drupalimage'); + $this->assertNotEmpty($web_assert->waitForElement('css', '.ui-dialog')); + $web_assert->elementNotExists('css', '.ui-dialog input[name="attributes[hasCaption]"]'); + + // Enable the filter caption. + $this->filtered_html_format->setFilterConfig('filter_caption', [ + 'status' => TRUE, + ]); + $this->filtered_html_format->save(); + + // If the filter caption is enable, the caption's checkbox + // should be present. + $this->drupalGet('node/add/page'); + $this->click('.cke_button__drupalimage'); + $this->assertNotEmpty($web_assert->waitForElement('css', '.ui-dialog')); + $web_assert->elementExists('css', '.ui-dialog input[name="attributes[hasCaption]"]'); + } + }