Add support for img tags
This commit is contained in:
@ -208,5 +208,83 @@ defmodule Outlook.InternalTreeTest do
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
test "img tag won't be considered an empty element" do
|
||||
tree = [
|
||||
%Outlook.InternalTree.InternalNode{
|
||||
name: "p",
|
||||
attributes: %{},
|
||||
type: :element,
|
||||
nid: "cGK7c5koxnjH",
|
||||
content: [
|
||||
%Outlook.InternalTree.InternalNode{
|
||||
name: "img",
|
||||
attributes: %{src: "/images/flower.png"},
|
||||
type: :element,
|
||||
nid: "druVejfHcuX7",
|
||||
content: [],
|
||||
eph: %{sibling_with: :inline}
|
||||
}
|
||||
],
|
||||
eph: %{sibling_with: :block}
|
||||
}
|
||||
]
|
||||
assert InternalTree.partition_text(tree) |> unify_nids_in_tunits() == [
|
||||
%Outlook.InternalTree.InternalNode{
|
||||
name: "p",
|
||||
attributes: %{},
|
||||
type: :element,
|
||||
nid: "cGK7c5koxnjH",
|
||||
content: [
|
||||
%Outlook.InternalTree.TranslationUnit{
|
||||
status: :untranslated,
|
||||
nid: "xxxxxx",
|
||||
content: "<img src=\"/images/flower.png\">",
|
||||
eph: %{}
|
||||
}
|
||||
],
|
||||
eph: %{sibling_with: :block}
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
test "br tag won't be considered an empty element" do
|
||||
tree = [
|
||||
%Outlook.InternalTree.InternalNode{
|
||||
name: "p",
|
||||
attributes: %{},
|
||||
type: :element,
|
||||
nid: "cGK7c5koxnjH",
|
||||
content: [
|
||||
%Outlook.InternalTree.InternalNode{
|
||||
name: "br",
|
||||
attributes: %{},
|
||||
type: :element,
|
||||
nid: "druVejfHcuX7",
|
||||
content: [],
|
||||
eph: %{sibling_with: :inline}
|
||||
}
|
||||
],
|
||||
eph: %{sibling_with: :block}
|
||||
}
|
||||
]
|
||||
assert InternalTree.partition_text(tree) |> unify_nids_in_tunits() == [
|
||||
%Outlook.InternalTree.InternalNode{
|
||||
name: "p",
|
||||
attributes: %{},
|
||||
type: :element,
|
||||
nid: "cGK7c5koxnjH",
|
||||
content: [
|
||||
%Outlook.InternalTree.TranslationUnit{
|
||||
status: :untranslated,
|
||||
nid: "xxxxxx",
|
||||
content: "<br>",
|
||||
eph: %{}
|
||||
}
|
||||
],
|
||||
eph: %{sibling_with: :block}
|
||||
}
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user