diff --git a/Tests/Source/UnitTests/Element.cpp b/Tests/Source/UnitTests/Element.cpp index c81a3387b..68d61b6f3 100644 --- a/Tests/Source/UnitTests/Element.cpp +++ b/Tests/Source/UnitTests/Element.cpp @@ -166,7 +166,12 @@ TEST_CASE("Element") context->Update(); context->Render(); - TestsShell::RenderLoop(); + Element* div = document->GetFirstChild(); + Element* span = div->GetChild(1); + REQUIRE(div); + REQUIRE(div->GetTagName() == "div"); + REQUIRE(span); + REQUIRE(span->GetTagName() == "span"); SUBCASE("Attribute") { @@ -295,12 +300,6 @@ TEST_CASE("Element") SUBCASE("GetInnerRML") { String inner_rml; - Element* div = document->GetFirstChild(); - Element* span = div->GetChild(1); - REQUIRE(div); - REQUIRE(div->GetTagName() == "div"); - REQUIRE(span); - REQUIRE(span->GetTagName() == "span"); inner_rml = document->GetInnerRML(); CHECK(inner_rml == R"(
This is a sample.
)"); @@ -322,6 +321,18 @@ TEST_CASE("Element") CHECK(inner_rml == R"(
This is a sample.
)"); } + SUBCASE("InsertBefore") + { + String inner_rml; + + inner_rml = document->GetInnerRML(); + CHECK(inner_rml == R"(
This is a sample.
)"); + + div->InsertBefore(document->CreateElement("img"), span); + inner_rml = document->GetInnerRML(); + CHECK(inner_rml == R"(
This is a sample.
)"); + } + document->Close(); TestsShell::ShutdownShell(); }