Issue #642734 by nod_, yhahn: Fixed Simpletest behaviors should process the elements only once.

8.0.x
catch 2012-04-18 12:29:51 +09:00
parent a5e3fac8d5
commit 812413b922
1 changed files with 37 additions and 36 deletions

View File

@ -7,14 +7,14 @@ Drupal.behaviors.simpleTestMenuCollapse = {
attach: function (context, settings) {
var timeout = null;
// Adds expand-collapse functionality.
$('div.simpletest-image').each(function () {
direction = settings.simpleTest[$(this).attr('id')].imageDirection;
$(this).html(settings.simpleTest.images[direction]);
});
$('div.simpletest-image').once('simpletest-image', function () {
var $this = $(this);
var direction = settings.simpleTest[this.id].imageDirection;
$this.html(settings.simpleTest.images[direction]);
// Adds group toggling functionality to arrow images.
$('div.simpletest-image').click(function () {
var trs = $(this).closest('tbody').children('.' + settings.simpleTest[this.id].testClass);
$this.click(function () {
var trs = $this.closest('tbody').children('.' + settings.simpleTest[this.id].testClass);
var direction = settings.simpleTest[this.id].imageDirection;
var row = direction ? trs.length - 1 : 0;
@ -47,10 +47,11 @@ Drupal.behaviors.simpleTestMenuCollapse = {
rowToggle();
// Toggle the arrow image next to the test group title.
$(this).html(settings.simpleTest.images[(direction ? 0 : 1)]);
$this.html(settings.simpleTest.images[(direction ? 0 : 1)]);
settings.simpleTest[this.id].imageDirection = !direction;
});
});
}
};
@ -60,7 +61,7 @@ Drupal.behaviors.simpleTestMenuCollapse = {
*/
Drupal.behaviors.simpleTestSelectAll = {
attach: function (context, settings) {
$('td.simpletest-select-all').each(function () {
$('td.simpletest-select-all').once('simpletest-select-all', function () {
var testCheckboxes = settings.simpleTest['simpletest-test-group-' + $(this).attr('id')].testNames;
var groupCheckbox = $('<input type="checkbox" class="form-checkbox" id="' + $(this).attr('id') + '-select-all" />');