### Eclipse Workspace Patch 1.0
#P dh
Index: modules/simpletest/tests/theme.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/theme.test,v
retrieving revision 1.1
diff -u -r1.1 theme.test
--- modules/simpletest/tests/theme.test	15 Apr 2009 20:45:46 -0000	1.1
+++ modules/simpletest/tests/theme.test	27 Apr 2009 20:55:15 -0000
@@ -52,3 +52,45 @@
   }
 
 }
+
+/**
+ * Unit tests for theme functions
+ */
+class ThemeTableUnitTest extends DrupalWebTestCase {
+
+  function getInfo() {
+    return array(
+      'name' => t('Theme Table'),
+      'description' => t('Tests built-in theme functions.'),
+      'group' => t('Theme'),
+    );
+  }
+  
+  /**
+   * No tableheader.js is included when $sticky is FALSE
+   */
+  function testThemeTableNoStickyHeaders() {
+    $header = array('one', 'two', 'three');
+    $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
+    $attributes = array();
+    $caption = NULL;
+    $colgroups = array();
+    $output = theme('table', $header, $rows, $attributes, $caption, $colgroups, FALSE);
+    $js = drupal_add_js();
+    $this->assertFalse(isset($js['misc/tableheader.js']), t('tableheader.js was not included when $sticky = FALSE.'));
+    $this->assertFalse(strpos($output, 'sticky-enabled'), t('Table does not have sticky-enabled class applied when $sticky = FALSE.'));
+  }
+  
+  /**
+   * tableheader.js is included by default
+   */
+  function testThemeTableStickyHeaders() {
+    $header = array('one', 'two', 'three');
+    $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
+    $output = theme('table', $header, $rows);
+    $js = drupal_add_js();
+    $this->assertTrue(isset($js['misc/tableheader.js']), t('tableheader.js was included when $sticky = TRUE.'));
+    $this->assertTrue(strpos($output, 'sticky-enabled'), t('Table does not have sticky-enabled class applied when $sticky = TRUE.'));
+  }
+
+}
