You are here

public function ThemeResetTest::testCustomBlockStyles in Media Library Theme Reset 8

Test styles inherited from module.

File

tests/src/FunctionalJavascript/ThemeResetTest.php, line 66

Class

ThemeResetTest
Tests that the module styles are appended to media library.

Namespace

Drupal\Tests\media_library_theme_reset\FunctionalJavascript

Code

public function testCustomBlockStyles() {
  $session = $this
    ->getSession();
  $page = $session
    ->getPage();
  $assert = $this
    ->assertSession();
  $session
    ->resizeWindow(1200, 2000);

  // Visit the content layout manage page.
  $this
    ->drupalGet('admin/structure/types/manage/basic_page/display/default/layout');

  // Try adding a new block with Layout Builder.
  $page
    ->clickLink('Add block');
  $assert
    ->waitForText('Create custom block');

  // Start creating a custom block.
  $page
    ->clickLink('Create custom block');
  $assert
    ->waitForText('Add media');

  // Open the media library by clicking the add media button.
  $page
    ->pressButton('Add media');
  $assert
    ->waitForText('Add or select media');

  // Assert submit button has color provided by module styles.
  $actual_background = $session
    ->evaluateScript('jQuery(".ui-dialog-buttonpane .ui-dialog-buttonset .media-library-select").css("background-color")');
  $this
    ->assertSame("rgb(0, 113, 184)", $actual_background);
}