From fb9c1df0b942df39115a9130dfa76e2b3fd33217 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 5 Sep 2010 02:21:38 +0000 Subject: - Patch #328357 by bleen18, sun, skilip, alanburke, jenlampton, manarth, fgm, tstoeckler: allow module .info files to add CSS/JS. --- modules/simpletest/tests/common.test | 21 +++++++++++++++++++++ modules/simpletest/tests/common_test.info | 2 ++ 2 files changed, 23 insertions(+) (limited to 'modules/simpletest') diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 0f44bea89..b23e8e53c 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -580,6 +580,27 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase { $this->assertEqual(array(), drupal_add_css(), t('Default CSS is empty.')); } + /** + * Test that stylesheets in module .info files are loaded. + */ + function testModuleInfo() { + $this->drupalGet(''); + + // Verify common_test.css in a STYLE media="all" tag. + $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array( + ':media' => 'all', + ':filename' => 'tests/common_test.css', + )); + $this->assertTrue(count($elements), "Stylesheet with media 'all' in module .info file found."); + + // Verify common_test.print.css in a STYLE media="print" tag. + $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array( + ':media' => 'print', + ':filename' => 'tests/common_test.print.css', + )); + $this->assertTrue(count($elements), "Stylesheet with media 'print' in module .info file found."); + } + /** * Tests adding a file stylesheet. */ diff --git a/modules/simpletest/tests/common_test.info b/modules/simpletest/tests/common_test.info index 81a15472a..7b27416ae 100644 --- a/modules/simpletest/tests/common_test.info +++ b/modules/simpletest/tests/common_test.info @@ -5,4 +5,6 @@ package = Testing version = VERSION core = 7.x files[] = common_test.module +stylesheets[all][] = common_test.css +stylesheets[print][] = common_test.print.css hidden = TRUE -- cgit v1.2.3