diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 24c9d7e..ce01288 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1045,23 +1045,6 @@ function template_preprocess_item_list(&$variables) { } /** - * Returns HTML for an indentation div; used for drag and drop tables. - * - * @param $variables - * An associative array containing: - * - size: Optional. The number of indentations to create. - * - * @ingroup themeable - */ -function theme_indentation($variables) { - $output = ''; - for ($n = 0; $n < $variables['size']; $n++) { - $output .= '
 
'; - } - return $output; -} - -/** * Prepares variables for container templates. * * Default template: container.html.twig. @@ -1712,10 +1695,6 @@ function drupal_common_theme() { 'progress_bar' => array( 'variables' => array('label' => NULL, 'percent' => NULL, 'message' => NULL), ), - 'indentation' => array( - 'variables' => array('size' => 1), - 'function' => 'theme_indentation', - ), // From theme.maintenance.inc. 'maintenance_page' => array( 'render element' => 'page', diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js index 8754b98..4f094b2 100644 --- a/core/misc/tabledrag.js +++ b/core/misc/tabledrag.js @@ -195,22 +195,47 @@ * * @type {number} */ - this.indentCount = 1; + this.indentDepth = 1; // Find the width of indentations to measure mouse movements against. // Because the table doesn't need to start with any indentations, we // manually append 2 indentations in the first draggable row, measure // the offset, then remove. - var indent = Drupal.theme('tableDragIndentation'); - var testRow = $('').addClass('draggable').appendTo(table); - var testCell = $('').appendTo(testRow).prepend(indent).prepend(indent); - var $indentation = testCell.find('.js-indentation'); + var testRow1 = $('').addClass('draggable').attr('data-indent', 1).appendTo(table); + var testCell1 = $('').appendTo(testRow1); + var testRow2 = $('').addClass('draggable').attr('data-indent', 2).appendTo(table); + var testCell2 = $('').appendTo(testRow2); /** + * The width of an indent in pixels * * @type {number} */ - this.indentAmount = $indentation.get(1).offsetLeft - $indentation.get(0).offsetLeft; - testRow.remove(); + if (this.rtl == 1) { + this.indentAmount = Math.abs(parseInt(testCell2.css('padding-left')) - parseInt(testCell1.css('padding-left'))); + } + else { + this.indentAmount = -Math.abs(parseInt(testCell2.css('padding-right')) - parseInt(testCell1.css('padding-right'))); + } + + /** + * The tree background image y position and x increment and origin. + * + * @type {object} + * + * @prop {string} y + * @prop {number} dx + * @prop {number} ox + * @prop {bool} rtl + */ + this.indentPixels = { + y: 'center', + dx: this.indentAmount * this.rtl, + ox: -8, + rtl: (this.rtl == 1) ? 0 : true + }; + + testRow2.remove(); + testRow1.remove(); } // Make each applicable row draggable. @@ -449,16 +474,8 @@ $item.find('td:first-of-type').find('a').addClass('menu-item__link'); // Create the handle. var handle = $('
 
').attr('title', Drupal.t('Drag to re-order')); - // Insert the handle after indentations (if any). - var $indentationLast = $item.find('td:first-of-type').find('.js-indentation').eq(-1); - if ($indentationLast.length) { - $indentationLast.after(handle); - // Update the total width of indentation in this entire table. - self.indentCount = Math.max($item.find('.js-indentation').length, self.indentCount); - } - else { - $item.find('td').eq(0).prepend(handle); - } + // Insert the menu tree display div and handle. + $item.find('td').eq(0).prepend(handle); if (Modernizr.touch) { handle.on('touchstart', function (event) { @@ -496,7 +513,7 @@ handle.on('keydown', function (event) { // If a rowObject doesn't yet exist and this isn't the tab key. if (event.keyCode !== 9 && !self.rowObject) { - self.rowObject = new self.row(item, 'keyboard', self.indentEnabled, self.maxDepth, true); + self.rowObject = new self.row(item, 'keyboard', self.indentEnabled, self.maxDepth, true, self.indentPixels); } var keyChange = false; @@ -529,7 +546,7 @@ if ($(item).is('.tabledrag-root')) { // Swap with the previous top-level row. groupHeight = 0; - while (previousRow && $previousRow.find('.js-indentation').length) { + while (previousRow && $previousRow.data('indent')) { $previousRow = $(previousRow).prev('tr:first-of-type'); previousRow = $previousRow.get(0); groupHeight += $previousRow.is(':hidden') ? 0 : previousRow.offsetHeight; @@ -580,7 +597,7 @@ if ($(item).is('.tabledrag-root')) { // Swap with the next group (necessarily a top-level one). groupHeight = 0; - var nextGroup = new self.row(nextRow, 'keyboard', self.indentEnabled, self.maxDepth, false); + var nextGroup = new self.row(nextRow, 'keyboard', self.indentEnabled, self.maxDepth, false, self.indentPixels); if (nextGroup) { $(nextGroup.group).each(function () { groupHeight += $(this).is(':hidden') ? 0 : this.offsetHeight; @@ -666,7 +683,7 @@ } // Create a new rowObject for manipulation of this row. - self.rowObject = new self.row(item, 'pointer', self.indentEnabled, self.maxDepth, true); + self.rowObject = new self.row(item, 'pointer', self.indentEnabled, self.maxDepth, true, self.indentPixels); // Save the position of the table. self.table.topY = $(self.table).offset().top; @@ -679,7 +696,7 @@ $('body').addClass('drag'); if (self.oldRowElement) { $(self.oldRowElement).removeClass('drag-previous'); - } + } }; /** @@ -735,8 +752,8 @@ // restricted according to the rows around this row. var indentChange = self.rowObject.indent(indentDiff); // Update table and pointer indentations. - self.dragObject.indentPointerPos.x += self.indentAmount * indentChange * self.rtl; - self.indentCount = Math.max(self.indentCount, self.rowObject.indents); + self.dragObject.indentPointerPos.x += self.indentAmount * indentChange; + self.indentDepth = Math.max(self.indentDepth, self.rowObject.indents); } return false; @@ -947,7 +964,7 @@ sourceRow = changedRow; if ($previousRow.is('.draggable') && $previousRow.find('.' + group).length) { if (this.indentEnabled) { - if ($previousRow.find('.js-indentations').length === $changedRow.find('.js-indentations').length) { + if ($previousRow.data('indent') === $changedRow.data('indent')) { sourceRow = previousRow; } } @@ -957,7 +974,7 @@ } else if ($nextRow.is('.draggable') && $nextRow.find('.' + group).length) { if (this.indentEnabled) { - if ($nextRow.find('.js-indentations').length === $changedRow.find('.js-indentations').length) { + if ($nextRow.data('indent') === $changedRow.data('indent')) { sourceRow = nextRow; } } @@ -971,7 +988,7 @@ else if (rowSettings.relationship === 'parent') { $previousRow = $changedRow.prev('tr'); previousRow = $previousRow; - while ($previousRow.length && $previousRow.find('.js-indentation').length >= this.rowObject.indents) { + while ($previousRow.length && $previousRow.data('indent') >= this.rowObject.indents) { $previousRow = $previousRow.prev('tr'); previousRow = $previousRow; } @@ -1015,7 +1032,7 @@ switch (rowSettings.action) { case 'depth': // Get the depth of the target row. - targetElement.value = $(sourceElement).closest('tr').find('.js-indentation').length; + targetElement.value = $(sourceElement).closest('tr').data('indent'); break; case 'match': @@ -1171,28 +1188,32 @@ * @param {bool} addClasses * Whether we want to add classes to this row to indicate child * relationships. + * @param {object} indentPixels + * The pixel indentation for the menu tree per indent level. */ - Drupal.tableDrag.prototype.row = function (tableRow, method, indentEnabled, maxDepth, addClasses) { + Drupal.tableDrag.prototype.row = function (tableRow, method, indentEnabled, maxDepth, addClasses, indentPixels) { var $tableRow = $(tableRow); this.element = tableRow; this.method = method; this.group = [tableRow]; - this.groupDepth = $tableRow.find('.js-indentation').length; + this.groupDepth = $tableRow.data('indent'); this.changed = false; this.table = $tableRow.closest('table')[0]; this.indentEnabled = indentEnabled; this.maxDepth = maxDepth; + this.indentPixels = indentPixels; // Direction the row is being moved. this.direction = ''; if (this.indentEnabled) { - this.indents = $tableRow.find('.js-indentation').length; + this.indents = $tableRow.data('indent'); this.children = this.findChildren(addClasses); this.group = $.merge(this.group, this.children); // Find the depth of this entire group. for (var n = 0; n < this.group.length; n++) { - this.groupDepth = Math.max($(this.group[n]).find('.js-indentation').length, this.groupDepth); + this.groupDepth = Math.max($(this.group[n]).data('indent'), this.groupDepth); } + this.treeIndent(this.indents); } }; @@ -1210,37 +1231,33 @@ var currentRow = $(this.element, this.table).next('tr.draggable'); var rows = []; var child = 0; + var menuDisplay = '
 
'; - function rowIndentation(indentNum, el) { - var self = $(el); - if (child === 1 && (indentNum === parentIndentation)) { - self.addClass('tree-child-first'); - } - if (indentNum === parentIndentation) { - self.addClass('tree-child'); - } - else if (indentNum > parentIndentation) { - self.addClass('tree-child-horizontal'); - } - } - while (currentRow.length) { - // A greater indentation indicates this is a child. - if (currentRow.find('.js-indentation').length > parentIndentation) { + // A greater indentation indicates this is a child. + if (currentRow.data('indent') > parentIndentation) { + while (currentRow.length) { child++; - rows.push(currentRow[0]); if (addClasses) { - currentRow.find('.js-indentation').each(rowIndentation); + if (child === 1) { + currentRow.find('td:first-of-type').addClass('tree-child-first').prepend($(menuDisplay)); + } + if (currentRow.data('indent') > parentIndentation) { + currentRow.find('td:first-of-type').addClass('tree-child').prepend($(menuDisplay)); + } + else { + break; + } + rows.push(currentRow[0]); } + currentRow = currentRow.next('tr.draggable'); } - else { - break; - } - currentRow = currentRow.next('tr.draggable'); } - if (addClasses && rows.length) { - $(rows[rows.length - 1]).find('.js-indentation:nth-child(' + (parentIndentation + 1) + ')').addClass('tree-child-last'); + + if (addClasses && child) { + $(rows[rows.length - 1]).find('td:first-of-type').addClass('tree-child-last'); } + return rows; }; @@ -1322,7 +1339,7 @@ // Minimum indentation: // Do not orphan the next row. - minIndent = nextRow ? $(nextRow).find('.js-indentation').length : 0; + minIndent = nextRow ? $(nextRow).data('indent') : 0; // Maximum indentation: if (!prevRow || $prevRow.is(':not(.draggable)') || $(this.element).is('.tabledrag-root')) { @@ -1334,7 +1351,7 @@ } else { // Do not go deeper than as a child of the previous row. - maxIndent = $prevRow.find('.js-indentation').length + ($prevRow.is('.tabledrag-leaf') ? 0 : 1); + maxIndent = $prevRow.data('indent') + ($prevRow.is('.tabledrag-leaf') ? 0 : 1); // Limit by the maximum allowed depth for the table. if (this.maxDepth) { maxIndent = Math.min(maxIndent, this.maxDepth - (this.groupDepth - this.indents)); @@ -1368,22 +1385,26 @@ indent = Math.max(indent, this.interval.min); indent = Math.min(indent, this.interval.max); indentDiff = indent - this.indents; + this.indents = indent; - for (var n = 1; n <= Math.abs(indentDiff); n++) { - // Add or remove indentations. - if (indentDiff < 0) { - $group.find('.js-indentation:first-of-type').remove(); - this.indents--; - } - else { - $group.find('td:first-of-type').prepend(Drupal.theme('tableDragIndentation')); - this.indents++; - } - } if (indentDiff) { // Update indentation for this row. this.changed = true; this.groupDepth += indentDiff; + + // Update the indentation for the child rows + var rowIndent; + $group.each(function(i, el) { + el = $(el); + rowIndent = el.data('indent'); + rowIndent += indentDiff; + el.data('indent', rowIndent); + // We need to reflect this in the DOM as well, so the CSS reflects the change. + el.attr('data-indent', rowIndent); + }); + + this.treeIndent(indent); + this.onIndent(); } @@ -1414,7 +1435,7 @@ // Either add immediately if this is a flat table, or check to ensure // that this row has the same level of indentation. if (this.indentEnabled) { - checkRowIndentation = checkRow.find('.js-indentation').length; + checkRowIndentation = checkRow.data('indent'); } if (!(this.indentEnabled) || (checkRowIndentation === rowIndentation)) { @@ -1446,11 +1467,11 @@ Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function () { for (var n in this.children) { if (this.children.hasOwnProperty(n)) { - $(this.children[n]).find('.js-indentation') + $(this.children[n]).find('td:first-of-type') .removeClass('tree-child') .removeClass('tree-child-first') .removeClass('tree-child-last') - .removeClass('tree-child-horizontal'); + .find('div.tree').remove(); } } }; @@ -1467,6 +1488,35 @@ }; /** + * Change background image indent on drag if it's changed. + */ + Drupal.tableDrag.prototype.row.prototype.treeIndent = function (indent) { + var indentPixels = this.indentPixels; + var indentDivs = $(this.table).find('.tree-child-first .tree,.tree-child .tree,.tree-child-last .tree'); + + indentDivs.each(function() { + var row = $(this).closest('tr'); + var rowIndent = row.data('indent'); + var backgroundX = indentPixels.ox + (rowIndent - indent) * indentPixels.dx; + + if (indentPixels.rtl) { + $(this).css({ + 'margin-right': '-' + backgroundX + 'px', + 'width': backgroundX + 'px', + 'height': row.height() + }); + } + else { + $(this).css({ + 'margin-left': '-' + backgroundX + 'px', + 'width': backgroundX + 'px', + 'height': row.height() + }); + } + }); + }; + + /** * Stub function. Allows a custom handler when a row is indented. * * @return {?bool} @@ -1498,13 +1548,6 @@ /** * @return {string} */ - tableDragIndentation: function () { - return '
 
'; - }, - - /** - * @return {string} - */ tableDragChangedWarning: function () { return ''; } diff --git a/core/misc/tree-bottom.png b/core/misc/tree-bottom.png deleted file mode 100644 index a558045..0000000 --- a/core/misc/tree-bottom.png +++ /dev/null @@ -1,3 +0,0 @@ -PNG - - IHDRPQ8#ɛ PLTEU6tRNS@f&IDAT8cX040`QQQASC1@(b1'6xIENDB` \ No newline at end of file diff --git a/core/misc/tree-child-last.svg b/core/misc/tree-child-last.svg new file mode 100644 index 0000000..2616087 --- /dev/null +++ b/core/misc/tree-child-last.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/core/misc/tree-child.svg b/core/misc/tree-child.svg new file mode 100644 index 0000000..32996a5 --- /dev/null +++ b/core/misc/tree-child.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/misc/tree.png b/core/misc/tree.png deleted file mode 100644 index 89ea235..0000000 --- a/core/misc/tree.png +++ /dev/null @@ -1,3 +0,0 @@ -PNG - - IHDRPQ8#ɛ PLTEU6tRNS@f'IDAT8OcX040`QQQAhTpTr 9 I"IENDB` \ No newline at end of file diff --git a/core/modules/book/src/Form/BookAdminEditForm.php b/core/modules/book/src/Form/BookAdminEditForm.php index 9df174d..447a4fe 100644 --- a/core/modules/book/src/Form/BookAdminEditForm.php +++ b/core/modules/book/src/Form/BookAdminEditForm.php @@ -217,15 +217,11 @@ protected function bookAdminTableTree(array $tree, array &$form) { $form[$id]['#attributes']['class'][] = 'draggable'; $form[$id]['#weight'] = $data['link']['weight']; - if (isset($data['link']['depth']) && $data['link']['depth'] > 2) { - $indentation = [ - '#theme' => 'indentation', - '#size' => $data['link']['depth'] - 2, - ]; + if (isset($data['link']['depth']) && $data['link']['depth'] >= 2) { + $form[$id]['#attributes']['data-indent'] = $data['link']['depth'] - 2; } $form[$id]['title'] = [ - '#prefix' => !empty($indentation) ? drupal_render($indentation) : '', '#type' => 'textfield', '#default_value' => $data['link']['title'], '#maxlength' => 255, diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index 3963702..846c1a7 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -724,16 +724,9 @@ public function tablePreRender($elements) { } $target['children'][$name] = array('name' => $name, 'weight' => $row['weight']['#value']); - // Add tabledrag indentation to the first row cell. - if ($depth = count($parents[$name])) { - $children = Element::children($row); - $cell = current($children); - $indentation = array( - '#theme' => 'indentation', - '#size' => $depth, - ); - $row[$cell]['#prefix'] = drupal_render($indentation) . (isset($row[$cell]['#prefix']) ? $row[$cell]['#prefix'] : ''); - } + // Add tabledrag indentation to the row. + $depth = count($parents[$name]); + $row['#attributes']['data-indent'] = $depth; // Add row id and associate JS settings. $id = Html::getClass($name); diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php index 9fc453c..2e93172 100644 --- a/core/modules/menu_ui/src/MenuForm.php +++ b/core/modules/menu_ui/src/MenuForm.php @@ -292,6 +292,7 @@ protected function buildOverviewForm(array &$form, FormStateInterface $form_stat // TableDrag: Mark the table row as draggable. $form['links'][$id]['#attributes'] = $element['#attributes']; $form['links'][$id]['#attributes']['class'][] = 'draggable'; + $form['links'][$id]['#attributes']['data-indent'] = $element['#item']->depth - 1; $form['links'][$id]['#item'] = $element['#item']; @@ -303,13 +304,7 @@ protected function buildOverviewForm(array &$form, FormStateInterface $form_stat $element['weight']['#attributes']['class'] = array('menu-weight'); $element['id']['#attributes']['class'] = array('menu-id'); - $form['links'][$id]['title'] = array( - array( - '#theme' => 'indentation', - '#size' => $element['#item']->depth - 1, - ), - $element['title'], - ); + $form['links'][$id]['title'] = $element['title']; $form['links'][$id]['enabled'] = $element['enabled']; $form['links'][$id]['enabled']['#wrapper_attributes']['class'] = array('checkbox', 'menu-enabled'); diff --git a/core/modules/system/css/components/tabledrag.module.css b/core/modules/system/css/components/tabledrag.module.css index 39d7fb1..42ed99a 100644 --- a/core/modules/system/css/components/tabledrag.module.css +++ b/core/modules/system/css/components/tabledrag.module.css @@ -71,15 +71,32 @@ a.tabledrag-handle:focus .handle { [dir="rtl"] .tabledrag-toggle-weight-wrapper { text-align: left; } -.indentation { - float: left; /* LTR */ - height: 1.7em; - margin: -0.4em 0.2em -0.4em -0.4em; /* LTR */ - padding: 0.42em 0 0.42em 0.6em; /* LTR */ - width: 20px; -} -[dir="rtl"] .indentation { - float: right; - margin: -0.4em -0.4em -0.4em 0.2em; - padding: 0.42em 0.6em 0.42em 0; +tr.draggable { + height: auto; } +div.tree { + display: inline-block; + float: left; + width: 0; + margin-left: 0px; +} +/* Default td padding is 12px. We are adding 20px per indent level. */ +tr[data-indent="1"] td:first-child { padding-left: 32px; } +tr[data-indent="2"] td:first-child { padding-left: 52px; } +tr[data-indent="3"] td:first-child { padding-left: 72px; } +tr[data-indent="4"] td:first-child { padding-left: 92px; } +tr[data-indent="5"] td:first-child { padding-left: 112px; } +tr[data-indent="6"] td:first-child { padding-left: 132px; } +tr[data-indent="7"] td:first-child { padding-left: 152px; } +tr[data-indent="8"] td:first-child { padding-left: 172px; } +tr[data-indent="9"] td:first-child { padding-left: 192px; } +[dir="rtl"] tr[data-indent] td:first-child { padding-left: 12px; } +[dir="rtl"] tr[data-indent="1"] td:first-child { padding-right: 32px; } +[dir="rtl"] tr[data-indent="2"] td:first-child { padding-right: 52px; } +[dir="rtl"] tr[data-indent="3"] td:first-child { padding-right: 72px; } +[dir="rtl"] tr[data-indent="4"] td:first-child { padding-right: 92px; } +[dir="rtl"] tr[data-indent="5"] td:first-child { padding-right: 112px; } +[dir="rtl"] tr[data-indent="6"] td:first-child { padding-right: 132px; } +[dir="rtl"] tr[data-indent="7"] td:first-child { padding-right: 152px; } +[dir="rtl"] tr[data-indent="8"] td:first-child { padding-right: 172px; } +[dir="rtl"] tr[data-indent="9"] td:first-child { padding-right: 192px; } diff --git a/core/modules/system/css/components/tree-child.module.css b/core/modules/system/css/components/tree-child.module.css index 71bb8c8..f5d12af 100644 --- a/core/modules/system/css/components/tree-child.module.css +++ b/core/modules/system/css/components/tree-child.module.css @@ -3,16 +3,18 @@ * Visual styles for a nested tree child. */ -div.tree-child { - background: url(../../../../misc/tree.png) no-repeat 11px center; /* LTR */ +tr[data-indent] td.tree-child div.tree { + padding: 0 0; + margin-top: -11px; + margin-bottom: -11px; + background: url(../../../../misc/tree-child.svg) no-repeat left center; /* LTR */ + background-size: 800px 400px; } -div.tree-child-last { - background: url(../../../../misc/tree-bottom.png) no-repeat 11px center; /* LTR */ +tr[data-indent] td.tree-child-last div.tree { + background-image: url(../../../../misc/tree-child-last.svg); } -[dir="rtl"] div.tree-child, -[dir="rtl"] div.tree-child-last { - background-position: -65px center; -} -div.tree-child-horizontal { - background: url(../../../../misc/tree.png) no-repeat -11px center; +[dir="rtl"] tr[data-indent] td.tree-child div.tree, +[dir="rtl"] tr[data-indent] td.tree-child-last div.tree { + background-position: right center; + float: right; } diff --git a/core/modules/system/templates/indentation.html.twig b/core/modules/system/templates/indentation.html.twig deleted file mode 100644 index e07e3c1..0000000 --- a/core/modules/system/templates/indentation.html.twig +++ /dev/null @@ -1,20 +0,0 @@ -{# -/** - * @file - * Default theme implementation for a set of indentation divs. - * - * These
tags are used for drag and drop tables. - * - * Available variables: - * - size: Optional. The number of indentations to create. - * - * @ingroup themeable - */ -#} - -{% for i in 1..size if size > 0 %}
 
{% endfor %} diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php index dffbe34..d28fa34 100644 --- a/core/modules/taxonomy/src/Form/OverviewTerms.php +++ b/core/modules/taxonomy/src/Form/OverviewTerms.php @@ -215,15 +215,10 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular foreach ($current_page as $key => $term) { /** @var $term \Drupal\Core\Entity\EntityInterface */ $form['terms'][$key]['#term'] = $term; - $indentation = array(); - if (isset($term->depth) && $term->depth > 0) { - $indentation = array( - '#theme' => 'indentation', - '#size' => $term->depth, - ); + if (isset($term->depth)) { + $form['terms'][$key]['#attributes']['data-indent'] = $term->depth; } $form['terms'][$key]['term'] = array( - '#prefix' => !empty($indentation) ? drupal_render($indentation) : '', '#type' => 'link', '#title' => $term->getName(), '#url' => $term->urlInfo(), diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php index 322c92b..72c3a57 100644 --- a/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php +++ b/core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php @@ -56,7 +56,7 @@ function testTermIndentation() { // Submit the edited form and check for HTML indentation element presence. $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid') . '/overview', $edit, t('Save')); - $this->assertPattern('|
 
|'); + $this->assertPattern('| data-indent="1" |'); // Check explicitly that term 2's parent is term 1. $parents = $taxonomy_storage->loadParents($term2->id()); @@ -72,7 +72,7 @@ function testTermIndentation() { $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid' ) . '/overview', $edit, t('Save')); // All terms back at the root level, no indentation should be present. - $this->assertNoPattern('|
 
|'); + $this->assertNoPattern('| data-indent="1" |'); // Check explicitly that term 2 has no parents. \Drupal::entityManager()->getStorage('taxonomy_term')->resetCache();