$this->
drupalGet($this->host->
toUrl('edit-form'
));
$this->
waitForEditor();
$page->
pressButton('Source'
);
$editor_dom =
$this->
getEditorDataAsDom();
$drupal_media_element =
$editor_dom->
getElementsByTagName('drupal-media'
)->
item(0
);
// Add `layercake-side` class which is used in `ckeditor5_test_layercake`,
// as well as an arbitrary class to compare behavior between these.
$drupal_media_element->
setAttribute('class', 'layercake-side arbitrary-class'
);
$textarea =
$page->
find('css', '.ck-source-editing-area > textarea'
);
$textarea->
setValue($editor_dom->
C14N());
$page->
pressButton('Source'
);
// Ensure that the `layercake-side` class is retained.
$this->
assertNotEmpty($assert_session->
waitForElement('css', '.ck-widget.drupal-media.layercake-side'
));
// Ensure that the `arbitrary-class` class is removed.
$assert_session->
elementNotExists('css', '.ck-widget.drupal-media.arbitrary-class'
);
$page->
pressButton('Save'
);
// Check that the 'content has been updated' message status appears to confirm we left the editor.
$assert_session->
waitForElementVisible('css', 'messages messages--status'
);