Skip to content

Commit

Permalink
Fixed clang format screw up.
Browse files Browse the repository at this point in the history
  • Loading branch information
5cript committed Jan 23, 2024
1 parent cf58009 commit bf1ae0f
Showing 1 changed file with 16 additions and 40 deletions.
56 changes: 16 additions & 40 deletions nui/test/nui/test_render.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ namespace Nui::Tests
using Nui::Elements::span;
render(div{}(span{}("Hello World")));
ASSERT_EQ(Nui::val::global("document")["body"]["children"]["length"].as<long long>(), 1);
EXPECT_EQ(Nui::val::global("document")["body"]["children"][0]["textContent"].as<std::string>(), "Hello
World");
EXPECT_EQ(Nui::val::global("document")["body"]["children"][0]["textContent"].as<std::string>(), "Hello World");
}

TEST_F(TestRender, TextBodyCanBeObservedVariable)
Expand Down Expand Up @@ -407,8 +406,7 @@ namespace Nui::Tests
globalEventContext.executeActiveEventsImmediately();

EXPECT_EQ(
Nui::val::global("document")["body"]["children"][0]["attributes"]["id"].as<std::string>(), "changed
again");
Nui::val::global("document")["body"]["children"][0]["attributes"]["id"].as<std::string>(), "changed again");
}

TEST_F(TestRender, StableFragmentCreatesPhantomDiv)
Expand Down Expand Up @@ -549,8 +547,7 @@ namespace Nui::Tests
render(div{}(text{"Hello World"}()));

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 1);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello
World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello World");
}

TEST_F(TestRender, PlainTextCanBeUpdated)
Expand All @@ -562,8 +559,7 @@ namespace Nui::Tests
render(div{}(text{textContent}()));

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 1);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello
World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello World");

textContent = "Changed";
globalEventContext.executeActiveEventsImmediately();
Expand All @@ -580,13 +576,11 @@ namespace Nui::Tests
render(div{}(text{textContent}()));

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 1);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello
World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello World");

textContent = "Changed";

EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello
World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello World");
}

TEST_F(TestRender, PlainTextCanAppearAnywhereBetweenRegularElements)
Expand All @@ -597,12 +591,8 @@ namespace Nui::Tests

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 3);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["tagName"].as<std::string>(), "span");
EXPECT_EQ(
Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(),
"Hello
World "); EXPECT_EQ(Nui::val::global(" document ")[" body "][" childNodes "][2][" tagName
"].as<std::string>(),
"div");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(), "Hello World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][2]["tagName"].as<std::string>(), "div");
}

TEST_F(TestRender, PlainTextCanBeChangedAlongsideRegularElements)
Expand All @@ -615,12 +605,8 @@ namespace Nui::Tests

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 3);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["tagName"].as<std::string>(), "span");
EXPECT_EQ(
Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(),
"Hello
World "); EXPECT_EQ(Nui::val::global(" document ")[" body "][" childNodes "][2][" tagName
"].as<std::string>(),
"div");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(), "Hello World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][2]["tagName"].as<std::string>(), "div");

textContent = "Changed";
globalEventContext.executeActiveEventsImmediately();
Expand All @@ -639,12 +625,8 @@ namespace Nui::Tests

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 3);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["tagName"].as<std::string>(), "span");
EXPECT_EQ(
Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(),
"Hello
World "); EXPECT_EQ(Nui::val::global(" document ")[" body "][" childNodes "][2][" tagName
"].as<std::string>(),
"div");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(), "Hello World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][2]["tagName"].as<std::string>(), "div");

textContent = "Changed";
globalEventContext.executeActiveEventsImmediately();
Expand All @@ -659,8 +641,7 @@ namespace Nui::Tests
render(div{}(fragment(text{"Hello World"}())));

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 1);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello
World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello World");
}

TEST_F(TestRender, PlainTextCanBeUpdatedInsideFragment)
Expand All @@ -672,8 +653,7 @@ namespace Nui::Tests
render(div{}(fragment(text{textContent}())));

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 1);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello
World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["nodeValue"].as<std::string>(), "Hello World");

textContent = "Changed";
globalEventContext.executeActiveEventsImmediately();
Expand All @@ -691,12 +671,8 @@ namespace Nui::Tests

ASSERT_EQ(Nui::val::global("document")["body"]["childNodes"]["length"].as<long long>(), 3);
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][0]["tagName"].as<std::string>(), "span");
EXPECT_EQ(
Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(),
"Hello
World "); EXPECT_EQ(Nui::val::global(" document ")[" body "][" childNodes "][2][" tagName
"].as<std::string>(),
"div");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][1]["nodeValue"].as<std::string>(), "Hello World");
EXPECT_EQ(Nui::val::global("document")["body"]["childNodes"][2]["tagName"].as<std::string>(), "div");

textContent = "Changed";
globalEventContext.executeActiveEventsImmediately();
Expand Down

0 comments on commit bf1ae0f

Please sign in to comment.