diff options
author | David Rothstein <drothstein@gmail.com> | 2014-11-03 00:39:48 -0500 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2014-11-03 00:39:48 -0500 |
commit | 62e874b348fe64490952a12f419164e26ea98d21 (patch) | |
tree | 1832d4d5e6c6077c54813a1dc31d400f8f80758a /modules/simpletest | |
parent | 0c8dc6ea062cd7595a7b6fbd02fb0f0294ccecef (diff) | |
download | brdo-62e874b348fe64490952a12f419164e26ea98d21.tar.gz brdo-62e874b348fe64490952a12f419164e26ea98d21.tar.bz2 |
Issue #1071818 by JeremyFrench, nod_, Cottser, gielfeldt, xjm, anthbel, reglogge, NROTC_Webmaster, kristofferwiklund, lliss, sun | sepgil: Fixed Lazy-loading CSS fails in IE.
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/ajax.test | 8 | ||||
-rw-r--r-- | modules/simpletest/tests/ajax_forms_test.module | 18 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 4 |
4 files changed, 32 insertions, 0 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 39dacfa1d..8ecddb50b 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -2301,6 +2301,8 @@ class DrupalWebTestCase extends DrupalTestCase { break; case 'restripe': break; + case 'add_css': + break; } } $content = $dom->saveHTML(); diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test index a0c7be8a2..c38a325fb 100644 --- a/modules/simpletest/tests/ajax.test +++ b/modules/simpletest/tests/ajax.test @@ -368,6 +368,14 @@ class AJAXCommandsTestCase extends AJAXTestCase { 'settings' => array('ajax_forms_test' => array('foo' => 42)), ); $this->assertCommand($commands, $expected, "'settings' AJAX command issued with correct data"); + + // Tests the 'add_css' command. + $commands = $this->drupalPostAJAX($form_path, $edit, array('op' => t("AJAX 'add_css' command"))); + $expected = array( + 'command' => 'add_css', + 'data' => 'my/file.css', + ); + $this->assertCommand($commands, $expected, "'add_css' AJAX command issued with correct data"); } } diff --git a/modules/simpletest/tests/ajax_forms_test.module b/modules/simpletest/tests/ajax_forms_test.module index 28404224e..260d9112e 100644 --- a/modules/simpletest/tests/ajax_forms_test.module +++ b/modules/simpletest/tests/ajax_forms_test.module @@ -254,6 +254,15 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { ), ); + // Shows the Ajax 'add_css' command. + $form['add_css_command_example'] = array( + '#type' => 'submit', + '#value' => t("AJAX 'add_css' command"), + '#ajax' => array( + 'callback' => 'ajax_forms_test_advanced_commands_add_css_callback', + ), + ); + $form['submit'] = array( '#type' => 'submit', '#value' => t('Submit'), @@ -407,6 +416,15 @@ function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) } /** + * Ajax callback for 'add_css'. + */ +function ajax_forms_test_advanced_commands_add_css_callback($form, $form_state) { + $commands = array(); + $commands[] = ajax_command_add_css('my/file.css'); + return array('#type' => 'ajax', '#commands' => $commands); +} + +/** * This form and its related submit and callback functions demonstrate * not validating another form element when a single Ajax element is triggered. * diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 6e03253a6..21fe833d5 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -661,6 +661,10 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase { drupal_add_css($css); $styles = drupal_get_css(); $this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.'); + // Verify that newlines are properly added inside style tags. + $query_string = variable_get('css_js_query_string', '0'); + $css_processed = "<style type=\"text/css\" media=\"all\">\n@import url(\"" . check_plain(file_create_url($css)) . "?" . $query_string ."\");\n</style>"; + $this->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.'); } /** |