Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / simpletest / simpletest.es6.js
index 42763b24c51cba7fcbb0361fbaf919db4b7f887e..7e65c12f496801a5b9981b1fcb7a51add5f97c09 100644 (file)
@@ -3,7 +3,7 @@
  * Simpletest behaviors.
  */
 
-(function ($, Drupal, drupalSettings) {
+(function($, Drupal, drupalSettings) {
   /**
    * Collapses table rows followed by group rows on the test listing page.
    *
    */
   Drupal.behaviors.simpleTestGroupCollapse = {
     attach(context) {
-      $(context).find('.simpletest-group').once('simpletest-group-collapse').each(function () {
-        const $group = $(this);
-        const $image = $group.find('.simpletest-image');
-        $image
-          .html(drupalSettings.simpleTest.images[0])
-          .on('click', () => {
+      $(context)
+        .find('.simpletest-group')
+        .once('simpletest-group-collapse')
+        .each(function() {
+          const $group = $(this);
+          const $image = $group.find('.simpletest-image');
+          $image.html(drupalSettings.simpleTest.images[0]).on('click', () => {
             const $tests = $group.nextUntil('.simpletest-group');
             const expand = !$group.hasClass('expanded');
             $group.toggleClass('expanded', expand);
             $tests.toggleClass('js-hide', !expand);
             $image.html(drupalSettings.simpleTest.images[+expand]);
           });
-      });
+        });
     },
   };
 
    */
   Drupal.behaviors.simpleTestSelectAll = {
     attach(context) {
-      $(context).find('.simpletest-group').once('simpletest-group-select-all').each(function () {
-        const $group = $(this);
-        const $cell = $group.find('.simpletest-group-select-all');
-        const $groupCheckbox = $(`<input type="checkbox" id="${$cell.attr('id')}-group-select-all" class="form-checkbox" />`);
-        const $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 () {
-          const checked = $(this).prop('checked');
-          $testCheckboxes.prop('checked', checked);
-        });
+      $(context)
+        .find('.simpletest-group')
+        .once('simpletest-group-select-all')
+        .each(function() {
+          const $group = $(this);
+          const $cell = $group.find('.simpletest-group-select-all');
+          const $groupCheckbox = $(
+            `<input type="checkbox" id="${$cell.attr(
+              'id',
+            )}-group-select-all" class="form-checkbox" />`,
+          );
+          const $testCheckboxes = $group
+            .nextUntil('.simpletest-group')
+            .find('input[type=checkbox]');
+          $cell.append($groupCheckbox);
 
-        // Update the group checkbox when a test checkbox is toggled.
-        function updateGroupCheckbox() {
-          let allChecked = true;
-          $testCheckboxes.each(function () {
-            if (!$(this).prop('checked')) {
-              allChecked = false;
-              return false;
-            }
+          // Toggle the test checkboxes when the group checkbox is toggled.
+          $groupCheckbox.on('change', function() {
+            const checked = $(this).prop('checked');
+            $testCheckboxes.prop('checked', checked);
           });
-          $groupCheckbox.prop('checked', allChecked);
-        }
 
-        $testCheckboxes.on('change', updateGroupCheckbox);
-      });
+          // Update the group checkbox when a test checkbox is toggled.
+          function updateGroupCheckbox() {
+            let allChecked = true;
+            $testCheckboxes.each(function() {
+              if (!$(this).prop('checked')) {
+                allChecked = false;
+                return false;
+              }
+            });
+            $groupCheckbox.prop('checked', allChecked);
+          }
+
+          $testCheckboxes.on('change', updateGroupCheckbox);
+        });
     },
   };
 
       let searched = false;
 
       function filterTestList(e) {
-        const query = $(e.target).val().toLowerCase();
+        const query = $(e.target)
+          .val()
+          .toLowerCase();
 
         function showTestRow(index, row) {
           const $row = $(row);
           const $sources = $row.find('.table-filter-text-source');
-          const textMatch = $sources.text().toLowerCase().indexOf(query) !== -1;
+          const textMatch =
+            $sources
+              .text()
+              .toLowerCase()
+              .indexOf(query) !== -1;
           $row.closest('tr').toggle(textMatch);
         }
 
 
       if ($table.length) {
         $rows = $table.find('tbody tr');
-        $input.trigger('focus').on('keyup', Drupal.debounce(filterTestList, 200));
+        $input
+          .trigger('focus')
+          .on('keyup', Drupal.debounce(filterTestList, 200));
       }
     },
   };
-}(jQuery, Drupal, drupalSettings));
+})(jQuery, Drupal, drupalSettings);