Feature #43506 ยป html-dir-attr.patch
| app/views/layouts/base.html.erb | ||
|---|---|---|
| 1 | 1 |
<!DOCTYPE html> |
| 2 |
<html lang="<%= current_language %>"> |
|
| 2 |
<html lang="<%= current_language %>" dir="<%= l(:direction) %>">
|
|
| 3 | 3 |
<head> |
| 4 | 4 |
<meta charset="utf-8" /> |
| 5 | 5 |
<title><%= html_title %></title> |
| test/integration/application_test.rb | ||
|---|---|---|
| 31 | 31 |
assert_select 'h2', :text => 'Projets' |
| 32 | 32 |
assert_equal :fr, current_language |
| 33 | 33 |
assert_select "html[lang=?]", "fr" |
| 34 |
assert_select "html[dir=?]", "ltr" |
|
| 34 | 35 | |
| 35 | 36 |
# then an italien user |
| 36 | 37 |
get '/projects', :headers => {'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'}
|
| ... | ... | |
| 38 | 39 |
assert_select 'h2', :text => 'Progetti' |
| 39 | 40 |
assert_equal :it, current_language |
| 40 | 41 |
assert_select "html[lang=?]", "it" |
| 42 |
assert_select "html[dir=?]", "ltr" |
|
| 43 | ||
| 44 |
# html[dir] should be "rtl" for right-to-left scripts |
|
| 45 |
get '/projects', :headers => {'HTTP_ACCEPT_LANGUAGE' => 'ar'}
|
|
| 46 |
assert_response :success |
|
| 47 |
assert_select "html[dir=?]", "rtl" |
|
| 41 | 48 | |
| 42 | 49 |
# not a supported language: default language should be used |
| 43 | 50 |
get '/projects', :headers => {'HTTP_ACCEPT_LANGUAGE' => 'zz'}
|
| 44 | 51 |
assert_response :success |
| 45 | 52 |
assert_select 'h2', :text => 'Projects' |
| 46 | 53 |
assert_select "html[lang=?]", "en" |
| 54 |
assert_select "html[dir=?]", "ltr" |
|
| 47 | 55 |
end |
| 48 | 56 | |
| 49 | 57 |
def test_token_based_access_should_not_start_session |