Loading core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\Tests\text\FunctionalJavascript; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** Loading Loading @@ -72,6 +73,13 @@ public function testTextSummaryBehavior() { $this->assertSummaryToggle(); // Repeat test with unlimited cardinality field. $body_field_storage = FieldStorageConfig::loadByName('node', 'body'); $body_field_storage->setCardinality(-1); $body_field_storage->save(); $this->assertSummaryToggle(); // Test summary is shown when non-empty. $node = $this->createNode([ 'body' => [ Loading core/modules/text/text.es6.js +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,17 @@ $fullLabel = $('<label></label>').prependTo($full); } // To ensure the summary toggle is shown in case the label is hidden // (in multivalue fields in particular), show the label but hide // the original text of the label. if ($fullLabel.hasClass('visually-hidden')) { $fullLabel.html( (index, oldHtml) => `<span class="visually-hidden">${oldHtml}</span>`, ); $fullLabel.removeClass('visually-hidden'); } // Set up the edit/hide summary link. const $link = $( `<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">${Drupal.t( Loading core/modules/text/text.js +7 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,13 @@ $fullLabel = $('<label></label>').prependTo($full); } if ($fullLabel.hasClass('visually-hidden')) { $fullLabel.html(function (index, oldHtml) { return "<span class=\"visually-hidden\">".concat(oldHtml, "</span>"); }); $fullLabel.removeClass('visually-hidden'); } var $link = $("<span class=\"field-edit-link\"> (<button type=\"button\" class=\"link link-edit-summary\">".concat(Drupal.t('Hide summary'), "</button>)</span>")); var $button = $link.find('button'); var toggleClick = true; Loading Loading
core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\Tests\text\FunctionalJavascript; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; /** Loading Loading @@ -72,6 +73,13 @@ public function testTextSummaryBehavior() { $this->assertSummaryToggle(); // Repeat test with unlimited cardinality field. $body_field_storage = FieldStorageConfig::loadByName('node', 'body'); $body_field_storage->setCardinality(-1); $body_field_storage->save(); $this->assertSummaryToggle(); // Test summary is shown when non-empty. $node = $this->createNode([ 'body' => [ Loading
core/modules/text/text.es6.js +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,17 @@ $fullLabel = $('<label></label>').prependTo($full); } // To ensure the summary toggle is shown in case the label is hidden // (in multivalue fields in particular), show the label but hide // the original text of the label. if ($fullLabel.hasClass('visually-hidden')) { $fullLabel.html( (index, oldHtml) => `<span class="visually-hidden">${oldHtml}</span>`, ); $fullLabel.removeClass('visually-hidden'); } // Set up the edit/hide summary link. const $link = $( `<span class="field-edit-link"> (<button type="button" class="link link-edit-summary">${Drupal.t( Loading
core/modules/text/text.js +7 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,13 @@ $fullLabel = $('<label></label>').prependTo($full); } if ($fullLabel.hasClass('visually-hidden')) { $fullLabel.html(function (index, oldHtml) { return "<span class=\"visually-hidden\">".concat(oldHtml, "</span>"); }); $fullLabel.removeClass('visually-hidden'); } var $link = $("<span class=\"field-edit-link\"> (<button type=\"button\" class=\"link link-edit-summary\">".concat(Drupal.t('Hide summary'), "</button>)</span>")); var $button = $link.find('button'); var toggleClick = true; Loading