2021-07-05 20:54:58 +02:00
|
|
|
require "../spec_helper"
|
|
|
|
|
|
|
|
module Nodes
|
2021-09-13 19:27:52 +02:00
|
|
|
describe EmbeddedLink do
|
2021-07-05 21:36:38 +02:00
|
|
|
it "returns embedded url with subdomains" do
|
2021-09-13 19:27:52 +02:00
|
|
|
iframe = EmbeddedLink.new(href: "https://dev.example.com/page")
|
2021-07-05 21:36:38 +02:00
|
|
|
|
|
|
|
iframe.domain.should eq("dev.example.com")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-07-05 20:54:58 +02:00
|
|
|
describe Image do
|
|
|
|
it "adjusts the width and height proportionally" do
|
|
|
|
image = Image.new(src: "image.png", originalWidth: 1000, originalHeight: 603)
|
|
|
|
|
|
|
|
image.width.should eq("800")
|
|
|
|
image.height.should eq("482")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "includes the adjusted width and height in the src" do
|
|
|
|
image = Image.new(src: "image.png", originalWidth: 1000, originalHeight: 603)
|
|
|
|
|
|
|
|
image.src.should eq("https://cdn-images-1.medium.com/fit/c/800/482/image.png")
|
|
|
|
end
|
|
|
|
end
|
2021-09-13 19:27:52 +02:00
|
|
|
|
|
|
|
describe EmbeddedContent do
|
|
|
|
it "adjusts the width and height proportionally" do
|
|
|
|
content = EmbeddedContent.new(
|
|
|
|
src: "https://example.com",
|
|
|
|
originalWidth: 1000,
|
|
|
|
originalHeight: 600,
|
|
|
|
)
|
|
|
|
|
|
|
|
content.width.should eq("800")
|
|
|
|
content.height.should eq("480")
|
|
|
|
end
|
|
|
|
end
|
2021-07-05 20:54:58 +02:00
|
|
|
end
|