diff --git a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
new file mode 100644
index 0000000000..699b1a3737
--- /dev/null
+++ b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php
@@ -0,0 +1,86 @@
+<?php
+
+namespace Drupal\Tests\text\FunctionalJavascript;
+
+use Drupal\field\Entity\FieldConfig;
+use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+
+/**
+ * Tests the JavaScript functionality of the text_textarea_with_summary widget.
+ *
+ * @group text
+ */
+class TextareaWithSummaryTest extends JavascriptTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['text', 'node'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->drupalCreateContentType(['type' => 'page']);
+
+    $account = $this->drupalCreateUser(['create page content', 'edit own page content']);
+    $this->drupalLogin($account);
+  }
+
+  /**
+   * Helper to test toggling the summary area.
+   */
+  protected function assertSummaryToggle() {
+    $this->drupalGet('node/add/page');
+    $widget = $this->getSession()->getPage()->findById('edit-body-wrapper');
+    $summary_field = $widget->findField('edit-body-0-summary');
+
+    $this->assertEquals(FALSE, $summary_field->isVisible(), 'Summary field is hidden by default.');
+    $this->assertEquals(FALSE, $widget->hasButton('Hide summary'), 'No Hide summary link by default.');
+
+    $widget->pressButton('Edit summary');
+    $this->assertEquals(FALSE, $widget->hasButton('Edit summary'), 'Edit summary link is removed after clicking.');
+    $this->assertEquals(TRUE, $summary_field->isVisible(), 'Summary field is shown.');
+
+    $widget->pressButton('Hide summary');
+    $this->assertEquals(FALSE, $widget->hasButton('Hide summary'), 'Hide summary link is removed after clicking.');
+    $this->assertEquals(FALSE, $summary_field->isVisible(), 'Summary field is hidden again.');
+    $this->assertEquals(TRUE, $widget->hasButton('Edit summary'), 'Edit summary link is visible again.');
+  }
+
+  /**
+   * Tests the textSummary javascript behavior.
+   */
+  public function testTextSummaryBehavior() {
+    // Test with field defaults.
+    $this->assertSummaryToggle();
+
+    // Repeat test with non-empty field description.
+    // @see https://www.drupal.org/node/2626716
+    $body_field = FieldConfig::loadByName('node', 'page', 'body');
+    $body_field->set('description', 'Text with Summary field description.');
+    $body_field->save();
+
+    $this->assertSummaryToggle();
+
+    // Test summary is shown when non-empty.
+    $node = $this->createNode([
+      'body' => [
+        [
+          'value' => $this->randomMachineName(32),
+          'summary' => $this->randomMachineName(32),
+          'format' => filter_default_format(),
+        ],
+      ],
+    ]);
+
+    $this->drupalGet('node/' . $node->id() . '/edit');
+    $page = $this->getSession()->getPage();
+    $summary_field = $page->findField('edit-body-0-summary');
+
+    $this->assertEquals(TRUE, $summary_field->isVisible(), 'Non-empty summary field is shown by default.');
+  }
+
+}
diff --git a/core/modules/text/text.es6.js b/core/modules/text/text.es6.js
index 6c11adae1b..862d4c3ec5 100644
--- a/core/modules/text/text.es6.js
+++ b/core/modules/text/text.es6.js
@@ -19,7 +19,7 @@
 
         const $summary = $widget.find('.js-text-summary-wrapper');
         const $summaryLabel = $summary.find('label').eq(0);
-        const $full = $widget.find('.js-text-full').closest('.js-form-item');
+        const $full = $widget.children('.js-form-type-textarea');
         let $fullLabel = $full.find('label').eq(0);
 
         // Create a placeholder label when the field cardinality is greater
diff --git a/core/modules/text/text.js b/core/modules/text/text.js
index c760f2dd2c..25a31e4221 100644
--- a/core/modules/text/text.js
+++ b/core/modules/text/text.js
@@ -13,7 +13,7 @@
 
         var $summary = $widget.find('.js-text-summary-wrapper');
         var $summaryLabel = $summary.find('label').eq(0);
-        var $full = $widget.find('.js-text-full').closest('.js-form-item');
+        var $full = $widget.children('.js-form-type-textarea');
         var $fullLabel = $full.find('label').eq(0);
 
         if ($fullLabel.length === 0) {
