Add tests for StreamEntriesHelper#rtl? (#2286)
We used some random Arabic characters to test that the various RTL conditions got triggered.
This commit is contained in:
parent
af7d02da5d
commit
974ac467de
2 changed files with 29 additions and 9 deletions
|
@ -14,4 +14,22 @@ RSpec.describe StreamEntriesHelper, type: :helper do
|
|||
expect(helper.display_name(account)).to eq "Username"
|
||||
end
|
||||
end
|
||||
|
||||
describe '#rtl?' do
|
||||
it 'is false if text is empty' do
|
||||
expect(helper).not_to be_rtl ''
|
||||
end
|
||||
|
||||
it 'is false if there are no right to left characters' do
|
||||
expect(helper).not_to be_rtl 'hello world'
|
||||
end
|
||||
|
||||
it 'is false if right to left characters are fewer than 1/3 of total text' do
|
||||
expect(helper).not_to be_rtl 'hello ݟ world'
|
||||
end
|
||||
|
||||
it 'is true if right to left characters are greater than 1/3 of total text' do
|
||||
expect(helper).to be_rtl 'aaݟ'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue