Unverified Commit 689225c9 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3304731 by phenaproxima, bnjmnm: Update remaining tests using Classy to use Starterkit

parent 5e550c03
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ class FormErrorHandlerCKEditorTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'starterkit_theme';

  /**
   * {@inheritdoc}
+9 −10
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class MediaLibraryTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'starterkit_theme';

  /**
   * The user to use during testing.
@@ -306,21 +306,20 @@ public function testAllowedMediaTypes() {
      $this->assertNotEmpty($assert_session->waitForId('media-library-wrapper'));

      if (empty($allowed_media_types) || count($allowed_media_types) === 2) {
        $assert_session->elementExists('css', 'li.media-library-menu-image');
        $assert_session->elementExists('css', 'li.media-library-menu-arrakis');
        $assert_session->elementTextContains('css', '.media-library-item__name', 'Fear is the mind-killer');
        $menu = $assert_session->elementExists('css', '.js-media-library-menu');
        $assert_session->elementExists('named', ['link', 'Image'], $menu);
        $assert_session->elementExists('named', ['link', 'Arrakis'], $menu);
        $assert_session->elementTextContains('css', '.js-media-library-item', 'Fear is the mind-killer');
      }
      elseif (count($allowed_media_types) === 1 && !empty($allowed_media_types['image'])) {
        // No tabs should appear if there's only one media type available.
        $assert_session->elementNotExists('css', 'li.media-library-menu-image');
        $assert_session->elementNotExists('css', 'li.media-library-menu-arrakis');
        $assert_session->elementTextContains('css', '.media-library-item__name', 'Fear is the mind-killer');
        $assert_session->elementNotExists('css', '.js-media-library-menu');
        $assert_session->elementTextContains('css', '.js-media-library-item', 'Fear is the mind-killer');
      }
      elseif (count($allowed_media_types) === 1 && !empty($allowed_media_types['arrakis'])) {
        // No tabs should appear if there's only one media type available.
        $assert_session->elementNotExists('css', 'li.media-library-menu-image');
        $assert_session->elementNotExists('css', 'li.media-library-menu-arrakis');
        $assert_session->elementTextContains('css', '.media-library-item__name', 'Le baron Vladimir Harkonnen');
        $assert_session->elementNotExists('css', '.js-media-library-menu');
        $assert_session->elementTextContains('css', '.js-media-library-item', 'Le baron Vladimir Harkonnen');
      }
    }
  }
+11 −11
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ class MediaTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'starterkit_theme';

  /**
   * {@inheritdoc}
@@ -242,18 +242,18 @@ public function testErrorMessages() {
    $this->getSession()->switchToIFrame('ckeditor');
    $this->assertNotEmpty($assert_session->waitForElement('css', 'drupal-media figure.caption-drupal-media .this-error-message-is-themeable'));

    // Test when using the classy theme, an additional class is added in
    // classy/templates/content/media-embed-error.html.twig.
    $this->assertTrue($this->container->get('theme_installer')->install(['classy']));
    // Test when using the starterkit_theme theme, an additional class is added
    // to the error, which is supported by
    // stable9/templates/content/media-embed-error.html.twig.
    $this->assertTrue($this->container->get('theme_installer')->install(['starterkit_theme']));
    $this->config('system.theme')
      ->set('default', 'classy')
      ->set('default', 'starterkit_theme')
      ->save();
    $this->drupalGet($this->host->toUrl('edit-form'));
    $this->waitForEditor();
    $this->assignNameToCkeditorIframe();
    $this->getSession()->switchToIFrame('ckeditor');
    $this->assertNotEmpty($assert_session->waitForElement('css', 'drupal-media figure.caption-drupal-media .this-error-message-is-themeable.media-embed-error--missing-source'));
    $assert_session->responseContains('classy/css/components/media-embed-error.css');
    $this->assertNotEmpty($assert_session->waitForElement('css', 'drupal-media figure.caption-drupal-media .this-error-message-is-themeable'));

    // Test that restoring a valid UUID results in the media embed preview
    // displaying.
@@ -282,8 +282,8 @@ public function testPreviewUsesDefaultThemeAndIsClientCacheable() {

    // Configure a different default and admin theme, like on most Drupal sites.
    $this->config('system.theme')
      ->set('default', 'stable')
      ->set('admin', 'classy')
      ->set('default', 'stable9')
      ->set('admin', 'starterkit_theme')
      ->save();

    // Assert that when looking at an embedded entity in the CKEditor Widget,
@@ -296,7 +296,7 @@ public function testPreviewUsesDefaultThemeAndIsClientCacheable() {
    $assert_session = $this->assertSession();
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', 'img[src*="image-test.png"]'));
    $element = $assert_session->elementExists('css', '[data-media-embed-test-active-theme]');
    $this->assertSame('stable', $element->getAttribute('data-media-embed-test-active-theme'));
    $this->assertSame('stable9', $element->getAttribute('data-media-embed-test-active-theme'));
    // Assert that the first preview request transferred >500 B over the wire.
    // Then toggle source mode on and off. This causes the CKEditor widget to be
    // destroyed and then reconstructed. Assert that during this reconstruction,
@@ -1069,7 +1069,7 @@ public function testEmbedPreviewAccess($media_embed_enabled, $can_use_format) {
      $this->assignNameToCkeditorIframe();
      $this->getSession()->switchToIFrame('ckeditor');
      if ($media_embed_enabled) {
        // The preview rendering, which in this test will use Classy's
        // The preview rendering, which in this test will use Starterkit's
        // media.html.twig template, will fail without the CSRF token/header.
        // @see ::testEmbeddedMediaPreviewWithCsrfToken()
        $this->assertNotEmpty($assert_session->waitForElementVisible('css', 'article.media'));
+9 −10
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class MediaLibraryTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'starterkit_theme';

  /**
   * The user to use during testing.
@@ -246,21 +246,20 @@ public function testAllowedMediaTypes() {
      $this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-modal #media-library-wrapper'));

      if (empty($allowed_media_types) || count($allowed_media_types) === 2) {
        $assert_session->elementExists('css', 'li.media-library-menu-image');
        $assert_session->elementExists('css', 'li.media-library-menu-arrakis');
        $assert_session->elementTextContains('css', '.media-library-item__name', 'Fear is the mind-killer');
        $menu = $assert_session->elementExists('css', '.js-media-library-menu');
        $assert_session->elementExists('named', ['link', 'Image'], $menu);
        $assert_session->elementExists('named', ['link', 'Arrakis'], $menu);
        $assert_session->elementTextContains('css', '.js-media-library-item', 'Fear is the mind-killer');
      }
      elseif (count($allowed_media_types) === 1 && !empty($allowed_media_types['image'])) {
        // No tabs should appear if there's only one media type available.
        $assert_session->elementNotExists('css', 'li.media-library-menu-image');
        $assert_session->elementNotExists('css', 'li.media-library-menu-arrakis');
        $assert_session->elementTextContains('css', '.media-library-item__name', 'Fear is the mind-killer');
        $assert_session->elementNotExists('css', '.js-media-library-menu');
        $assert_session->elementTextContains('css', '.js-media-library-item', 'Fear is the mind-killer');
      }
      elseif (count($allowed_media_types) === 1 && !empty($allowed_media_types['arrakis'])) {
        // No tabs should appear if there's only one media type available.
        $assert_session->elementNotExists('css', 'li.media-library-menu-image');
        $assert_session->elementNotExists('css', 'li.media-library-menu-arrakis');
        $assert_session->elementTextContains('css', '.media-library-item__name', 'Le baron Vladimir Harkonnen');
        $assert_session->elementNotExists('css', '.js-media-library-menu');
        $assert_session->elementTextContains('css', '.js-media-library-item', 'Le baron Vladimir Harkonnen');
      }
    }
  }
+11 −13
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ class MediaTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'starterkit_theme';

  /**
   * {@inheritdoc}
@@ -438,18 +438,16 @@ public function testErrorMessages() {
    $this->waitForEditor();
    $this->assertNotEmpty($assert_session->waitForElement('css', '.ck-widget.drupal-media .this-error-message-is-themeable'));

    // Test when using the classy theme, an additional class is added in
    // classy/templates/content/media-embed-error.html.twig.
    $this->assertTrue($this->container->get('theme_installer')->install(['classy']));
    // Test when using the starterkit_theme theme, an additional class is added
    // to the error, which is supported by
    // stable9/templates/content/media-embed-error.html.twig.
    $this->assertTrue($this->container->get('theme_installer')->install(['starterkit_theme']));
    $this->config('system.theme')
      ->set('default', 'classy')
      ->set('default', 'starterkit_theme')
      ->save();
    $this->drupalGet($this->host->toUrl('edit-form'));
    $this->waitForEditor();
    $this->assertNotEmpty($assert_session->waitForElement('css', '.ck-widget.drupal-media .this-error-message-is-themeable.media-embed-error--missing-source'));
    // @todo Uncomment this in https://www.drupal.org/project/ckeditor5/issues/3194084.
    // @codingStandardsIgnoreLine
    //$assert_session->responseContains('classy/css/components/media-embed-error.css');
    $this->assertNotEmpty($assert_session->waitForElement('css', '.ck-widget.drupal-media .this-error-message-is-themeable'));

    // Test that restoring a valid UUID results in the media embed preview
    // displaying.
@@ -476,8 +474,8 @@ public function testPreviewUsesDefaultThemeAndIsClientCacheable() {

    // Configure a different default and admin theme, like on most Drupal sites.
    $this->config('system.theme')
      ->set('default', 'stable')
      ->set('admin', 'classy')
      ->set('default', 'stable9')
      ->set('admin', 'starterkit_theme')
      ->save();

    // Assert that when looking at an embedded entity in the CKEditor Widget,
@@ -488,7 +486,7 @@ public function testPreviewUsesDefaultThemeAndIsClientCacheable() {
    $assert_session = $this->assertSession();
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', 'img[src*="image-test.png"]'));
    $element = $assert_session->elementExists('css', '[data-media-embed-test-active-theme]');
    $this->assertSame('stable', $element->getAttribute('data-media-embed-test-active-theme'));
    $this->assertSame('stable9', $element->getAttribute('data-media-embed-test-active-theme'));
    // Assert that the first preview request transferred >500 B over the wire.
    // Then toggle source mode on and off. This causes the CKEditor widget to be
    // destroyed and then reconstructed. Assert that during this reconstruction,
@@ -1092,7 +1090,7 @@ public function testEmbedPreviewAccess($media_embed_enabled, $can_use_format) {
    if ($can_use_format) {
      $this->waitForEditor();
      if ($media_embed_enabled) {
        // The preview rendering, which in this test will use Classy's
        // The preview rendering, which in this test will use Starterkit theme's
        // media.html.twig template, will fail without the CSRF token/header.
        // @see ::testEmbeddedMediaPreviewWithCsrfToken()
        $this->assertNotEmpty($assert_session->waitForElementVisible('css', 'article.media'));
Loading