From 753eef8a21b8b6039d927fa865e9809bfadbc4ab Mon Sep 17 00:00:00 2001 From: Lauri Eskola <lauri.eskola@acquia.com> Date: Fri, 17 Mar 2023 10:03:47 +0200 Subject: [PATCH] Issue #2978498 by Cottser, Kingdutch: Using the module filter on the module list page a module can only be found by system name if the description ends in a dot --- core/modules/system/js/system.modules.js | 5 +++-- .../tests/src/FunctionalJavascript/ModuleFilterTest.php | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/modules/system/js/system.modules.js b/core/modules/system/js/system.modules.js index 2c993da0f01d..44bdf336b371 100644 --- a/core/modules/system/js/system.modules.js +++ b/core/modules/system/js/system.modules.js @@ -44,9 +44,10 @@ '.table-filter-text-source, .module-name, .module-description', ); let sourcesConcat = ''; - // Concatenate the textContent of the elements in the row. + // Concatenate the textContent of the elements in the row, with a + // space in between. sources.forEach((item) => { - sourcesConcat += item.textContent; + sourcesConcat += ` ${item.textContent}`; }); const textMatch = sourcesConcat.search(re) !== -1; $(row).closest('tr').toggle(textMatch); diff --git a/core/modules/system/tests/src/FunctionalJavascript/ModuleFilterTest.php b/core/modules/system/tests/src/FunctionalJavascript/ModuleFilterTest.php index 1dd3e48fdb87..e9ce2901c07e 100644 --- a/core/modules/system/tests/src/FunctionalJavascript/ModuleFilterTest.php +++ b/core/modules/system/tests/src/FunctionalJavascript/ModuleFilterTest.php @@ -68,6 +68,14 @@ public function testModuleFilter() { $expected_message = '1 module is available in the modified list.'; $assertSession->elementTextContains('css', '#drupal-live-announce', $expected_message); + // Test filtering by a machine name, when the module description doesn't end + // with a period or other separator. This condition is common for test + // modules. + $filter->setValue('comment_base_field_test'); + $session->wait(1000, 'jQuery("#module-node:visible").length == 0'); + $visible_rows = $this->filterVisibleElements($module_rows); + self::assertEquals(1, count($visible_rows)); + // Test Drupal.announce() message when no matches are expected. $filter->setValue('Pan-Galactic Gargle Blaster'); $session->wait(1000, 'jQuery("#module-node:visible").length == 0'); -- GitLab