From 3cbd47d1458b9914d0ede84fd31d4ecc0c8e684b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 21 Oct 2010 19:31:39 +0000 Subject: - Patch #647228 by sun, katbailey, Rob Loach: links are needlessly unable to fully participate in D7 AJAX framework features. --- modules/simpletest/tests/ajax.test | 8 ++++++++ modules/simpletest/tests/ajax_test.module | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'modules/simpletest') diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test index 961188bc5..2788d4f90 100644 --- a/modules/simpletest/tests/ajax.test +++ b/modules/simpletest/tests/ajax.test @@ -59,6 +59,8 @@ class AJAXTestCase extends DrupalWebTestCase { * Tests primary AJAX framework functions. */ class AJAXFrameworkTestCase extends AJAXTestCase { + protected $profile = 'testing'; + public static function getInfo() { return array( 'name' => 'AJAX framework', @@ -84,6 +86,12 @@ class AJAXFrameworkTestCase extends AJAXTestCase { 'settings' => array('basePath' => base_path(), 'ajax' => 'test'), ); $this->assertCommand($commands, $expected, t('ajax_render() loads settings added with drupal_add_js().')); + + // 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')); + $this->assertEqual($settings['ajax']['ajax-link']['wrapper'], 'block-system-main'); } /** diff --git a/modules/simpletest/tests/ajax_test.module b/modules/simpletest/tests/ajax_test.module index cc8e6e8fe..70f87f512 100644 --- a/modules/simpletest/tests/ajax_test.module +++ b/modules/simpletest/tests/ajax_test.module @@ -24,6 +24,11 @@ function ajax_test_menu() { 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); + $items['ajax-test/link'] = array( + 'title' => 'AJAX Link', + 'page callback' => 'ajax_test_link', + 'access callback' => TRUE, + ); return $items; } @@ -49,3 +54,19 @@ function ajax_test_error() { } return array('#type' => 'ajax', '#error' => $message); } + +/** + * Menu callback; Renders a #type link with #ajax. + */ +function ajax_test_link() { + $build['link'] = array( + '#type' => 'link', + '#title' => 'Show help', + '#href' => 'filter/tips', + '#ajax' => array( + 'wrapper' => 'block-system-main', + ), + ); + return $build; +} + -- cgit v1.2.3