function CKEditorTestTrait::getEditorButton

Same name in other branches
  1. 8.9.x core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php \Drupal\Tests\ckeditor\Traits\CKEditorTestTrait::getEditorButton()

Waits for a CKEditor button and returns it when available and visible.

Parameters

string $name: The name of the button, such as `drupallink`, `source`, etc.

string $instance_id: (optional) The CKEditor instance ID. Defaults to 'edit-body-0-value'.

Return value

\Behat\Mink\Element\NodeElement|null The page element node if found, NULL if not.

2 calls to CKEditorTestTrait::getEditorButton()
CKEditorTestTrait::assertEditorButtonDisabled in core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php
Asserts a CKEditor button is disabled.
CKEditorTestTrait::assertEditorButtonEnabled in core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php
Asserts a CKEditor button is enabled.

File

core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php, line 75

Class

CKEditorTestTrait
Provides methods to test CKEditor.

Namespace

Drupal\Tests\ckeditor\Traits

Code

protected function getEditorButton($name, $instance_id = 'edit-body-0-value') {
    $this->getSession()
        ->switchToIFrame();
    $button = $this->assertSession()
        ->waitForElementVisible('css', "#cke_{$instance_id} a.cke_button__" . $name);
    $this->assertNotEmpty($button);
    return $button;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.