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:
@ -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
|
||||
|
Reference in New Issue
Block a user