Render a User Anchor

This commit is contained in:
Edward Loveall
2021-07-04 17:37:45 -04:00
parent bc356baa45
commit 743d9e5fa9
7 changed files with 78 additions and 2 deletions

View File

@@ -129,4 +129,39 @@ describe MarkupConverter do
Anchor.new(text: "Link", href: "https://example.com")
])
end
it "renders an A USER markup" do
json = <<-JSON
{
"text": "Hi Dr Nick!",
"type": "P",
"markups": [
{
"title": null,
"type": "A",
"href": null,
"userId": "abc123",
"start": 3,
"end": 10,
"rel": null,
"anchorType": "USER"
}
],
"href": null,
"iframe": null,
"layout": null,
"metadata": null
}
JSON
paragraph = PostResponse::Paragraph.from_json(json)
result = MarkupConverter.convert(text: paragraph.text, markups: paragraph.markups)
result.should eq([
Text.new("Hi "),
UserAnchor.new(text: "Dr Nick", userId: "abc123"),
Text.new("!"),
])
end
end