summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-09-27 00:53:56 +0000
committerDries Buytaert <dries@buytaert.net>2010-09-27 00:53:56 +0000
commit9eaa04648a89ad45db12b2c240cf4fe95cc4aafd (patch)
tree36d90eb1c61b405bd220eea4399421dd4ecc8a96 /modules/simpletest
parent3780b17654a2af093c854f9c32bd2d6e102ec16c (diff)
downloadbrdo-9eaa04648a89ad45db12b2c240cf4fe95cc4aafd.tar.gz
brdo-9eaa04648a89ad45db12b2c240cf4fe95cc4aafd.tar.bz2
- Patch #756762 by effulgentsia, fago, sun: AJAX should follow same rules for whether to call drupal_rebuild_form() as non-AJAX submissions.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/tests/form.test16
-rw-r--r--modules/simpletest/tests/form_test.module15
2 files changed, 5 insertions, 26 deletions
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test
index 793d0c0bf..d8e0b21f1 100644
--- a/modules/simpletest/tests/form.test
+++ b/modules/simpletest/tests/form.test
@@ -788,24 +788,21 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
$this->assertText('Form constructions: 1');
$edit = array('title' => 'new', 'value' => 'value_is_set');
- // Reload the form, but don't rebuild.
- $this->drupalPost(NULL, $edit, 'Reload');
- $this->assertText('Form constructions: 2');
- // Now use form rebuilding triggered by a submit button.
+ // Use form rebuilding triggered by a submit button.
$this->drupalPost(NULL, $edit, 'Continue submit');
+ $this->assertText('Form constructions: 2');
$this->assertText('Form constructions: 3');
- $this->assertText('Form constructions: 4');
// Reset the form to the values of the storage, using a form rebuild
// triggered by button of type button.
$this->drupalPost(NULL, array('title' => 'changed'), 'Reset');
$this->assertFieldByName('title', 'new', 'Values have been resetted.');
// After rebuilding, the form has been cached.
- $this->assertText('Form constructions: 5');
+ $this->assertText('Form constructions: 4');
$this->drupalPost(NULL, $edit, 'Save');
- $this->assertText('Form constructions: 5');
+ $this->assertText('Form constructions: 4');
$this->assertText('Title: new', t('The form storage has stored the values.'));
}
@@ -817,11 +814,8 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
$this->assertText('Form constructions: 1');
$edit = array('title' => 'new', 'value' => 'value_is_set');
- // Reload the form, but don't rebuild.
- $this->drupalPost(NULL, $edit, 'Reload');
- $this->assertNoText('Form constructions');
- // Now use form rebuilding triggered by a submit button.
+ // Use form rebuilding triggered by a submit button.
$this->drupalPost(NULL, $edit, 'Continue submit');
$this->assertText('Form constructions: 2');
diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module
index ca3538c75..57a96863c 100644
--- a/modules/simpletest/tests/form_test.module
+++ b/modules/simpletest/tests/form_test.module
@@ -522,16 +522,10 @@ function form_test_storage_form($form, &$form_state) {
'#default_value' => $form_state['storage']['thing']['value'],
'#element_validate' => array('form_test_storage_element_validate_value_cached'),
);
- $form['button'] = array(
- '#type' => 'button',
- '#value' => 'Reload',
- // Reload the form (don't rebuild), thus we start at the initial step again.
- );
$form['continue_button'] = array(
'#type' => 'button',
'#value' => 'Reset',
// Rebuilds the form without keeping the values.
- '#validate' => array('form_storage_test_form_continue_validate'),
);
$form['continue_submit'] = array(
'#type' => 'submit',
@@ -577,15 +571,6 @@ function form_storage_test_form_continue_submit($form, &$form_state) {
}
/**
- * Form validation handler, which doesn't preserve the values but rebuilds the
- * form. We cannot use a submit handler here, as buttons of type button don't
- * submit the form.
- */
-function form_storage_test_form_continue_validate($form, &$form_state) {
- $form_state['rebuild'] = TRUE;
-}
-
-/**
* Form submit handler to finish multi-step form.
*/
function form_test_storage_form_submit($form, &$form_state) {