Verified Commit 91cd1ab5 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3464340 by herved, ahsannazir, smustgrave, longwave, nod_: JS errors...

Issue #3464340 by herved, ahsannazir, smustgrave, longwave, nod_: JS errors from Drupal.behaviors.activeLinks (... is not a valid selector)
parent b155910d
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -23,11 +23,11 @@
      // Start by finding all potentially active links.
      const path = drupalSettings.path;
      const queryString = JSON.stringify(path.currentQuery);
      const querySelector = path.currentQuery
        ? `[data-drupal-link-query='${queryString}']`
      const querySelector = queryString
        ? `[data-drupal-link-query="${CSS.escape(queryString)}"]`
        : ':not([data-drupal-link-query])';
      const originalSelectors = [
        `[data-drupal-link-system-path="${path.currentPath}"]`,
        `[data-drupal-link-system-path="${CSS.escape(path.currentPath)}"]`,
      ];
      let selectors;

+33 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\Tests\system\FunctionalJavascript;

use Drupal\FunctionalJavascriptTests\WebDriverTestBase;

/**
 * Tests active link JS behavior.
 *
 * @see Drupal.behaviors.activeLinks
 *
 * @group system
 */
class ActiveLinkTest extends WebDriverTestBase {

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Ensures no JS error is thrown with query strings containing special chars.
   */
  public function testQueryStringQuotes(): void {
    $user = $this->createUser();
    $this->drupalLogin($user);
    $this->drupalGet($this->getSession()->getCurrentUrl(), ['query' => ['foo' => "\"'[](){}*+~>|\\/:;,.!@#$%^&-_=?<>"]]);
    $this->failOnJavaScriptErrors();
  }

}