FEATURE: Serve RTL versions of admin and plugins CSS bundles for RTL locales (#21876)

Prior to this commit, we didn't have RTL versions of our admin and plugins CSS bundles and we always served LTR versions of those bundles even when users used an RTL locale, causing admin and plugins UI elements to never look as good as when an LTR locale was used. Example of UI issues prior to this commit were: missing margins, borders on the wrong side and buttons too close to each other etc.

This commit creates an RTL version for the admin CSS bundle as well as RTL bundles for all the installed plugins and serves those RTL bundles to users/sites who use RTL locales.
This commit is contained in:
Osama Sayegh
2023-06-01 05:27:11 +03:00
committed by GitHub
parent d10a050da2
commit c2fcd55a80
15 changed files with 187 additions and 58 deletions

View File

@ -89,6 +89,20 @@ RSpec.describe Stylesheet::Compiler do
expect(css).to include("background:")
end
context "with the `rtl` option" do
it "generates an RTL version of the plugin CSS if the option is true" do
css, _ = Stylesheet::Compiler.compile_asset("scss_plugin", theme_id: theme.id, rtl: true)
expect(css).to include(".pull-left{float:right}")
expect(css).not_to include(".pull-left{float:left}")
end
it "returns an unchanged version of the plugin CSS" do
css, _ = Stylesheet::Compiler.compile_asset("scss_plugin", theme_id: theme.id, rtl: false)
expect(css).to include(".pull-left{float:left}")
expect(css).not_to include(".pull-left{float:right}")
end
end
it "supports SCSS imports" do
css, _map = Stylesheet::Compiler.compile_asset("scss_plugin", theme_id: theme.id)