Issue #3416304 by sleitner, RoloDMonkey, smustgrave: Javascript warning from content language and translation page

(cherry picked from commit 6923b1a629)
merge-requests/6880/head
nod_ 2024-02-29 21:08:40 +01:00
parent 8ae9ab1e8c
commit 5cf244cb80
No known key found for this signature in database
GPG Key ID: 76624892606FA197
2 changed files with 51 additions and 1 deletions

View File

@ -61,7 +61,10 @@
$element = $fields.filter(filterFieldsList);
}
if ($element[0].matches(`input[value="${column}"]:checked`)) {
if (
$element.length &&
$element[0].matches(`input[value="${column}"]:checked`)
) {
$fields.prop('checked', true).not($element).prop('disabled', true);
} else {
$fields.prop('disabled', false);

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Drupal\Tests\content_translation\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests that the content translation configuration javascript does't fail.
*
* @group content_translation
*/
class ContentTranslationConfigUITest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['content_translation', 'node'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Use the minimal profile.
*
* @var string
*/
protected $profile = 'standard';
/**
* Tests that the content translation configuration javascript does't fail.
*/
public function testContentTranslationConfigUI() {
$content_translation_manager = $this->container->get('content_translation.manager');
$content_translation_manager->setEnabled('node', 'article', TRUE);
$this->rebuildContainer();
$admin = $this->drupalCreateUser([], NULL, TRUE);
$this->drupalLogin($admin);
$this->drupalGet('/admin/config/regional/content-language');
$this->failOnJavaScriptErrors();
}
}