diff --git a/core/modules/help_topics/help_topics.module b/core/modules/help_topics/help_topics.module
index 0b0916bf41..2999b3e2e3 100644
--- a/core/modules/help_topics/help_topics.module
+++ b/core/modules/help_topics/help_topics.module
@@ -22,7 +22,7 @@ function help_topics_help($route_name, RouteMatchInterface $route_match) {
$output .= '
' . t('Viewing help topics') . '';
$output .= '' . t('The top-level help topics are listed on the main Help page. Links to other topics, including non-top-level help topics, can be found under the "Related" heading when viewing a topic page.', [':help_page' => Url::fromRoute('help.main')->toString()]) . '';
$output .= '' . t('Providing help topics') . '';
- $output .= '' . t("Modules and themes can provide help topics as YAML-file-based plugins in a project sub-directory called help_topics. Any file in a module or theme's help_topics directory with the suffix *.help_topic.yml will be discovered by the Help Topic module. Plugin-based help topics provided by modules and themes will automatically be updated when a module or theme is updated. It is advisable not to edit the YAML files of module- or theme-provided topics, to make updates easier. Use the plugins in core/modules/help_topics/help_topics as a guide when writing and formatting a help topic plugin for your theme or module.") . '';
+ $output .= '' . t("Modules and themes can provide help topics as YAML-file-based plugins in a project sub-directory called help_topics. Any file in a module or theme's help_topics directory with the suffix *.help_topic.yml will be discovered by the Help Topic module. Plugin-based help topics provided by modules and themes will automatically be updated when a module or theme is updated. Use the plugins in core/modules/help_topics/help_topics as a guide when writing and formatting a help topic plugin for your theme or module.") . '';
$output .= '';
return ['#markup' => $output];
diff --git a/core/modules/help_topics/help_topics.permissions.yml b/core/modules/help_topics/help_topics.permissions.yml
index b50976d1fb..e7ce493278 100644
--- a/core/modules/help_topics/help_topics.permissions.yml
+++ b/core/modules/help_topics/help_topics.permissions.yml
@@ -1,2 +1,2 @@
view help topics:
- title: 'View configured help topics'
+ title: 'View help topics'
diff --git a/core/modules/help_topics/src/Controller/HelpTopicPluginController.php b/core/modules/help_topics/src/Controller/HelpTopicPluginController.php
index 8add59ebce..c4285a2f25 100644
--- a/core/modules/help_topics/src/Controller/HelpTopicPluginController.php
+++ b/core/modules/help_topics/src/Controller/HelpTopicPluginController.php
@@ -67,8 +67,8 @@ public static function create(ContainerInterface $container) {
* Displays a help topic page.
*
* @param string $id
- * The plugin id. Maps to the {id} placeholder
- * in the help_topics.help_topic route.
+ * The plugin ID. Maps to the {id} placeholder in the
+ * help_topics.help_topic route.
*
* @return array
* A render array with the contents of a help topic page.
diff --git a/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php b/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php
index 8dfabf577e..9a63a05f01 100644
--- a/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php
+++ b/core/modules/help_topics/src/Plugin/HelpSection/HelpTopicSection.php
@@ -13,7 +13,7 @@
* @HelpSection(
* id = "help_topics",
* title = @Translation("Topics"),
- * description = @Translation("Topics can be provided by modules or themes. Top-level help topics configured on your site:"),
+ * description = @Translation("Topics can be provided by modules or themes. Top-level help topics on your site:"),
* permission = "view help topics"
* )
*/
diff --git a/core/modules/help_topics/tests/src/Kernel/HelpTopicKernelTest.php b/core/modules/help_topics/tests/src/Kernel/HelpTopicKernelTest.php
new file mode 100644
index 0000000000..3fd40653ce
--- /dev/null
+++ b/core/modules/help_topics/tests/src/Kernel/HelpTopicKernelTest.php
@@ -0,0 +1,81 @@
+installConfig(['help_topics']);
+ }
+
+ /**
+ * Tests the help topic body get and set functions.
+ */
+ public function testTopicBodyGetSet() {
+ // Create a body value with lots of different HTML tags, some entities, and
+ // some whitespace of various types between tags, and some text between
+ // tags.
+ $body1 = '' .
+ 'A paragraph with attributes
';
+ $body2 = 'A heading with an & entity in it
' .
+ ' some between-tag text with whitespace and containing a tag as entity <p> ' .
+ 'A sub-heading
' .
+ '' .
+ '- Number 1
- Number 2
' .
+ '| Col 1 | Col 2 |
' .
+ '| Data 1 | Data 2 |
' .
+ '- Item 1 with spaces
- Definition 1
- Item 2 >
- Definition 2
';
+ $body = $body1 . "\t\n\r\v
" . $body2;
+ $body_expected = $body1 . $body2;
+
+ // Make sure after chunk/join, the body is unchanged except expected
+ // whitespace deletions.
+ $body_chunked = HtmlChunker::chunkHtml($body);
+ $body_out = HtmlChunker::joinChunks($body_chunked);
+ $this->assertEqual($body_expected, $body_out);
+
+ // Make sure that if we strip out tags, all remaining text is in the 'text'
+ // parts of the chunked body array.
+ $body_plain = strip_tags($body_expected);
+ $body_chunked = HtmlChunker::chunkHtml($body);
+ $chunked_text = '';
+ foreach ($body_chunked as $item) {
+ $prefix = strip_tags($item['prefix_tags']);
+ $suffix = strip_tags($item['suffix_tags']);
+ // Prefix and suffix should only consist of tags.
+ $this->assertTrue(empty($prefix));
+ $this->assertTrue(empty($suffix));
+ // We shouldn't have any text items that are pure whitespace.
+ $this->assertFalse(empty(trim($item['text'])));
+ $chunked_text .= $item['text'];
+ }
+ $this->assertEqual($body_plain, $chunked_text);
+ }
+
+}