public function CkEditorMediaBrowserTest::testEditEmbed in Lightning Media 8.2
Tests that the entity embed dialog opens when editing a pre-existing embed.
File
- tests/
src/ ExistingSiteJavascript/ CkEditorMediaBrowserTest.php, line 138
Class
- CkEditorMediaBrowserTest
- @group lightning @group lightning_media
Namespace
Drupal\Tests\lightning_media\ExistingSiteJavascriptCode
public function testEditEmbed() {
$session = $this
->getSession();
$node = $this
->createNode([
'type' => 'page',
'title' => 'Blorf',
'uid' => $this->uid,
'body' => [
'value' => '',
'format' => 'rich_text',
],
]);
$this
->visit('/node/' . $node
->id() . '/edit');
$this
->open();
$session
->switchToIFrame('entity_browser_iframe_media_browser');
$items = $this
->getItems();
$this
->assertGreaterThanOrEqual(3, count($items));
$this->assert
->fieldExists('Select this item', $items[0])
->check();
$this->assert
->buttonExists('Place')
->press();
$session
->switchToIFrame(NULL);
$this->assert
->assertWaitOnAjaxRequest();
$embed_dialog = $this->assert
->elementExists('css', 'form.entity-embed-dialog');
$this->assert
->buttonExists('Embed', $embed_dialog)
->press();
$this->assert
->assertWaitOnAjaxRequest();
$this->assert
->buttonExists('Save')
->press();
$this
->visit('/node/' . $node
->id() . '/edit');
$this
->open();
$this->assert
->assertWaitOnAjaxRequest();
$this->assert
->elementExists('css', 'form.entity-embed-dialog');
}