Fix: make NEWLINE_TAGS_RE regex be case insentitive for both <br> and <BR> edge case. (#40079)
This commit is contained in:
1 parent
5f346964c6
commit
7ec26f32dc
2 files changed
+3
-3
No files matched your search
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PlainTextFormatter
|
||||
NEWLINE_TAGS_RE = %r{(<br />|<br>|</p>)+}
|
||||
NEWLINE_TAGS_RE = %r{(<br />|<br>|</p>)+}i
|
||||
|
||||
attr_reader :text, :local
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ RSpec.describe PlainTextFormatter do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when text contains <p> tags' do
|
||||
let(:status) { Fabricate.build(:status, account: remote_account, text: '<p>Lorem</p><p>ipsum</p>') }
|
||||
context 'when text contains mixed case <p> tags' do
|
||||
let(:status) { Fabricate.build(:status, account: remote_account, text: '<P>Lorem</P><p>ipsum</p>') }
|
||||
|
||||
it 'inserts a newline' do
|
||||
expect(subject).to eq "Lorem\nipsum"
|
||||
|
||||
Reference in new issue
Block a user