mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: Check that the node has a src attr when getting size (#19696)
This commit is contained in:
@ -870,10 +870,17 @@ RSpec.describe CookedPostProcessor do
|
||||
let(:post) { build(:post) }
|
||||
let(:cpp) { CookedPostProcessor.new(post) }
|
||||
|
||||
let(:image_sizes) do
|
||||
{ "http://my.discourse.org/image.png" => { "width" => 111, "height" => 222 } }
|
||||
end
|
||||
|
||||
it "returns the size" do
|
||||
image_sizes = { "http://my.discourse.org/image.png" => { "width" => 111, "height" => 222 } }
|
||||
expect(cpp.get_size_from_image_sizes("/image.png", image_sizes)).to eq([111, 222])
|
||||
end
|
||||
|
||||
it "returns nil whe img node has no src" do
|
||||
expect(cpp.get_size_from_image_sizes(nil, image_sizes)).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#get_size" do
|
||||
|
Reference in New Issue
Block a user