$this->
pressEditorButton('Bold'
);
$this->
assertNotEmpty($assert_session->
waitForElement('css', '.drupal-media figcaption > strong'
));
$this->
assertEquals('<strong>Llamas are the most awesome ever</strong>',
$figcaption->
getHtml());
$editor_dom =
$this->
getEditorDataAsDom();
$this->
assertEquals('<strong>Llamas are the most awesome ever</strong>',
$editor_dom->
getElementsByTagName('drupal-media'
)->
item(0
)->
getAttribute('data-caption'
));
// Ensure that bold can be removed from the caption.
$this->
assertNotEmpty($assert_session->
waitForElement('css', '.drupal-media figcaption > strong'
));
$this->
selectTextInsideElement('.drupal-media figcaption > strong'
);
$this->
assertNotEmpty($assert_session->
waitForElement('css', '.drupal-media figcaption.ck-editor__nested-editable'
));
$this->
pressEditorButton('Bold'
);
$this->
assertTrue($assert_session->
waitForElementRemoved('css', '.drupal-media figcaption > strong'
));
$this->
assertNotEmpty($figcaption =
$assert_session->
waitForElement('css', '.drupal-media figcaption'
));
$this->
assertEquals('Llamas are the most awesome ever',
$figcaption->
getHtml());
$editor_dom =
$this->
getEditorDataAsDom();
$this->
assertEquals('Llamas are the most awesome ever',
$editor_dom->
getElementsByTagName('drupal-media'
)->
item(0
)->
getAttribute('data-caption'
));
// Ensure that caption can contain elements such as <br>.
$this->
pressEditorButton('Source'
);
$source_text_area =
$assert_session->
waitForElement('css', '.ck-source-editing-area textarea'
);
$source_text =
$source_text_area->
getValue();
$source_text_area->
setValue(str_replace('data-caption="Llamas are the most awesome ever"', 'data-caption="Llamas are the most<br>awesome ever"',
$source_text));
// Click source again to make source inactive.