FIX: Display large/broken image placeholders for image oneboxes

This commit is contained in:
Vinoth Kannan
2018-10-07 17:40:15 +05:30
parent 83bf641292
commit c499872597
2 changed files with 23 additions and 4 deletions

View File

@ -531,6 +531,24 @@ describe CookedPostProcessor do
expect(cpp.doc.to_s).to eq("<p><img class=\"onebox\" src=\"#{upload.url}\" width=\"\" height=\"\"></p>")
end
it "replaces large image placeholder" do
url = 'https://image.com/my-avatar'
image_url = 'https://image.com/avatar.png'
Oneboxer.stubs(:onebox).with(url, anything).returns("<img class='onebox' src='#{image_url}' />")
post = Fabricate(:post, raw: url)
post.custom_fields[Post::LARGE_IMAGES] = "[\"//image.com/avatar.png\"]"
post.save_custom_fields
cpp = CookedPostProcessor.new(post, invalidate_oneboxes: true)
cpp.post_process_oneboxes
cpp.post_process_images
expect(cpp.doc.to_s).to match(/<div class="large-image-placeholder">/)
end
end
context ".post_process_oneboxes removes nofollow if add_rel_nofollow_to_user_content is disabled" do