2015-08-17 17:00:26 -07:00
/ * *
2018-11-23 12:29:20 +00:00
* DO NOT EDIT THIS FILE .
* See the following change record for more information ,
* https : //www.drupal.org/node/2815083
* @ preserve
* * /
2015-08-17 17:00:26 -07:00
2016-04-20 09:56:34 -07:00
( function ( $ , Drupal , drupalSettings ) {
2015-08-17 17:00:26 -07:00
Drupal . behaviors . simpleTestGroupCollapse = {
2018-11-23 12:29:20 +00:00
attach : function attach ( context ) {
2015-08-17 17:00:26 -07:00
$ ( context ) . find ( '.simpletest-group' ) . once ( 'simpletest-group-collapse' ) . each ( function ( ) {
var $group = $ ( this ) ;
var $image = $group . find ( '.simpletest-image' ) ;
2018-11-23 12:29:20 +00:00
$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 ] ) ;
} ) ;
2015-08-17 17:00:26 -07:00
} ) ;
}
} ;
Drupal . behaviors . simpleTestSelectAll = {
2018-11-23 12:29:20 +00:00
attach : function attach ( context ) {
2015-08-17 17:00:26 -07:00
$ ( context ) . find ( '.simpletest-group' ) . once ( 'simpletest-group-select-all' ) . each ( function ( ) {
var $group = $ ( this ) ;
var $cell = $group . find ( '.simpletest-group-select-all' ) ;
var $groupCheckbox = $ ( '<input type="checkbox" id="' + $cell . attr ( 'id' ) + '-group-select-all" class="form-checkbox" />' ) ;
var $testCheckboxes = $group . nextUntil ( '.simpletest-group' ) . find ( 'input[type=checkbox]' ) ;
$cell . append ( $groupCheckbox ) ;
$groupCheckbox . on ( 'change' , function ( ) {
var checked = $ ( this ) . prop ( 'checked' ) ;
$testCheckboxes . prop ( 'checked' , checked ) ;
} ) ;
function updateGroupCheckbox ( ) {
var allChecked = true ;
$testCheckboxes . each ( function ( ) {
if ( ! $ ( this ) . prop ( 'checked' ) ) {
allChecked = false ;
return false ;
}
} ) ;
$groupCheckbox . prop ( 'checked' , allChecked ) ;
}
$testCheckboxes . on ( 'change' , updateGroupCheckbox ) ;
} ) ;
}
} ;
Drupal . behaviors . simpletestTableFilterByText = {
2018-11-23 12:29:20 +00:00
attach : function attach ( context ) {
2015-08-17 17:00:26 -07:00
var $input = $ ( 'input.table-filter-text' ) . once ( 'table-filter-text' ) ;
var $table = $ ( $input . attr ( 'data-table' ) ) ;
2018-11-23 12:29:20 +00:00
var $rows = void 0 ;
2015-08-17 17:00:26 -07:00
var searched = false ;
function filterTestList ( e ) {
var query = $ ( e . target ) . val ( ) . toLowerCase ( ) ;
function showTestRow ( index , row ) {
var $row = $ ( row ) ;
var $sources = $row . find ( '.table-filter-text-source' ) ;
var textMatch = $sources . text ( ) . toLowerCase ( ) . indexOf ( query ) !== - 1 ;
$row . closest ( 'tr' ) . toggle ( textMatch ) ;
}
if ( query . length >= 3 ) {
searched = true ;
$ ( '#simpletest-form-table thead th.select-all input' ) . hide ( ) ;
$rows . each ( showTestRow ) ;
2018-11-23 12:29:20 +00:00
} else if ( searched ) {
searched = false ;
$ ( '#simpletest-form-table thead th.select-all input' ) . show ( ) ;
$rows . css ( 'display' , '' ) ;
}
2015-08-17 17:00:26 -07:00
}
if ( $table . length ) {
$rows = $table . find ( 'tbody tr' ) ;
$input . trigger ( 'focus' ) . on ( 'keyup' , Drupal . debounce ( filterTestList , 200 ) ) ;
}
}
} ;
2018-11-23 12:29:20 +00:00
} ) ( jQuery , Drupal , drupalSettings ) ;