diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-02-19 00:09:11 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-02-19 00:09:11 +0000 |
commit | fa39282ef779a331ba2e3096f791c5a663994e16 (patch) | |
tree | cbbff5ddd220781bd7398e0531750a2e7404ee95 /modules/simpletest | |
parent | 7205ff14cac0472acb9247297d13477ab9cc5a97 (diff) | |
download | brdo-fa39282ef779a331ba2e3096f791c5a663994e16.tar.gz brdo-fa39282ef779a331ba2e3096f791c5a663994e16.tar.bz2 |
- Patch #1056108 by 1V: consistent use of 'JavaScript' and 'Ajax'.
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 30 | ||||
-rw-r--r-- | modules/simpletest/tests/ajax.test | 28 | ||||
-rw-r--r-- | modules/simpletest/tests/ajax_forms_test.module | 64 | ||||
-rw-r--r-- | modules/simpletest/tests/ajax_test.module | 4 | ||||
-rw-r--r-- | modules/simpletest/tests/form.test | 12 | ||||
-rw-r--r-- | modules/simpletest/tests/form_test.file.inc | 4 |
6 files changed, 71 insertions, 71 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 17cbb1ffa..abe20d88e 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1769,17 +1769,17 @@ class DrupalWebTestCase extends DrupalTestCase { * button with the value t('Delete'), and execute different code depending * on which one is clicked. * - * This function can also be called to emulate an AJAX submission. In this + * This function can also be called to emulate an Ajax submission. In this * case, this value needs to be an array with the following keys: - * - path: A path to submit the form values to for AJAX-specific processing, + * - path: A path to submit the form values to for Ajax-specific processing, * which is likely different than the $path parameter used for retrieving * the initial form. Defaults to 'system/ajax'. * - triggering_element: If the value for the 'path' key is 'system/ajax' or - * another generic AJAX processing path, this needs to be set to the name + * another generic Ajax processing path, this needs to be set to the name * of the element. If the name doesn't identify the element uniquely, then * this should instead be an array with a single key/value pair, * corresponding to the element name and value. The callback for the - * generic AJAX processing path uses this to find the #ajax information + * generic Ajax processing path uses this to find the #ajax information * for the element, including which specific callback to use for * processing the request. * @@ -1829,7 +1829,7 @@ class DrupalWebTestCase extends DrupalTestCase { $action = isset($form['action']) ? $this->getAbsoluteUrl((string) $form['action']) : $this->getUrl(); if ($ajax) { $action = $this->getAbsoluteUrl(!empty($submit['path']) ? $submit['path'] : 'system/ajax'); - // AJAX callbacks verify the triggering element if necessary, so while + // Ajax callbacks verify the triggering element if necessary, so while // we may eventually want extra code that verifies it in the // handleForm() function, it's not currently a requirement. $submit_matches = TRUE; @@ -1886,26 +1886,26 @@ class DrupalWebTestCase extends DrupalTestCase { } /** - * Execute an AJAX submission. + * Execute an Ajax submission. * * This executes a POST as ajax.js does. It uses the returned JSON data, an * array of commands, to update $this->content using equivalent DOM * manipulation as is used by ajax.js. It also returns the array of commands. * * @param $path - * Location of the form containing the AJAX enabled element to test. Can be + * Location of the form containing the Ajax enabled element to test. Can be * either a Drupal path or an absolute path or NULL to use the current page. * @param $edit * Field data in an associative array. Changes the current input fields * (where possible) to the values indicated. * @param $triggering_element - * The name of the form element that is responsible for triggering the AJAX + * The name of the form element that is responsible for triggering the Ajax * functionality to test. May be a string or, if the triggering element is * a button, an associative array where the key is the name of the button * and the value is the button label. i.e.) array('op' => t('Refresh')). * @param $ajax_path - * (optional) Override the path set by the AJAX settings of the triggering - * element. In the absence of both the triggering element's AJAX path and + * (optional) Override the path set by the Ajax settings of the triggering + * element. In the absence of both the triggering element's Ajax path and * $ajax_path 'system/ajax' will be used. * @param $options * (optional) Options to be forwarded to url(). @@ -1918,11 +1918,11 @@ class DrupalWebTestCase extends DrupalTestCase { * element is not enough to identify the form. Note this is not the Drupal * ID of the form but rather the HTML ID of the form. * @param $ajax_settings - * (optional) An array of AJAX settings which if specified will be used in - * place of the AJAX settings of the triggering element. + * (optional) An array of Ajax settings which if specified will be used in + * place of the Ajax settings of the triggering element. * * @return - * An array of AJAX commands. + * An array of Ajax commands. * * @see drupalPost() * @see ajax.js @@ -1936,7 +1936,7 @@ class DrupalWebTestCase extends DrupalTestCase { $content = $this->content; $drupal_settings = $this->drupalSettings; - // Get the AJAX settings bound to the triggering element. + // Get the Ajax settings bound to the triggering element. if (!isset($ajax_settings)) { if (is_array($triggering_element)) { $xpath = '//*[@name="' . key($triggering_element) . '" and @value="' . current($triggering_element) . '"]'; @@ -1965,7 +1965,7 @@ class DrupalWebTestCase extends DrupalTestCase { } // Unless a particular path is specified, use the one specified by the - // AJAX settings, or else 'system/ajax'. + // Ajax settings, or else 'system/ajax'. if (!isset($ajax_path)) { $ajax_path = isset($ajax_settings['url']) ? $ajax_settings['url'] : 'system/ajax'; } diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test index 2a2469334..2d8c40919 100644 --- a/modules/simpletest/tests/ajax.test +++ b/modules/simpletest/tests/ajax.test @@ -11,9 +11,9 @@ class AJAXTestCase extends DrupalWebTestCase { } /** - * Assert that a command with the required properties exists within the array of AJAX commands returned by the server. + * Assert that a command with the required properties exists within the array of Ajax commands returned by the server. * - * The AJAX framework, via the ajax_deliver() and ajax_render() functions, + * The Ajax framework, via the ajax_deliver() and ajax_render() functions, * returns an array of commands. This array sometimes includes commands * automatically provided by the framework in addition to commands returned by * a particular page callback. During testing, we're usually interested that a @@ -28,7 +28,7 @@ class AJAXTestCase extends DrupalWebTestCase { * additional settings that aren't part of $needle. * * @param $haystack - * An array of AJAX commands returned by the server. + * An array of Ajax commands returned by the server. * @param $needle * Array of info we're expecting in one of those commands. * @param $message @@ -56,7 +56,7 @@ class AJAXTestCase extends DrupalWebTestCase { } /** - * Tests primary AJAX framework functions. + * Tests primary Ajax framework functions. */ class AJAXFrameworkTestCase extends AJAXTestCase { protected $profile = 'testing'; @@ -87,7 +87,7 @@ class AJAXFrameworkTestCase extends AJAXTestCase { ); $this->assertCommand($commands, $expected, t('ajax_render() loads settings added with drupal_add_js().')); - // Verify that AJAX settings are loaded for #type 'link'. + // Verify that Ajax settings are loaded for #type 'link'. $this->drupalGet('ajax-test/link'); $settings = $this->drupalGetSettings(); $this->assertEqual($settings['ajax']['ajax-link']['url'], url('filter/tips')); @@ -120,7 +120,7 @@ class AJAXFrameworkTestCase extends AJAXTestCase { } /** - * Tests AJAX framework commands. + * Tests Ajax framework commands. */ class AJAXCommandsTestCase extends AJAXTestCase { public static function getInfo() { @@ -132,7 +132,7 @@ class AJAXCommandsTestCase extends AJAXTestCase { } /** - * Test the various AJAX Commands. + * Test the various Ajax Commands. */ function testAJAXCommands() { $form_path = 'ajax_forms_test_ajax_commands_form'; @@ -324,7 +324,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase { } /** - * Tests that AJAX-enabled forms work when multiple instances of the same form are on a page. + * Tests that Ajax-enabled forms work when multiple instances of the same form are on a page. */ class AJAXMultiFormTestCase extends AJAXTestCase { public static function getInfo() { @@ -338,7 +338,7 @@ class AJAXMultiFormTestCase extends AJAXTestCase { function setUp() { parent::setUp(array('form_test')); - // Create a multi-valued field for 'page' nodes to use for AJAX testing. + // Create a multi-valued field for 'page' nodes to use for Ajax testing. $field_name = 'field_ajax_test'; $field = array( 'field_name' => $field_name, @@ -363,7 +363,7 @@ class AJAXMultiFormTestCase extends AJAXTestCase { */ function testMultiForm() { // HTML IDs for elements within the field are potentially modified with - // each AJAX submission, but these variables are stable and help target the + // each Ajax submission, but these variables are stable and help target the // desired elements. $field_name = 'field_ajax_test'; $field_xpaths = array( @@ -399,7 +399,7 @@ class AJAXMultiFormTestCase extends AJAXTestCase { } /** - * Miscellaneous AJAX tests using ajax_test module. + * Miscellaneous Ajax tests using ajax_test module. */ class AJAXElementValidation extends AJAXTestCase { public static function getInfo() { @@ -411,12 +411,12 @@ class AJAXElementValidation extends AJAXTestCase { } /** - * Try to post an AJAX change to a form that has a validated element. + * Try to post an Ajax change to a form that has a validated element. * - * The drivertext field is AJAX-enabled. An additional field is not, but + * The drivertext field is Ajax-enabled. An additional field is not, but * is set to be a required field. In this test the required field is not * filled in, and we want to see if the activation of the "drivertext" - * AJAX-enabled field fails due to the required field being empty. + * Ajax-enabled field fails due to the required field being empty. */ function testAJAXElementValidation() { $web_user = $this->drupalCreateUser(); diff --git a/modules/simpletest/tests/ajax_forms_test.module b/modules/simpletest/tests/ajax_forms_test.module index 21784dfa3..c7dc36c6b 100644 --- a/modules/simpletest/tests/ajax_forms_test.module +++ b/modules/simpletest/tests/ajax_forms_test.module @@ -3,7 +3,7 @@ /** * @file - * Simpletest mock module for AJAX forms testing. + * Simpletest mock module for Ajax forms testing. */ /** @@ -67,7 +67,7 @@ function ajax_forms_test_simple_form($form, &$form_state) { } /** - * AJAX callback triggered by select. + * Ajax callback triggered by select. */ function ajax_forms_test_simple_form_select_callback($form, $form_state) { $commands = array(); @@ -77,7 +77,7 @@ function ajax_forms_test_simple_form_select_callback($form, $form_state) { } /** - * AJAX callback triggered by checkbox. + * Ajax callback triggered by checkbox. */ function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) { $commands = array(); @@ -88,7 +88,7 @@ function ajax_forms_test_simple_form_checkbox_callback($form, $form_state) { /** - * Form to display the AJAX Commands. + * Form to display the Ajax Commands. * @param $form * @param $form_state * @return unknown_type @@ -154,7 +154,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { ), ); - // Shows the AJAX 'css' command. + // Shows the Ajax 'css' command. $form['css_command_example'] = array( '#value' => t("Set the the '#box' div to be blue."), '#type' => 'submit', @@ -165,7 +165,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { ); - // Shows the AJAX 'data' command. But there is no use of this information, + // Shows the Ajax 'data' command. But there is no use of this information, // as this would require a javascript client to use the data. $form['data_command_example'] = array( '#value' => t("AJAX data command: Issue command."), @@ -176,7 +176,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="data_div">Data attached to this div.</div>', ); - // Shows the AJAX 'invoke' command. + // Shows the Ajax 'invoke' command. $form['invoke_command_example'] = array( '#value' => t("AJAX invoke command: Invoke addClass() method."), '#type' => 'submit', @@ -186,7 +186,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="invoke_div">Original contents</div>', ); - // Shows the AJAX 'html' command. + // Shows the Ajax 'html' command. $form['html_command_example'] = array( '#value' => t("AJAX html: Replace the HTML in a selector."), '#type' => 'submit', @@ -196,7 +196,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="html_div">Original contents</div>', ); - // Shows the AJAX 'insert' command. + // Shows the Ajax 'insert' command. $form['insert_command_example'] = array( '#value' => t("AJAX insert: Let client insert based on #ajax['method']."), '#type' => 'submit', @@ -207,7 +207,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="insert_div">Original contents</div>', ); - // Shows the AJAX 'prepend' command. + // Shows the Ajax 'prepend' command. $form['prepend_command_example'] = array( '#value' => t("AJAX 'prepend': Click to prepend something"), '#type' => 'submit', @@ -217,7 +217,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="prepend_div">Something will be prepended to this div. </div>', ); - // Shows the AJAX 'remove' command. + // Shows the Ajax 'remove' command. $form['remove_command_example'] = array( '#value' => t("AJAX 'remove': Click to remove text"), '#type' => 'submit', @@ -227,7 +227,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="remove_div"><div id="remove_text">text to be removed</div></div>', ); - // Shows the AJAX 'restripe' command. + // Shows the Ajax 'restripe' command. $form['restripe_command_example'] = array( '#type' => 'submit', '#value' => t("AJAX 'restripe' command"), @@ -242,7 +242,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { </div>', ); - // Demonstrates the AJAX 'settings' command. The 'settings' command has + // Demonstrates the Ajax 'settings' command. The 'settings' command has // nothing visual to "show", but it can be tested via SimpleTest and via // Firebug. $form['settings_command_example'] = array( @@ -262,7 +262,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { } /** - * AJAX callback for 'after'. + * Ajax callback for 'after'. */ function ajax_forms_test_advanced_commands_after_callback($form, $form_state) { $selector = '#after_div'; @@ -273,7 +273,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, $form_state) { } /** - * AJAX callback for 'alert'. + * Ajax callback for 'alert'. */ function ajax_forms_test_advanced_commands_alert_callback($form, $form_state) { $commands = array(); @@ -282,7 +282,7 @@ function ajax_forms_test_advanced_commands_alert_callback($form, $form_state) { } /** - * AJAX callback for 'append'. + * Ajax callback for 'append'. */ function ajax_forms_test_advanced_commands_append_callback($form, $form_state) { $selector = '#append_div'; @@ -292,7 +292,7 @@ function ajax_forms_test_advanced_commands_append_callback($form, $form_state) { } /** - * AJAX callback for 'before'. + * Ajax callback for 'before'. */ function ajax_forms_test_advanced_commands_before_callback($form, $form_state) { $selector = '#before_div'; @@ -303,14 +303,14 @@ function ajax_forms_test_advanced_commands_before_callback($form, $form_state) { } /** - * AJAX callback for 'changed'. + * Ajax callback for 'changed'. */ function ajax_forms_test_advanced_commands_changed_callback($form, $form_state) { $commands[] = ajax_command_changed('#changed_div'); return array('#type' => 'ajax', '#commands' => $commands); } /** - * AJAX callback for 'changed' with asterisk marking inner div. + * Ajax callback for 'changed' with asterisk marking inner div. */ function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, $form_state) { $commands = array(); @@ -319,7 +319,7 @@ function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, $for } /** - * AJAX callback for 'css'. + * Ajax callback for 'css'. */ function ajax_forms_test_advanced_commands_css_callback($form, $form_state) { $selector = '#css_div'; @@ -331,7 +331,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, $form_state) { } /** - * AJAX callback for 'data'. + * Ajax callback for 'data'. */ function ajax_forms_test_advanced_commands_data_callback($form, $form_state) { $selector = '#data_div'; @@ -342,7 +342,7 @@ function ajax_forms_test_advanced_commands_data_callback($form, $form_state) { } /** - * AJAX callback for 'invoke'. + * Ajax callback for 'invoke'. */ function ajax_forms_test_advanced_commands_invoke_callback($form, $form_state) { $commands = array(); @@ -351,7 +351,7 @@ function ajax_forms_test_advanced_commands_invoke_callback($form, $form_state) { } /** - * AJAX callback for 'html'. + * Ajax callback for 'html'. */ function ajax_forms_test_advanced_commands_html_callback($form, $form_state) { $commands = array(); @@ -360,7 +360,7 @@ function ajax_forms_test_advanced_commands_html_callback($form, $form_state) { } /** - * AJAX callback for 'insert'. + * Ajax callback for 'insert'. */ function ajax_forms_test_advanced_commands_insert_callback($form, $form_state) { $commands = array(); @@ -369,7 +369,7 @@ function ajax_forms_test_advanced_commands_insert_callback($form, $form_state) { } /** - * AJAX callback for 'prepend'. + * Ajax callback for 'prepend'. */ function ajax_forms_test_advanced_commands_prepend_callback($form, $form_state) { $commands = array(); @@ -378,7 +378,7 @@ function ajax_forms_test_advanced_commands_prepend_callback($form, $form_state) } /** - * AJAX callback for 'remove'. + * Ajax callback for 'remove'. */ function ajax_forms_test_advanced_commands_remove_callback($form, $form_state) { $commands = array(); @@ -387,7 +387,7 @@ function ajax_forms_test_advanced_commands_remove_callback($form, $form_state) { } /** - * AJAX callback for 'restripe'. + * Ajax callback for 'restripe'. */ function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) { $commands = array(); @@ -396,7 +396,7 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) } /** - * AJAX callback for 'settings'. + * Ajax callback for 'settings'. */ function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) { $commands = array(); @@ -407,12 +407,12 @@ function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) /** * This form and its related submit and callback functions demonstrate - * not validating another form element when a single AJAX element is triggered. + * not validating another form element when a single Ajax element is triggered. * - * The "drivertext" element is an AJAX-enabled textfield, free-form. + * The "drivertext" element is an Ajax-enabled textfield, free-form. * The "required_field" element is a textfield marked required. * - * The correct behavior is that the AJAX-enabled drivertext element should + * The correct behavior is that the Ajax-enabled drivertext element should * be able to trigger without causing validation of the "required_field". */ function ajax_forms_test_validation_form($form, &$form_state) { @@ -451,7 +451,7 @@ function ajax_forms_test_validation_form_submit($form, $form_state) { } /** - * AJAX callback for the 'drivertext' element of the validation form. + * Ajax callback for the 'drivertext' element of the validation form. */ function ajax_forms_test_validation_form_callback($form, $form_state) { drupal_set_message("ajax_forms_test_validation_form_callback invoked"); diff --git a/modules/simpletest/tests/ajax_test.module b/modules/simpletest/tests/ajax_test.module index 70f87f512..d4e9c817e 100644 --- a/modules/simpletest/tests/ajax_test.module +++ b/modules/simpletest/tests/ajax_test.module @@ -3,7 +3,7 @@ /** * @file - * Helper module for AJAX framework tests. + * Helper module for Ajax framework tests. */ /** @@ -45,7 +45,7 @@ function ajax_test_render() { } /** - * Menu callback; Returns AJAX element with #error property set. + * Menu callback; Returns Ajax element with #error property set. */ function ajax_test_error() { $message = ''; diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index a73ac16c2..279b53e67 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -1132,13 +1132,13 @@ class FormsRebuildTestCase extends DrupalWebTestCase { } /** - * Tests that a form's action is retained after an AJAX submission. + * Tests that a form's action is retained after an Ajax submission. * - * The 'action' attribute of a form should not change after an AJAX submission - * followed by a non-AJAX submission, which triggers a validation error. + * The 'action' attribute of a form should not change after an Ajax submission + * followed by a non-Ajax submission, which triggers a validation error. */ function testPreserveFormActionAfterAJAX() { - // Create a multi-valued field for 'page' nodes to use for AJAX testing. + // Create a multi-valued field for 'page' nodes to use for Ajax testing. $field_name = 'field_ajax_test'; $field = array( 'field_name' => $field_name, @@ -1157,14 +1157,14 @@ class FormsRebuildTestCase extends DrupalWebTestCase { $this->web_user = $this->drupalCreateUser(array('create page content')); $this->drupalLogin($this->web_user); - // Get the form for adding a 'page' node. Submit an "add another item" AJAX + // Get the form for adding a 'page' node. Submit an "add another item" Ajax // submission and verify it worked by ensuring the updated page has two text // field items in the field for which we just added an item. $this->drupalGet('node/add/page'); $this->drupalPostAJAX(NULL, array(), array('field_ajax_test_add_more' => t('Add another item')), 'system/ajax', array(), array(), 'page-node-form'); $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, t('AJAX submission succeeded.')); - // Submit the form with the non-AJAX "Save" button, leaving the title field + // Submit the form with the non-Ajax "Save" button, leaving the title field // blank to trigger a validation error, and ensure that a validation error // occurred, because this test is for testing what happens when a form is // re-rendered without being re-built, which is what happens when there's diff --git a/modules/simpletest/tests/form_test.file.inc b/modules/simpletest/tests/form_test.file.inc index 808863ede..5a637baf8 100644 --- a/modules/simpletest/tests/form_test.file.inc +++ b/modules/simpletest/tests/form_test.file.inc @@ -11,7 +11,7 @@ * hook_menu(). */ function form_test_load_include_menu($form, &$form_state) { - // Submit the form via AJAX. That way the FAPI has to care about including + // Submit the form via Ajax. That way the FAPI has to care about including // the file specified in hook_menu(). $ajax_wrapper_id = drupal_html_id('form-test-load-include-menu-ajax-wrapper'); $form['ajax_wrapper'] = array( @@ -43,7 +43,7 @@ function form_test_load_include_submit($form, $form_state) { function form_test_load_include_menu_ajax($form) { // We don't need to return anything, since #ajax['method'] is 'append', which // does not remove the original #ajax['wrapper'] element, and status messages - // are automatically added by the AJAX framework as long as there's a wrapper + // are automatically added by the Ajax framework as long as there's a wrapper // element to add them to. return ''; } |