/**
- * @file
- * Simpletest behaviors.
- */
+* DO NOT EDIT THIS FILE.
+* See the following change record for more information,
+* https://www.drupal.org/node/2815083
+* @preserve
+**/
(function ($, Drupal, drupalSettings) {
-
- 'use strict';
-
- /**
- * Collapses table rows followed by group rows on the test listing page.
- *
- * @type {Drupal~behavior}
- *
- * @prop {Drupal~behaviorAttach} attach
- * Attach collapse behavior on the test listing page.
- */
Drupal.behaviors.simpleTestGroupCollapse = {
- attach: function (context) {
+ attach: function attach(context) {
$(context).find('.simpletest-group').once('simpletest-group-collapse').each(function () {
var $group = $(this);
var $image = $group.find('.simpletest-image');
- $image
- .html(drupalSettings.simpleTest.images[0])
- .on('click', function () {
- var $tests = $group.nextUntil('.simpletest-group');
- var expand = !$group.hasClass('expanded');
- $group.toggleClass('expanded', expand);
- $tests.toggleClass('js-hide', !expand);
- $image.html(drupalSettings.simpleTest.images[+expand]);
- });
+ $image.html(drupalSettings.simpleTest.images[0]).on('click', function () {
+ var $tests = $group.nextUntil('.simpletest-group');
+ var expand = !$group.hasClass('expanded');
+ $group.toggleClass('expanded', expand);
+ $tests.toggleClass('js-hide', !expand);
+ $image.html(drupalSettings.simpleTest.images[+expand]);
+ });
});
}
};
- /**
- * Toggles test checkboxes to match the group checkbox.
- *
- * @type {Drupal~behavior}
- *
- * @prop {Drupal~behaviorAttach} attach
- * Attaches behavior for selecting all tests in a group.
- */
Drupal.behaviors.simpleTestSelectAll = {
- attach: function (context) {
+ attach: function attach(context) {
$(context).find('.simpletest-group').once('simpletest-group-select-all').each(function () {
var $group = $(this);
var $cell = $group.find('.simpletest-group-select-all');
var $testCheckboxes = $group.nextUntil('.simpletest-group').find('input[type=checkbox]');
$cell.append($groupCheckbox);
- // Toggle the test checkboxes when the group checkbox is toggled.
$groupCheckbox.on('change', function () {
var checked = $(this).prop('checked');
$testCheckboxes.prop('checked', checked);
});
- // Update the group checkbox when a test checkbox is toggled.
function updateGroupCheckbox() {
var allChecked = true;
$testCheckboxes.each(function () {
}
};
- /**
- * Filters the test list table by a text input search string.
- *
- * Text search input: input.table-filter-text
- * Target table: input.table-filter-text[data-table]
- * Source text: .table-filter-text-source
- *
- * @type {Drupal~behavior}
- *
- * @prop {Drupal~behaviorAttach} attach
- * Attaches the filter behavior to the text input element.
- */
Drupal.behaviors.simpletestTableFilterByText = {
- attach: function (context) {
+ attach: function attach(context) {
var $input = $('input.table-filter-text').once('table-filter-text');
var $table = $($input.attr('data-table'));
- var $rows;
+ var $rows = void 0;
var searched = false;
function filterTestList(e) {
$row.closest('tr').toggle(textMatch);
}
- // Filter if the length of the query is at least 3 characters.
if (query.length >= 3) {
- // Indicate that a search has been performed, and hide the
- // "select all" checkbox.
searched = true;
$('#simpletest-form-table thead th.select-all input').hide();
$rows.each(showTestRow);
- }
- // Restore to the original state if any searching has occurred.
- else if (searched) {
- searched = false;
- $('#simpletest-form-table thead th.select-all input').show();
- // Restore all rows to their original display state.
- $rows.css('display', '');
- }
+ } else if (searched) {
+ searched = false;
+ $('#simpletest-form-table thead th.select-all input').show();
+
+ $rows.css('display', '');
+ }
}
if ($table.length) {
}
}
};
-
-})(jQuery, Drupal, drupalSettings);
+})(jQuery, Drupal, drupalSettings);
\ No newline at end of file