Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / simpletest / simpletest.js
1 /**
2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
5 * @preserve
6 **/
7
8 (function ($, Drupal, drupalSettings) {
9   Drupal.behaviors.simpleTestGroupCollapse = {
10     attach: function attach(context) {
11       $(context).find('.simpletest-group').once('simpletest-group-collapse').each(function () {
12         var $group = $(this);
13         var $image = $group.find('.simpletest-image');
14         $image.html(drupalSettings.simpleTest.images[0]).on('click', function () {
15           var $tests = $group.nextUntil('.simpletest-group');
16           var expand = !$group.hasClass('expanded');
17           $group.toggleClass('expanded', expand);
18           $tests.toggleClass('js-hide', !expand);
19           $image.html(drupalSettings.simpleTest.images[+expand]);
20         });
21       });
22     }
23   };
24
25   Drupal.behaviors.simpleTestSelectAll = {
26     attach: function attach(context) {
27       $(context).find('.simpletest-group').once('simpletest-group-select-all').each(function () {
28         var $group = $(this);
29         var $cell = $group.find('.simpletest-group-select-all');
30         var $groupCheckbox = $('<input type="checkbox" id="' + $cell.attr('id') + '-group-select-all" class="form-checkbox" />');
31         var $testCheckboxes = $group.nextUntil('.simpletest-group').find('input[type=checkbox]');
32         $cell.append($groupCheckbox);
33
34         $groupCheckbox.on('change', function () {
35           var checked = $(this).prop('checked');
36           $testCheckboxes.prop('checked', checked);
37         });
38
39         function updateGroupCheckbox() {
40           var allChecked = true;
41           $testCheckboxes.each(function () {
42             if (!$(this).prop('checked')) {
43               allChecked = false;
44               return false;
45             }
46           });
47           $groupCheckbox.prop('checked', allChecked);
48         }
49
50         $testCheckboxes.on('change', updateGroupCheckbox);
51       });
52     }
53   };
54
55   Drupal.behaviors.simpletestTableFilterByText = {
56     attach: function attach(context) {
57       var $input = $('input.table-filter-text').once('table-filter-text');
58       var $table = $($input.attr('data-table'));
59       var $rows = void 0;
60       var searched = false;
61
62       function filterTestList(e) {
63         var query = $(e.target).val().toLowerCase();
64
65         function showTestRow(index, row) {
66           var $row = $(row);
67           var $sources = $row.find('.table-filter-text-source');
68           var textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
69           $row.closest('tr').toggle(textMatch);
70         }
71
72         if (query.length >= 3) {
73           searched = true;
74           $('#simpletest-form-table thead th.select-all input').hide();
75
76           $rows.each(showTestRow);
77         } else if (searched) {
78             searched = false;
79             $('#simpletest-form-table thead th.select-all input').show();
80
81             $rows.css('display', '');
82           }
83       }
84
85       if ($table.length) {
86         $rows = $table.find('tbody tr');
87         $input.trigger('focus').on('keyup', Drupal.debounce(filterTestList, 200));
88       }
89     }
90   };
91 })(jQuery, Drupal, drupalSettings);