- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
// $Id$
|
2009-04-27 20:19:38 +00:00
|
|
|
(function ($) {
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-09-14 22:34:25 +00:00
|
|
|
/**
|
|
|
|
* Add the cool table collapsing on the testing overview page.
|
|
|
|
*/
|
2008-10-29 10:01:28 +00:00
|
|
|
Drupal.behaviors.simpleTestMenuCollapse = {
|
2009-04-27 20:19:38 +00:00
|
|
|
attach: function (context, settings) {
|
2008-11-20 05:51:58 +00:00
|
|
|
var timeout = null;
|
2008-10-29 10:01:28 +00:00
|
|
|
// Adds expand-collapse functionality.
|
2009-04-27 20:19:38 +00:00
|
|
|
$('div.simpletest-image').each(function () {
|
2009-03-13 23:15:09 +00:00
|
|
|
direction = settings.simpleTest[$(this).attr('id')].imageDirection;
|
|
|
|
$(this).html(settings.simpleTest.images[direction]);
|
2008-10-29 10:01:28 +00:00
|
|
|
});
|
2008-11-20 05:51:58 +00:00
|
|
|
|
|
|
|
// Adds group toggling functionality to arrow images.
|
2009-04-27 20:19:38 +00:00
|
|
|
$('div.simpletest-image').click(function () {
|
2009-03-13 23:15:09 +00:00
|
|
|
var trs = $(this).parents('tbody').children('.' + settings.simpleTest[this.id].testClass);
|
|
|
|
var direction = settings.simpleTest[this.id].imageDirection;
|
2008-11-20 05:51:58 +00:00
|
|
|
var row = direction ? trs.size() - 1 : 0;
|
|
|
|
|
|
|
|
// If clicked in the middle of expanding a group, stop so we can switch directions.
|
|
|
|
if (timeout) {
|
|
|
|
clearTimeout(timeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Function to toggle an individual row according to the current direction.
|
|
|
|
// We set a timeout of 20 ms until the next row will be shown/hidden to
|
|
|
|
// create a sliding effect.
|
|
|
|
function rowToggle() {
|
|
|
|
if (direction) {
|
|
|
|
if (row >= 0) {
|
|
|
|
$(trs[row]).hide();
|
|
|
|
row--;
|
|
|
|
timeout = setTimeout(rowToggle, 20);
|
2008-10-29 10:01:28 +00:00
|
|
|
}
|
2008-11-20 05:51:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (row < trs.size()) {
|
|
|
|
$(trs[row]).removeClass('js-hide').show();
|
|
|
|
row++;
|
|
|
|
timeout = setTimeout(rowToggle, 20);
|
2008-10-29 10:01:28 +00:00
|
|
|
}
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
}
|
|
|
|
}
|
2008-11-20 05:51:58 +00:00
|
|
|
|
|
|
|
// Kick-off the toggling upon a new click.
|
|
|
|
rowToggle();
|
|
|
|
|
|
|
|
// Toggle the arrow image next to the test group title.
|
2009-03-13 23:15:09 +00:00
|
|
|
$(this).html(settings.simpleTest.images[(direction ? 0 : 1)]);
|
|
|
|
settings.simpleTest[this.id].imageDirection = !direction;
|
2008-11-20 05:51:58 +00:00
|
|
|
|
2008-10-29 10:01:28 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2008-09-14 22:34:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Select/deselect all the inner checkboxes when the outer checkboxes are
|
|
|
|
* selected/deselected.
|
|
|
|
*/
|
2008-10-29 10:01:28 +00:00
|
|
|
Drupal.behaviors.simpleTestSelectAll = {
|
2009-04-27 20:19:38 +00:00
|
|
|
attach: function (context, settings) {
|
|
|
|
$('td.simpletest-select-all').each(function () {
|
2009-03-13 23:15:09 +00:00
|
|
|
var testCheckboxes = settings.simpleTest['simpletest-test-group-' + $(this).attr('id')].testNames;
|
2009-01-19 10:15:54 +00:00
|
|
|
var groupCheckbox = $('<input type="checkbox" class="form-checkbox" id="' + $(this).attr('id') + '-select-all" />');
|
|
|
|
|
|
|
|
// Each time a single-test checkbox is checked or unchecked, make sure
|
|
|
|
// that the associated group checkbox gets the right state too.
|
2009-04-27 20:19:38 +00:00
|
|
|
var updateGroupCheckbox = function () {
|
2009-01-19 10:15:54 +00:00
|
|
|
var checkedTests = 0;
|
|
|
|
for (var i = 0; i < testCheckboxes.length; i++) {
|
2009-04-27 20:19:38 +00:00
|
|
|
$('#' + testCheckboxes[i]).each(function () {
|
2009-01-19 10:15:54 +00:00
|
|
|
if (($(this).attr('checked'))) {
|
|
|
|
checkedTests++;
|
|
|
|
}
|
|
|
|
});
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
}
|
2009-01-19 10:15:54 +00:00
|
|
|
$(groupCheckbox).attr('checked', (checkedTests == testCheckboxes.length));
|
2009-02-18 13:46:55 +00:00
|
|
|
};
|
2009-01-19 10:15:54 +00:00
|
|
|
|
|
|
|
// Have the single-test checkboxes follow the group checkbox.
|
2009-04-27 20:19:38 +00:00
|
|
|
groupCheckbox.change(function () {
|
2009-01-19 10:15:54 +00:00
|
|
|
var checked = !!($(this).attr('checked'));
|
|
|
|
for (var i = 0; i < testCheckboxes.length; i++) {
|
2009-04-26 19:18:46 +00:00
|
|
|
$('#' + testCheckboxes[i]).attr('checked', checked);
|
2009-01-19 10:15:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Have the group checkbox follow the single-test checkboxes.
|
|
|
|
for (var i = 0; i < testCheckboxes.length; i++) {
|
2009-04-27 20:19:38 +00:00
|
|
|
$('#' + testCheckboxes[i]).change(function () {
|
2009-01-19 10:15:54 +00:00
|
|
|
updateGroupCheckbox();
|
|
|
|
});
|
2008-10-29 10:01:28 +00:00
|
|
|
}
|
2009-01-19 10:15:54 +00:00
|
|
|
|
|
|
|
// Initialize status for the group checkbox correctly.
|
|
|
|
updateGroupCheckbox();
|
|
|
|
$(this).append(groupCheckbox);
|
2008-10-29 10:01:28 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2009-02-18 13:46:55 +00:00
|
|
|
|
|
|
|
})(jQuery);
|