Commit 0ec67661 authored by catch's avatar catch
Browse files

Issue #3281439 by nod_, Spokje, deviantintegral, _shY, andregp, lauriii:...

Issue #3281439 by nod_, Spokje, deviantintegral, _shY, andregp, lauriii: Update Help Topics tests to not use Bartik and Seven
parent 265b3c94
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
langcode: en
status: true
dependencies:
  module:
    - search
    - system
  theme:
    - claro
  enforced:
    config:
      - search.page.help_search
id: claro_help_search
theme: claro
region: help
weight: -4
provider: null
plugin: search_form_block
settings:
  id: search_form_block
  label: 'Search help'
  label_display: visible
  provider: search
  page_id: help_search
visibility:
  request_path:
    id: request_path
    negate: false
    context_mapping: {  }
    pages: /admin/help
+4 −5
Original line number Diff line number Diff line
@@ -57,14 +57,13 @@ class HelpTopicTest extends BrowserTestBase {
  protected function setUp(): void {
    parent::setUp();

    // These tests rely on some markup from the 'Seven' theme and we test theme
    // These tests rely on some markup from the 'stark' theme and we test theme
    // provided help topics.
    \Drupal::service('theme_installer')->install(['seven', 'help_topics_test_theme']);
    \Drupal::service('config.factory')->getEditable('system.theme')->set('admin', 'seven')->save();
    \Drupal::service('theme_installer')->install(['help_topics_test_theme']);

    // Place various blocks.
    $settings = [
      'theme' => 'seven',
      'theme' => 'stark',
      'region' => 'help',
    ];
    $this->placeBlock('help_block', $settings);
@@ -173,7 +172,7 @@ protected function verifyHelp($response = 200) {
        // Verify page information.
        $name = $info['name'];
        $session->titleEquals($name . ' | Drupal');
        $session->responseContains('<h1 class="page-title">' . $name . '</h1>');
        $session->responseContains('<h1>' . $name . '</h1>');
        foreach ($info['tags'] as $tag) {
          $session->responseHeaderContains('X-Drupal-Cache-Tags', $tag);
        }
+5 −4
Original line number Diff line number Diff line
@@ -30,15 +30,16 @@ abstract class HelpTopicTranslatedTestBase extends BrowserTestBase {
  protected function setUp(): void {
    parent::setUp();

    // These tests rely on some markup from the 'Seven' theme.
    \Drupal::service('theme_installer')->install(['seven']);
    // These tests rely on some markup from the 'Claro' theme, as well as an
    // optional block added when Claro is enabled.
    \Drupal::service('theme_installer')->install(['claro']);
    \Drupal::configFactory()->getEditable('system.theme')
      ->set('admin', 'seven')
      ->set('admin', 'claro')
      ->save(TRUE);

    // Place various blocks.
    $settings = [
      'theme' => 'seven',
      'theme' => 'claro',
      'region' => 'help',
    ];
    $this->placeBlock('help_block', $settings);
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public function testHelpTopics() {
    // test can continue.
    $this->assertArrayHasKey('system', $directories, 'System module is being scanned');
    $this->assertArrayHasKey('help', $directories, 'Help module is being scanned');
    $this->assertArrayHasKey('seven', $directories, 'Seven theme is being scanned');
    $this->assertArrayHasKey('claro', $directories, 'Claro theme is being scanned');
    $this->assertArrayHasKey('standard', $directories, 'Standard profile is being scanned');

    $definitions = (new HelpTopicDiscovery($directories))->getDefinitions();
+5 −2
Original line number Diff line number Diff line
@@ -1133,9 +1133,12 @@ protected function buildStatusMessageSelector(string $message = NULL, string $ty
        $aria_label = 'Warning message';
    }

    if ($message && $aria_label) {
      $selector = $this->buildXPathQuery($selector . '//div[contains(@aria-label, :aria_label) and contains(., :message)]', [
    if ($message && $aria_label && $type) {
      $selector = $this->buildXPathQuery($selector . '//div[(contains(@aria-label, :aria_label) or contains(@aria-labelledby, :type)) and contains(., :message)]', [
        // Value of the 'aria-label' attribute, used in Seven and Bartik
        ':aria_label' => $aria_label,
        // Value of the 'aria-labelledby' attribute, used in Claro and Olivero.
        ':type' => $type,
        ':message' => $message,
      ]);
    }