You are here

protected function CKEditorIntegrationTest::assertSourceAttributeSame in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::assertSourceAttributeSame()

Verifies value of an attribute on the downcast <drupal-media> element.

Assumes CKEditor is in source mode.

Parameters

string $attribute: The attribute to check.

mixed $value: Either a string value or if NULL, asserts that <drupal-media> element doesn't have the attribute.

2 calls to CKEditorIntegrationTest::assertSourceAttributeSame()
CKEditorIntegrationTest::testAlignment in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests alignment integration.
CKEditorIntegrationTest::testAlt in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests the EditorMediaDialog can set the alt attribute.

File

core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php, line 1420

Class

CKEditorIntegrationTest
@coversDefaultClass \Drupal\media\Plugin\CKEditorPlugin\DrupalMedia @group media

Namespace

Drupal\Tests\media\FunctionalJavascript

Code

protected function assertSourceAttributeSame($attribute, $value) {
  $this
    ->assertNotEmpty($drupal_media = $this
    ->getDrupalMediaFromSource());
  if ($value === NULL) {
    $this
      ->assertFalse($drupal_media
      ->hasAttribute($attribute));
  }
  else {
    $this
      ->assertSame($value, $drupal_media
      ->getAttribute($attribute));
  }
}