// Assert the link button is present and not pressed.
$link_button =
$this->
getEditorButton('Link'
);
$this->
assertSame('false',
$link_button->
getAttribute('aria-pressed'
));
// Wait for the preview to load.
$preview =
$assert_session->
waitForElement('css', '.ck-content .ck-widget.drupal-media [data-drupal-media-preview="ready"]'
);
$this->
assertNotEmpty($preview);
// Tests linking Drupal media.
$drupalmedia->
click();
$this->
assertTrue($drupalmedia->
hasClass('ck-widget_selected'
));
$this->
assertEditorButtonEnabled('Link'
);
// Assert structure of image toolbar balloon.
$this->
assertVisibleBalloon('.ck-toolbar[aria-label="Drupal Media toolbar"]'
);
$link_media_button =
$this->
getBalloonButton('Link media'
);
// Click the "Link media" button.
$this->
assertSame('false',
$link_media_button->
getAttribute('aria-pressed'
));
$link_media_button->
press();
// Assert structure of link form balloon.
$balloon =
$this->
assertVisibleBalloon('.ck-link-form'
);
$url_input =
$balloon->
find('css', '.ck-labeled-field-view__input-wrapper .ck-input-text'
);
// Fill in link form balloon's <input> and hit "Save".
$url_input->
setValue('http://linking-embedded-media.com'
);