diff --git a/includes/common.inc b/includes/common.inc
index 20cc82b..48ac34e 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -4141,7 +4141,12 @@ function drupal_region_class($region) {
* happened later in the page request gets added to the page after one for
* which drupal_add_js() happened earlier in the page request.
* - defer: If set to TRUE, the defer attribute is set on the ';
+ $expected_2 = '';
+
+ $this->assertTrue(strpos($javascript, $expected_1) > 0, 'Rendered external JavaScript with correct defer attribute.');
+ $this->assertTrue(strpos($javascript, $expected_2) > 0, 'Rendered internal JavaScript with correct defer attribute.');
+ }
+
+ /**
+ * Tests that attributes are maintained when JS aggregation is enabled.
+ */
+ function testAggregatedAttributes() {
+ // Enable aggregation.
+ variable_set('preprocess_js', TRUE);
+
+ $default_query_string = variable_get('css_js_query_string', '0');
+
+ drupal_add_js('http://example.com/script.js', array('type' => 'external', 'attributes' => array('defer' => 'defer')));
+ drupal_add_js('misc/collapse.js', array('attributes' => array('defer' => 'defer')));
+ $javascript = drupal_get_js();
+
+ $expected_1 = '';
+ $expected_2 = '';
+
+ $this->assertTrue(strpos($javascript, $expected_1) > 0, 'Rendered external JavaScript with correct defer attribute with aggregation enabled.');
+ $this->assertTrue(strpos($javascript, $expected_2) > 0, 'Rendered internal JavaScript with correct defer attribute with aggregation enabled.');
+ }
+
+ /**
* Test altering a JavaScript's weight via hook_js_alter().
*
* @see simpletest_js_alter()