0
0
Fork 0

Fix language sorting in settings (#27158)

This commit is contained in:
gunchleoc 2023-10-04 08:23:50 +01:00 committed by GitHub
parent c676bc91e9
commit 68ec1d180a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 2 deletions

View file

@ -60,4 +60,30 @@ describe LanguagesHelper do
end
end
end
describe 'sorted_locales' do
context 'when sorting with native name' do
it 'returns Suomi after Gàidhlig' do
expect(described_class.sorted_locale_keys(%w(fi gd))).to eq(%w(gd fi))
end
end
context 'when sorting with diacritics' do
it 'returns Íslensk before Suomi' do
expect(described_class.sorted_locale_keys(%w(fi is))).to eq(%w(is fi))
end
end
context 'when sorting with non-Latin' do
it 'returns Suomi before Amharic' do
expect(described_class.sorted_locale_keys(%w(am fi))).to eq(%w(fi am))
end
end
context 'when sorting with local variants' do
it 'returns variant in-line' do
expect(described_class.sorted_locale_keys(%w(en eo en-GB))).to eq(%w(en en-GB eo))
end
end
end
end