FIX: Do not add lightbox to onebox images (#6479)

This commit is contained in:
Vinoth Kannan
2018-10-11 03:27:21 +05:30
committed by Sam
parent a566ed42ae
commit 59be289084
2 changed files with 37 additions and 8 deletions

View File

@@ -178,6 +178,22 @@ describe CookedPostProcessor do
expect(cpp).to be_dirty
end
describe 'when image is inside onebox' do
let(:url) { 'https://image.com/my-avatar' }
let(:post) { Fabricate(:post, raw: url) }
before do
Oneboxer.stubs(:onebox).with(url, anything).returns("<img class='onebox' src='/uploads/default/original/1X/1234567890123456.jpg' />")
end
it 'should not add lightbox' do
cpp.post_process_oneboxes
cpp.post_process_images
expect(cpp.html).to match_html("<p><img class=\"onebox\" src=\"/uploads/default/original/1X/1234567890123456.jpg\" width=\"690\"\ height=\"788\"></p>")
end
end
describe 'when image is an svg' do
let(:post) do
Fabricate(:post, raw: '<img src="/uploads/default/original/1X/1234567890123456.svg">')