From 5a23b3fdb970bb0c3e79f47ba9296455d237d9f0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 4 Oct 2010 17:46:01 +0000 Subject: - Patch #561858 by effulgentsia, sun, rfay, Nick_vh, merlinofchaos, katbailey, dereine, tstoeckler: drupal_add_js() and drupal_add_css() to work for AJAX requests too by adding lazy-load to AJAX framework. --- modules/simpletest/tests/ajax_forms_test.module | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'modules/simpletest/tests/ajax_forms_test.module') diff --git a/modules/simpletest/tests/ajax_forms_test.module b/modules/simpletest/tests/ajax_forms_test.module index fa23acda8..531c703fd 100644 --- a/modules/simpletest/tests/ajax_forms_test.module +++ b/modules/simpletest/tests/ajax_forms_test.module @@ -217,7 +217,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '
text to be removed
', ); - // Show off the AJAX 'restripe' command. + // Shows the AJAX 'restripe' command. $form['restripe_command_example'] = array( '#type' => 'submit', '#value' => t("AJAX 'restripe' command"), @@ -230,8 +230,17 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { second row ', + ); - + // 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( + '#type' => 'submit', + '#value' => t("AJAX 'settings' command"), + '#ajax' => array( + 'callback' => 'ajax_forms_test_advanced_commands_settings_callback', + ), ); $form['submit'] = array( @@ -367,7 +376,15 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) return array('#type' => 'ajax', '#commands' => $commands); } - +/** + * AJAX callback for 'settings'. + */ +function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) { + $commands = array(); + $setting['ajax_forms_test']['foo'] = 42; + $commands[] = ajax_command_settings($setting); + return array('#type' => 'ajax', '#commands' => $commands); +} /** * This form and its related submit and callback functions demonstrate -- cgit v1.2.3