diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5d14f31..afa58c3 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -492,8 +492,8 @@ function template_preprocess_datetime_wrapper(&$variables) { } $variables['required'] = FALSE; - // For required datetime fields a 'form-required' class is appended to the - // label attributes. + // For required datetime fields 'form-required' & 'js-form-required' classes + // are appended to the label attributes. if (!empty($element['#required'])) { $variables['required'] = TRUE; } @@ -1604,6 +1604,7 @@ function template_preprocess_field_multiple_value_form(&$variables) { $order_class = $element['#field_name'] . '-delta-order'; $header_attributes = new Attribute(array('class' => array('label'))); if (!empty($element['#required'])) { + $header_attributes['class'][] = 'js-form-required'; $header_attributes['class'][] = 'form-required'; } $header = array( diff --git a/core/lib/Drupal/Core/Render/Element/Button.php b/core/lib/Drupal/Core/Render/Element/Button.php index c305e22..ac34e42 100644 --- a/core/lib/Drupal/Core/Render/Element/Button.php +++ b/core/lib/Drupal/Core/Render/Element/Button.php @@ -77,6 +77,7 @@ public static function preRenderButton($element) { $element['#attributes']['class'][] = 'button--' . $element['#button_type']; } // @todo Various JavaScript depends on this button class. + $element['#attributes']['class'][] = 'js-form-submit'; $element['#attributes']['class'][] = 'form-submit'; if (!empty($element['#attributes']['disabled'])) { diff --git a/core/lib/Drupal/Core/Render/Element/Details.php b/core/lib/Drupal/Core/Render/Element/Details.php index c45810e..cf57bc7 100644 --- a/core/lib/Drupal/Core/Render/Element/Details.php +++ b/core/lib/Drupal/Core/Render/Element/Details.php @@ -54,9 +54,9 @@ public function getInfo() { public static function preRenderDetails($element) { Element::setAttributes($element, array('id')); - // The .form-wrapper class is required for #states to treat details like + // The .js-form-wrapper class is required for #states to treat details like // containers. - static::setAttributes($element, array('form-wrapper')); + static::setAttributes($element, array('js-form-wrapper', 'form-wrapper')); // Collapsible details. $element['#attached']['library'][] = 'core/drupal.collapse'; diff --git a/core/lib/Drupal/Core/Render/Element/File.php b/core/lib/Drupal/Core/Render/Element/File.php index 5f72c8d..c8b3c7f 100644 --- a/core/lib/Drupal/Core/Render/Element/File.php +++ b/core/lib/Drupal/Core/Render/Element/File.php @@ -65,7 +65,7 @@ public static function processFile(&$element, FormStateInterface $form_state, &$ public static function preRenderFile($element) { $element['#attributes']['type'] = 'file'; Element::setAttributes($element, array('id', 'name', 'size')); - static::setAttributes($element, array('form-file')); + static::setAttributes($element, array('js-form-file', 'form-file')); return $element; } diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js index b9e87a6..cccfdfe 100644 --- a/core/misc/machine-name.js +++ b/core/misc/machine-name.js @@ -81,7 +81,7 @@ var $source = $context.find(source_id).addClass('machine-name-source').once('machine-name'); var $target = $context.find(options.target).addClass('machine-name-target'); var $suffix = $context.find(options.suffix); - var $wrapper = $target.closest('.form-item'); + var $wrapper = $target.closest('.js-form-item'); // All elements have to exist. if (!$source.length || !$target.length || !$suffix.length || !$wrapper.length) { return; diff --git a/core/misc/states.js b/core/misc/states.js index 680e86e..c520d7c 100644 --- a/core/misc/states.js +++ b/core/misc/states.js @@ -509,7 +509,7 @@ if (e.trigger) { $(e.target) .prop('disabled', e.value) - .closest('.form-item, .form-submit, .form-wrapper').toggleClass('form-disabled', e.value) + .closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggleClass('form-disabled', e.value) .find('select, input, textarea').prop('disabled', e.value); // Note: WebKit nightlies don't reflect that change correctly. @@ -520,21 +520,21 @@ $(document).on('state:required', function (e) { if (e.trigger) { if (e.value) { - var $label = $(e.target).attr({'required': 'required', 'aria-required': 'aria-required'}).closest('.form-item, .form-wrapper').find('label'); + var $label = $(e.target).attr({'required': 'required', 'aria-required': 'aria-required'}).closest('.js-form-item, .js-form-wrapper').find('label'); // Avoids duplicate required markers on initialization. - if (!$label.hasClass('form-required').length) { - $label.addClass('form-required'); + if (!$label.hasClass('js-form-required').length) { + $label.addClass('js-form-required form-required'); } } else { - $(e.target).removeAttr('required aria-required').closest('.form-item, .form-wrapper').find('label.form-required').removeClass('form-required'); + $(e.target).removeAttr('required aria-required').closest('.js-form-item, .js-form-wrapper').find('label.js-form-required').removeClass('js-form-required form-required'); } } }); $(document).on('state:visible', function (e) { if (e.trigger) { - $(e.target).closest('.form-item, .form-submit, .form-wrapper').toggle(e.value); + $(e.target).closest('.js-form-item, .js-form-submit, .js-form-wrapper').toggle(e.value); } }); diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js index 11fca70..9e841f5 100644 --- a/core/misc/vertical-tabs.js +++ b/core/misc/vertical-tabs.js @@ -149,7 +149,7 @@ // Display the tab. this.item.show(); // Show the vertical tabs. - this.item.closest('.form-type-vertical-tabs').show(); + this.item.closest('.js-form-type-vertical-tabs').show(); // Update .first marker for items. We need recurse from parent to retain the // actual DOM element order as jQuery implements sortOrder, but not as public // method. @@ -182,7 +182,7 @@ } // Hide the vertical tabs (if no tabs remain). else { - this.item.closest('.form-type-vertical-tabs').hide(); + this.item.closest('.js-form-type-vertical-tabs').hide(); } return this; } diff --git a/core/modules/block_content/js/block_content.js b/core/modules/block_content/js/block_content.js index de36d4b..8d4c47b 100644 --- a/core/modules/block_content/js/block_content.js +++ b/core/modules/block_content/js/block_content.js @@ -12,13 +12,13 @@ var $context = $(context); $context.find('.block-content-form-revision-information').drupalSetSummary(function (context) { var $revisionContext = $(context); - var revisionCheckbox = $revisionContext.find('.form-item-revision input'); + var revisionCheckbox = $revisionContext.find('.js-form-item-revision input'); // Return 'New revision' if the 'Create new revision' checkbox is checked, // or if the checkbox doesn't exist, but the revision log does. For users // without the "Administer content" permission the checkbox won't appear, // but the revision log will if the content type is set to auto-revision. - if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.form-item-revision-log textarea').length)) { + if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.js-form-item-revision-log textarea').length)) { return Drupal.t('New revision'); } @@ -28,13 +28,13 @@ $context.find('fieldset.block-content-translation-options').drupalSetSummary(function (context) { var $translationContext = $(context); var translate; - var $checkbox = $translationContext.find('.form-item-translation-translate input'); + var $checkbox = $translationContext.find('.js-form-item-translation-translate input'); if ($checkbox.size()) { translate = $checkbox.is(':checked') ? Drupal.t('Needs to be updated') : Drupal.t('Does not need to be updated'); } else { - $checkbox = $translationContext.find('.form-item-translation-retranslate input'); + $checkbox = $translationContext.find('.js-form-item-translation-retranslate input'); translate = $checkbox.is(':checked') ? Drupal.t('Flag other translations as outdated') : Drupal.t('Do not flag other translations as outdated'); } diff --git a/core/modules/ckeditor/js/ckeditor.admin.js b/core/modules/ckeditor/js/ckeditor.admin.js index e3dbf2b..462e90a 100644 --- a/core/modules/ckeditor/js/ckeditor.admin.js +++ b/core/modules/ckeditor/js/ckeditor.admin.js @@ -16,7 +16,7 @@ var $textarea = $configurationForm // Hide the textarea that contains the serialized representation of the // CKEditor configuration. - .find('.form-item-editor-settings-toolbar-button-groups') + .find('.js-form-item-editor-settings-toolbar-button-groups') .hide() // Return the textarea child node from this expression. .find('textarea'); diff --git a/core/modules/comment/comment-entity-form.js b/core/modules/comment/comment-entity-form.js index b41ab84..6e639bc 100644 --- a/core/modules/comment/comment-entity-form.js +++ b/core/modules/comment/comment-entity-form.js @@ -11,7 +11,7 @@ attach: function (context) { var $context = $(context); $context.find('fieldset.comment-entity-settings-form').drupalSetSummary(function (context) { - return Drupal.checkPlain($(context).find('.form-item-comment input:checked').next('label').text()); + return Drupal.checkPlain($(context).find('.js-form-item-comment input:checked').next('label').text()); }); } }; diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php index e2223dc..b7a2988 100644 --- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php @@ -100,7 +100,7 @@ function testDateField() { // Display creation form. $this->drupalGet('entity_test/add'); $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.'); - $this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]/h4[contains(@class, "form-required")]', TRUE, 'Required markup found'); + $this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]/h4[contains(@class, "js-form-required")]', TRUE, 'Required markup found'); $this->assertNoFieldByName("{$field_name}[0][value][time]", '', 'Time element not found.'); // Submit a valid date and ensure it is accepted. diff --git a/core/modules/field_ui/field_ui.js b/core/modules/field_ui/field_ui.js index 1167fcc..1c90be1 100644 --- a/core/modules/field_ui/field_ui.js +++ b/core/modules/field_ui/field_ui.js @@ -11,15 +11,16 @@ attach: function (context) { var $form = $(context).find('#field-ui-field-storage-add-form').once('field_ui_add'); if ($form.length) { - // Add a few 'form-required' css classes here. We can not use the Form API - // '#required' property because both label elements for "add new" and - // "re-use existing" can never be filled and submitted at the same time. + // Add a few 'js-form-required' and 'form-required 'css classes here. We + // can not use the Form API '#required' property because both label + // elements for "add new" and "re-use existing" can never be filled and + // submitted at the same time. // The actual validation will happen server-side. $form.find( - '.form-item-label label,' + - '.form-item-field-name label,' + - '.form-item-existing-storage-label label') - .addClass('form-required'); + '.js-form-item-label label,' + + '.js-form-item-field-name label,' + + '.js-form-item-existing-storage-label label') + .addClass('js-form-required form-required'); var $newFieldType = $form.find('select[name="new_storage_type"]'); var $existingStorageName = $form.find('select[name="existing_storage_name"]'); diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index 94feeff..c411683 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -307,7 +307,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, arr '#title_display' => 'invisible', '#options' => array_combine($regions, $regions), '#empty_value' => '', - '#attributes' => array('class' => array('field-parent')), + '#attributes' => array('class' => array('js-field-parent', 'field-parent')), '#parents' => array('fields', $field_name, 'parent'), ), 'hidden_name' => array( @@ -486,7 +486,7 @@ protected function buildExtraFieldRow($field_id, $extra_field) { '#title_display' => 'invisible', '#options' => array_combine($regions, $regions), '#empty_value' => '', - '#attributes' => array('class' => array('field-parent')), + '#attributes' => array('class' => array('js-field-parent', 'field-parent')), '#parents' => array('fields', $field_id, 'parent'), ), 'hidden_name' => array( diff --git a/core/modules/file/file.js b/core/modules/file/file.js index fcefad1..e005e94 100644 --- a/core/modules/file/file.js +++ b/core/modules/file/file.js @@ -67,13 +67,13 @@ Drupal.behaviors.fileButtons = { attach: function (context) { var $context = $(context); - $context.find('.form-submit').on('mousedown', Drupal.file.disableFields); - $context.find('.form-managed-file .form-submit').on('mousedown', Drupal.file.progressBar); + $context.find('.js-form-submit').on('mousedown', Drupal.file.disableFields); + $context.find('.form-managed-file .js-form-submit').on('mousedown', Drupal.file.progressBar); }, detach: function (context) { var $context = $(context); - $context.find('.form-submit').off('mousedown', Drupal.file.disableFields); - $context.find('.form-managed-file .form-submit').off('mousedown', Drupal.file.progressBar); + $context.find('.js-form-submit').off('mousedown', Drupal.file.disableFields); + $context.find('.form-managed-file .js-form-submit').off('mousedown', Drupal.file.progressBar); } }; @@ -128,7 +128,7 @@ * Trigger the upload_button mouse event to auto-upload as a managed file. */ triggerUploadButton: function (event) { - $(event.target).closest('.form-managed-file').find('.form-submit').trigger('mousedown'); + $(event.target).closest('.form-managed-file').find('.js-form-submit').trigger('mousedown'); }, /** * Prevent file uploads when using buttons not intended to upload. @@ -144,7 +144,7 @@ // Check if we're working with an "Upload" button. var $enabledFields = []; if ($clickedButton.closest('div.form-managed-file').length > 0) { - $enabledFields = $clickedButton.closest('div.form-managed-file').find('input.form-file'); + $enabledFields = $clickedButton.closest('div.form-managed-file').find('input.js-form-file'); } // Temporarily disable upload fields other than the one we're currently diff --git a/core/modules/filter/filter.filter_html.admin.js b/core/modules/filter/filter.filter_html.admin.js index a11fca5..8223116 100644 --- a/core/modules/filter/filter.filter_html.admin.js +++ b/core/modules/filter/filter.filter_html.admin.js @@ -57,7 +57,7 @@ var that = this; $(context).find('[name="filters[filter_html][settings][allowed_html]"]').once('filter-filter_html-updating', function () { that.$allowedHTMLFormItem = $(this); - that.$allowedHTMLDescription = that.$allowedHTMLFormItem.closest('.form-item').find('.description'); + that.$allowedHTMLDescription = that.$allowedHTMLFormItem.closest('.js-form-item').find('.description'); that.userTags = that._parseSetting(this.value); // Update the new allowed tags based on added text editor features. diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php index 4fef5f5..a4897ee 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -290,8 +290,8 @@ function testImageFieldSettings() { $edit = array(); $edit['files[' . $field_name . '_2][]'] = drupal_realpath($test_image->uri); $this->drupalPostAjaxForm(NULL, $edit, $field_name . '_2_upload_button'); - $this->assertNoRaw(''); - $this->assertRaw(''); + $this->assertNoRaw(''); + $this->assertRaw(''); } /** diff --git a/core/modules/image/src/Tests/ImageFieldValidateTest.php b/core/modules/image/src/Tests/ImageFieldValidateTest.php index e6afc32..f803b4b 100644 --- a/core/modules/image/src/Tests/ImageFieldValidateTest.php +++ b/core/modules/image/src/Tests/ImageFieldValidateTest.php @@ -68,11 +68,11 @@ function testRequiredAttributes() { $this->uploadNodeImage($image, $field_name, 'article'); // Look for form-required for the alt text. - $elements = $this->xpath('//label[@for="edit-' . $field_name . '-0-alt" and @class="form-required"]/following-sibling::input[@id="edit-' . $field_name . '-0-alt"]'); + $elements = $this->xpath('//label[@for="edit-' . $field_name . '-0-alt" and @class="js-form-required form-required"]/following-sibling::input[@id="edit-' . $field_name . '-0-alt"]'); $this->assertTrue(isset($elements[0]),'Required marker is shown for the required alt text.'); - $elements = $this->xpath('//label[@for="edit-' . $field_name . '-0-title" and @class="form-required"]/following-sibling::input[@id="edit-' . $field_name . '-0-title"]'); + $elements = $this->xpath('//label[@for="edit-' . $field_name . '-0-title" and @class="js-form-required form-required"]/following-sibling::input[@id="edit-' . $field_name . '-0-title"]'); $this->assertTrue(isset($elements[0]), 'Required marker is shown for the required title text.'); diff --git a/core/modules/language/templates/language-negotiation-configure-form.html.twig b/core/modules/language/templates/language-negotiation-configure-form.html.twig index 8e1c8f5..46a0f3d 100644 --- a/core/modules/language/templates/language-negotiation-configure-form.html.twig +++ b/core/modules/language/templates/language-negotiation-configure-form.html.twig @@ -23,6 +23,7 @@ {% for language_type in language_types %} {% set language_classes = [ + 'js-form-item', 'form-item', 'table-language-group', 'table-' ~ language_type.type ~ '-wrapper', diff --git a/core/modules/locale/locale.admin.js b/core/modules/locale/locale.admin.js index 550e40e..5efd13b 100644 --- a/core/modules/locale/locale.admin.js +++ b/core/modules/locale/locale.admin.js @@ -25,7 +25,7 @@ $row.addClass('changed'); // Add an asterisk only once if row changed. if ($rowToMark.length) { - $rowToMark.find('td:first-child .form-item').append(marker); + $rowToMark.find('td:first-child .js-form-item').append(marker); } }); } diff --git a/core/modules/menu_ui/menu_ui.js b/core/modules/menu_ui/menu_ui.js index 36fb1d6..87d443e 100644 --- a/core/modules/menu_ui/menu_ui.js +++ b/core/modules/menu_ui/menu_ui.js @@ -6,8 +6,8 @@ attach: function (context) { $(context).find('.menu-link-form').drupalSetSummary(function (context) { var $context = $(context); - if ($context.find('.form-item-menu-enabled input').is(':checked')) { - return Drupal.checkPlain($context.find('.form-item-menu-title input').val()); + if ($context.find('.js-form-item-menu-enabled input').is(':checked')) { + return Drupal.checkPlain($context.find('.js-form-item-menu-title input').val()); } else { return Drupal.t('Not in menu'); @@ -26,9 +26,9 @@ var $this = $(this); // Try to find menu settings widget elements as well as a 'title' field in // the form, but play nicely with user permissions and form alterations. - var $checkbox = $this.find('.form-item-menu-enabled input'); - var $link_title = $context.find('.form-item-menu-title input'); - var $title = $this.closest('form').find('.form-item-title-0-value input'); + var $checkbox = $this.find('.js-form-item-menu-enabled input'); + var $link_title = $context.find('.js-form-item-menu-title input'); + var $title = $this.closest('form').find('.js-form-item-title-0-value input'); // Bail out if we do not have all required fields. if (!($checkbox.length && $link_title.length && $title.length)) { return; diff --git a/core/modules/node/content_types.js b/core/modules/node/content_types.js index c77a2c3..6c4e3dd 100644 --- a/core/modules/node/content_types.js +++ b/core/modules/node/content_types.js @@ -29,7 +29,7 @@ $('#edit-language', context).drupalSetSummary(function (context) { var vals = []; - vals.push($(".form-item-language-configuration-langcode select option:selected", context).text()); + vals.push($(".js-form-item-language-configuration-langcode select option:selected", context).text()); $('input:checked', context).next('label').each(function () { vals.push(Drupal.checkPlain($(this).text())); diff --git a/core/modules/node/node.js b/core/modules/node/node.js index 60db08f..67f350e 100644 --- a/core/modules/node/node.js +++ b/core/modules/node/node.js @@ -12,13 +12,13 @@ var $context = $(context); $context.find('.node-form-revision-information').drupalSetSummary(function (context) { var $revisionContext = $(context); - var revisionCheckbox = $revisionContext.find('.form-item-revision input'); + var revisionCheckbox = $revisionContext.find('.js-form-item-revision input'); // Return 'New revision' if the 'Create new revision' checkbox is checked, // or if the checkbox doesn't exist, but the revision log does. For users // without the "Administer content" permission the checkbox won't appear, // but the revision log will if the content type is set to auto-revision. - if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.form-item-revision-log textarea').length)) { + if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $revisionContext.find('.js-form-item-revision-log textarea').length)) { return Drupal.t('New revision'); } @@ -52,13 +52,13 @@ $context.find('fieldset.node-translation-options').drupalSetSummary(function (context) { var $translationContext = $(context); var translate; - var $checkbox = $translationContext.find('.form-item-translation-translate input'); + var $checkbox = $translationContext.find('.js-form-item-translation-translate input'); if ($checkbox.size()) { translate = $checkbox.is(':checked') ? Drupal.t('Needs to be updated') : Drupal.t('Does not need to be updated'); } else { - $checkbox = $translationContext.find('.form-item-translation-retranslate input'); + $checkbox = $translationContext.find('.js-form-item-translation-retranslate input'); translate = $checkbox.is(':checked') ? Drupal.t('Flag other translations as outdated') : Drupal.t('Do not flag other translations as outdated'); } diff --git a/core/modules/path/path.js b/core/modules/path/path.js index aa91bb2..29a8543 100644 --- a/core/modules/path/path.js +++ b/core/modules/path/path.js @@ -9,7 +9,7 @@ Drupal.behaviors.pathDetailsSummaries = { attach: function (context) { $(context).find('.path-form').drupalSetSummary(function (context) { - var path = $('.form-item-path-0-alias input').val(); + var path = $('.js-form-item-path-0-alias input').val(); return path ? Drupal.t('Alias: @alias', {'@alias': path}) : diff --git a/core/modules/system/src/Tests/Form/ElementsLabelsTest.php b/core/modules/system/src/Tests/Form/ElementsLabelsTest.php index dbf13d2..3d217b6 100644 --- a/core/modules/system/src/Tests/Form/ElementsLabelsTest.php +++ b/core/modules/system/src/Tests/Form/ElementsLabelsTest.php @@ -53,16 +53,16 @@ function testFormLabels() { // Exercise various defaults for textboxes and modifications to ensure // appropriate override and correct behavior. - $elements = $this->xpath('//label[@for="edit-form-textfield-test-title-and-required" and @class="form-required"]/following-sibling::input[@id="edit-form-textfield-test-title-and-required"]'); + $elements = $this->xpath('//label[@for="edit-form-textfield-test-title-and-required" and @class="js-form-required form-required"]/following-sibling::input[@id="edit-form-textfield-test-title-and-required"]'); $this->assertTrue(isset($elements[0]), 'Label precedes textfield, with required marker inside label.'); - $elements = $this->xpath('//input[@id="edit-form-textfield-test-no-title-required"]/preceding-sibling::label[@for="edit-form-textfield-test-no-title-required" and @class="form-required"]'); + $elements = $this->xpath('//input[@id="edit-form-textfield-test-no-title-required"]/preceding-sibling::label[@for="edit-form-textfield-test-no-title-required" and @class="js-form-required form-required"]'); $this->assertTrue(isset($elements[0]), 'Label tag with required marker precedes required textfield with no title.'); $elements = $this->xpath('//input[@id="edit-form-textfield-test-title-invisible"]/preceding-sibling::label[@for="edit-form-textfield-test-title-invisible" and @class="visually-hidden"]'); $this->assertTrue(isset($elements[0]), 'Label preceding field and label class is visually-hidden.'); - $elements = $this->xpath('//input[@id="edit-form-textfield-test-title"]/preceding-sibling::span[@class="form-required"]'); + $elements = $this->xpath('//input[@id="edit-form-textfield-test-title"]/preceding-sibling::span[@class="js-form-required form-required"]'); $this->assertFalse(isset($elements[0]), 'No required marker on non-required field.'); $elements = $this->xpath('//input[@id="edit-form-textfield-test-title-after"]/following-sibling::label[@for="edit-form-textfield-test-title-after" and @class="option"]'); @@ -71,7 +71,7 @@ function testFormLabels() { $elements = $this->xpath('//label[@for="edit-form-textfield-test-title-no-show"]'); $this->assertFalse(isset($elements[0]), 'No label tag when title set not to display.'); - $elements = $this->xpath('//div[contains(@class, "form-item-form-textfield-test-title-invisible") and contains(@class, "form-no-label")]'); + $elements = $this->xpath('//div[contains(@class, "js-form-item-form-textfield-test-title-invisible") and contains(@class, "form-no-label")]'); $this->assertTrue(isset($elements[0]), 'Field class is form-no-label when there is no label.'); // Check #field_prefix and #field_suffix placement. @@ -82,10 +82,10 @@ function testFormLabels() { $this->assertTrue(isset($elements[0]), 'Properly places the #field_suffix element immediately after the form field.'); // Check #prefix and #suffix placement. - $elements = $this->xpath('//div[@id="form-test-textfield-title-prefix"]/following-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]'); + $elements = $this->xpath('//div[@id="js-form-test-textfield-title-prefix"]/following-sibling::div[contains(@class, \'js-form-item-form-textfield-test-title\')]'); $this->assertTrue(isset($elements[0]), 'Properly places the #prefix element before the form item.'); - $elements = $this->xpath('//div[@id="form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]'); + $elements = $this->xpath('//div[@id="js-form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'js-form-item-form-textfield-test-title\')]'); $this->assertTrue(isset($elements[0]), 'Properly places the #suffix element before the form item.'); // Check title attribute for radios and checkboxes. diff --git a/core/modules/system/src/Tests/Form/FormTest.php b/core/modules/system/src/Tests/Form/FormTest.php index e82002b..b824dcf 100644 --- a/core/modules/system/src/Tests/Form/FormTest.php +++ b/core/modules/system/src/Tests/Form/FormTest.php @@ -96,7 +96,7 @@ function testRequiredFields() { $elements['file']['empty_values'] = $empty_strings; // Regular expression to find the expected marker on required elements. - $required_marker_preg = '@<.*?class=".*?form-required.*?">@'; + $required_marker_preg = '@<.*?class=".*?js-form-required.*form-required.*?">@'; // Go through all the elements and all the empty values for them. foreach ($elements as $type => $data) { foreach ($data['empty_values'] as $key => $empty) { diff --git a/core/modules/system/src/Tests/Form/RebuildTest.php b/core/modules/system/src/Tests/Form/RebuildTest.php index 76de748..b6593b8 100644 --- a/core/modules/system/src/Tests/Form/RebuildTest.php +++ b/core/modules/system/src/Tests/Form/RebuildTest.php @@ -102,7 +102,7 @@ function testPreserveFormActionAfterAJAX() { // Ensure that the form contains two items in the multi-valued field, so we // know we're testing a form that was correctly retrieved from cache. - $this->assert(count($this->xpath('//form[contains(@id, "page-node-form")]//div[contains(@class, "form-item-field-ajax-test")]//input[@type="text"]')) == 2, 'Form retained its state from cache.'); + $this->assert(count($this->xpath('//form[contains(@id, "page-node-form")]//div[contains(@class, "js-form-item-field-ajax-test")]//input[@type="text"]')) == 2, 'Form retained its state from cache.'); // Ensure that the form's action is correct. $forms = $this->xpath('//form[contains(@class, "node-page-form")]'); diff --git a/core/modules/system/src/Tests/System/ThemeTest.php b/core/modules/system/src/Tests/System/ThemeTest.php index ccfc727..f68a7fe 100644 --- a/core/modules/system/src/Tests/System/ThemeTest.php +++ b/core/modules/system/src/Tests/System/ThemeTest.php @@ -88,7 +88,7 @@ function testThemeSettings() { // Verify logo path examples. $elements = $this->xpath('//div[contains(@class, :item)]/div[@class=:description]/code', array( - ':item' => 'form-item-logo-path', + ':item' => 'js-form-item-logo-path', ':description' => 'description', )); // Expected default values (if all else fails). diff --git a/core/modules/system/templates/container.html.twig b/core/modules/system/templates/container.html.twig index 6fb8159..2f71632 100644 --- a/core/modules/system/templates/container.html.twig +++ b/core/modules/system/templates/container.html.twig @@ -17,4 +17,9 @@ * @ingroup themeable */ #} -