summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-08-06 01:01:47 -0400
committerDavid Rothstein <drothstein@gmail.com>2013-08-06 01:01:47 -0400
commit81e607406c04078df18776b8898f83b1dfc9e618 (patch)
treec628a4f9fb05c5d432fdf07f85c7cd7adc21b700 /modules
parent19e65b966c79e7061827ef5f21ac67cd1159806c (diff)
downloadbrdo-81e607406c04078df18776b8898f83b1dfc9e618.tar.gz
brdo-81e607406c04078df18776b8898f83b1dfc9e618.tar.bz2
Issue #2028643 by hass, tstoeckler: Fixed CSS files order is incorrect in RTL.
Diffstat (limited to 'modules')
-rw-r--r--modules/locale/locale.module2
-rw-r--r--modules/locale/locale.test45
2 files changed, 46 insertions, 1 deletions
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index b60c53120..768fead67 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -972,7 +972,7 @@ function locale_css_alter(&$css) {
// Replicate the same item, but with the RTL path and a little larger
// weight so that it appears directly after the original CSS file.
$item['data'] = $rtl_path;
- $item['weight'] += 0.01;
+ $item['weight'] += 0.0001;
$css[$rtl_path] = $item;
}
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index d9caa9e02..711832f2b 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -3096,3 +3096,48 @@ class LocaleLanguageNegotiationInfoFunctionalTest extends DrupalWebTestCase {
}
}
+/**
+ * Functional tests for CSS alter functions.
+ */
+class LocaleCSSAlterTest extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'CSS altering',
+ 'description' => 'Test CSS alter functions.',
+ 'group' => 'Locale',
+ );
+ }
+
+ function setUp() {
+ parent::setUp('locale');
+ }
+
+ /**
+ * Verifies that -rtl.css file is added directly after LTR .css file.
+ */
+ function testCSSFilesOrderInRTLMode() {
+ global $base_url;
+
+ // User to add and remove language.
+ $admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
+
+ // Log in as admin.
+ $this->drupalLogin($admin_user);
+
+ // Install the Arabic language (which is RTL) and configure as the default.
+ $edit = array();
+ $edit['langcode'] = 'ar';
+ $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
+
+ $edit = array();
+ $edit['site_default'] = 'ar';
+ $this->drupalPost(NULL, $edit, t('Save configuration'));
+
+ // Verify that the -rtl.css file is added directly after LTR file.
+ $this->drupalGet('');
+ $query_string = '?' . variable_get('css_js_query_string', '0');
+ $this->assertRaw('@import url("' . $base_url . '/modules/system/system.base.css' . $query_string . '");' . "\n" . '@import url("' . $base_url . '/modules/system/system.base-rtl.css' . $query_string . '");' . "\n", 'CSS: system.base-rtl.css is added directly after system.base.css.');
+ $this->assertRaw('@import url("' . $base_url . '/modules/system/system.menus.css' . $query_string . '");' . "\n" . '@import url("' . $base_url . '/modules/system/system.menus-rtl.css' . $query_string . '");' . "\n", 'CSS: system.menus-rtl.css is added directly after system.menus.css.');
+ $this->assertRaw('@import url("' . $base_url . '/modules/system/system.messages.css' . $query_string . '");' . "\n" . '@import url("' . $base_url . '/modules/system/system.messages-rtl.css' . $query_string . '");' . "\n", 'CSS: system.messages-rtl.css is added directly after system.messages.css.');
+ }
+}