Issue #2916589 by wengerk, Wim Leers: Extend the CKEditorIntegrationTest for DrupalImageCaption

8.7.x
Alex Pott 2018-09-20 11:32:31 +01:00
parent 662b79443f
commit 7254e79e8e
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
1 changed files with 40 additions and 2 deletions

View File

@ -24,6 +24,13 @@ class CKEditorIntegrationTest extends WebDriverTestBase {
*/
protected $account;
/**
* The FilterFormat config entity used for testing.
*
* @var \Drupal\filter\FilterFormatInterface
*/
protected $filterFormat;
/**
* {@inheritdoc}
*/
@ -36,12 +43,12 @@ class CKEditorIntegrationTest extends WebDriverTestBase {
parent::setUp();
// Create a text format and associate CKEditor.
$filtered_html_format = FilterFormat::create([
$this->filterFormat = FilterFormat::create([
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
]);
$filtered_html_format->save();
$this->filterFormat->save();
Editor::create([
'format' => 'filtered_html',
@ -139,4 +146,35 @@ class CKEditorIntegrationTest extends WebDriverTestBase {
$web_assert->elementContains('css', '.ui-dialog .ui-dialog-titlebar', 'Insert Image');
}
/**
* Tests if the Drupal Image Caption plugin appears and works as expected.
*/
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->click('.cke_button__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->click('.cke_button__drupalimage');
$this->assertNotEmpty($web_assert->waitForElement('css', '.ui-dialog'));
$web_assert->elementExists('css', '.ui-dialog input[name="attributes[hasCaption]"]');
}
}