diff options
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/simpletest.module | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 50 |
2 files changed, 51 insertions, 1 deletions
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index 372ad1f3f..c1752b84f 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -199,7 +199,7 @@ function simpletest_test_form() { } function theme_simpletest_test_table($table) { - drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css', 'module'); + drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css'); drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js', 'module'); // Create header for test selection table. diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 74e053cf9..6a82018db 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -115,6 +115,56 @@ class DrupalTagsHandlingTestCase extends DrupalWebTestCase { } /** + * Test the Drupal CSS system. + */ +class CascadingStylesheetsTestCase extends DrupalWebTestCase { + /** + * Implementation of getInfo(). + */ + function getInfo() { + return array( + 'name' => t('Cascading stylesheets'), + 'description' => t('Tests adding various cascading stylesheets to the page.'), + 'group' => t('System') + ); + } + + /** + * Implementation of setUp(). + */ + function setUp() { + parent::setUp(); + // Reset drupal_add_css() before each test. + drupal_add_css(NULL, NULL, TRUE); + } + + /** + * Check default stylesheets as empty. + */ + function testDefault() { + $this->assertEqual(array(), drupal_add_css(), t('Default CSS is empty.')); + } + + /** + * Tests adding a file stylesheet. + */ + function testAddFile() { + $path = drupal_get_path('module', 'simpletest') . '/simpletest.css'; + $css = drupal_add_css($path); + $this->assertEqual($css['all']['module'][$path], TRUE, t('Adding a CSS file caches it properly.')); + } + + /** + * Tests rendering the stylesheets. + */ + function testRenderFile() { + $css = drupal_get_path('module', 'simpletest') . '/simpletest.css'; + drupal_add_css($css); + $this->assertTrue(strpos(drupal_get_css(), $css) > 0, t('Rendered CSS includes the added stylesheet.')); + } +} + +/** * Test drupal_http_request(). */ class DrupalHTTPRequestTestCase extends DrupalWebTestCase { |