summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 05:13:45 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 05:13:45 +0000
commita0cca9a472b7764f54ad692c8e7943278f09a0be (patch)
treefc54501632883cd88221efea2ba1eabf179d294b /modules
parent39c3344ac6bb252d4f5f9aa2afd13c2cf989562d (diff)
downloadbrdo-a0cca9a472b7764f54ad692c8e7943278f09a0be.tar.gz
brdo-a0cca9a472b7764f54ad692c8e7943278f09a0be.tar.bz2
#259368 by Rob Loach, mfer, and sun: Allow drupal_add_css() to add/aggregate inline CSS.
Diffstat (limited to 'modules')
-rw-r--r--modules/simpletest/tests/common.test46
1 files changed, 44 insertions, 2 deletions
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 0f3fd2cbb..2fa9b1687 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -188,12 +188,12 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
return array(
'name' => t('Cascading stylesheets'),
'description' => t('Tests adding various cascading stylesheets to the page.'),
- 'group' => t('System')
+ 'group' => t('System'),
);
}
function setUp() {
- parent::setUp();
+ parent::setUp('php');
// Reset drupal_add_css() before each test.
drupal_add_css(NULL, 'reset');
}
@@ -230,6 +230,48 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
drupal_add_css($css);
$this->assertTrue(strpos(drupal_get_css(), $css) > 0, t('Rendered CSS includes the added stylesheet.'));
}
+
+ /**
+ * Tests rendering inline stylesheets with preprocessing on.
+ */
+ function testRenderInlinePreprocess() {
+ $css = 'body { padding: 0px; }';
+ $css_preprocessed = '<style type="text/css">' . drupal_load_stylesheet_content($css, TRUE) . '</style>';
+ drupal_add_css($css, 'inline');
+ $css = drupal_get_css();
+ $this->assertEqual($css, $css_preprocessed, t('Rendering preprocessed inline CSS adds it to the page.'));
+ }
+
+ /**
+ * Tests rendering inline stylesheets with preprocessing off.
+ */
+ function testRenderInlineNoPreprocess() {
+ $css = 'body { padding: 0px; }';
+ drupal_add_css($css, array('type' => 'inline', 'preprocess' => FALSE));
+ $this->assertTrue(strpos(drupal_get_css(), $css) > 0, t('Rendering non-preprocessed inline CSS adds it to the page.'));
+ }
+
+ /**
+ * Tests rendering inline stylesheets through a full page request.
+ */
+ function testRenderInlineFullPage() {
+ $css = 'body { padding: 0px; }';
+ $compressed_css = '<style type="text/css">' . drupal_load_stylesheet_content($css, TRUE) . '</style>';
+
+ // Create a node, using the PHP filter that tests drupal_add_css().
+ $settings = array(
+ 'type' => 'page',
+ 'format' => 3, // PHP filter.
+ 'body_format' => 3,
+ 'body' => t('This tests the inline CSS!') . "<?php drupal_add_css('$css', 'inline'); ?>",
+ 'promote' => 1,
+ );
+ $node = $this->drupalCreateNode($settings);
+
+ // Fetch the page.
+ $this->drupalGet('node/' . $node->nid);
+ $this->assertRaw($compressed_css, t('Inline stylesheets appear in the full page rendering.'));
+ }
}
/**