mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
DEV: Improve tests to assert that the right HTML is generated.
This commit is contained in:
parent
dc292d4598
commit
b64d760bb3
@ -259,7 +259,6 @@ describe CookedPostProcessor do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "responsive images" do
|
context "responsive images" do
|
||||||
|
|
||||||
before { SiteSetting.responsive_post_image_sizes = "1|1.5|3" }
|
before { SiteSetting.responsive_post_image_sizes = "1|1.5|3" }
|
||||||
|
|
||||||
it "includes responsive images on demand" do
|
it "includes responsive images on demand" do
|
||||||
@ -289,7 +288,7 @@ describe CookedPostProcessor do
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Fake a loading image
|
# Fake a loading image
|
||||||
OptimizedImage.create!(
|
optimized_image = OptimizedImage.create!(
|
||||||
url: 'http://a.b.c/10x10.png',
|
url: 'http://a.b.c/10x10.png',
|
||||||
width: CookedPostProcessor::LOADING_SIZE,
|
width: CookedPostProcessor::LOADING_SIZE,
|
||||||
height: CookedPostProcessor::LOADING_SIZE,
|
height: CookedPostProcessor::LOADING_SIZE,
|
||||||
@ -303,10 +302,12 @@ describe CookedPostProcessor do
|
|||||||
|
|
||||||
cpp.add_to_size_cache(upload.url, 2000, 1500)
|
cpp.add_to_size_cache(upload.url, 2000, 1500)
|
||||||
cpp.post_process_images
|
cpp.post_process_images
|
||||||
expect(cpp.loading_image(upload)).to be_present
|
|
||||||
|
|
||||||
|
html = cpp.html
|
||||||
|
|
||||||
|
expect(html).to include(%Q|data-small-upload="#{optimized_image.url}"|)
|
||||||
# 1.5x is skipped cause we have a missing thumb
|
# 1.5x is skipped cause we have a missing thumb
|
||||||
expect(cpp.html).to include('srcset="http://a.b.c/666x500.jpg, http://a.b.c/1998x1500.jpg 3x"')
|
expect(html).to include('srcset="http://a.b.c/666x500.jpg, http://a.b.c/1998x1500.jpg 3x"')
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't include response images for cropped images" do
|
it "doesn't include response images for cropped images" do
|
||||||
|
Loading…
Reference in New Issue
Block a user