public function CKEditorIntegrationTest::testDrupalImageCaptionDialog in Drupal 8
Same name and namespace in other branches
- 9 core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest::testDrupalImageCaptionDialog()
Tests if the Drupal Image Caption plugin appears and works as expected.
File
- core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ CKEditorIntegrationTest.php, line 160
Class
- CKEditorIntegrationTest
- Tests the integration of CKEditor.
Namespace
Drupal\Tests\ckeditor\FunctionalJavascriptCode
public function testDrupalImageCaptionDialog() {
$web_assert = $this
->assertSession();
// Disable the caption filter.
$this->filterFormat
->setFilterConfig('filter_caption', [
'status' => FALSE,
]);
$this->filterFormat
->save();
// If the caption filter is disabled, its checkbox should be absent.
$this
->drupalGet('node/add/page');
$this
->waitForEditor();
$this
->pressEditorButton('drupalimage');
$this
->assertNotEmpty($web_assert
->waitForElement('css', '.ui-dialog'));
$web_assert
->elementNotExists('css', '.ui-dialog input[name="attributes[hasCaption]"]');
// Enable the caption filter again.
$this->filterFormat
->setFilterConfig('filter_caption', [
'status' => TRUE,
]);
$this->filterFormat
->save();
// If the caption filter is enabled, its checkbox should be present.
$this
->drupalGet('node/add/page');
$this
->waitForEditor();
$this
->pressEditorButton('drupalimage');
$this
->assertNotEmpty($web_assert
->waitForElement('css', '.ui-dialog'));
$web_assert
->elementExists('css', '.ui-dialog input[name="attributes[hasCaption]"]');
}