Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabric: Remove designated initializers in ComponentDescriptorTest #23713

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 30 additions & 25 deletions ReactCommon/fabric/core/tests/ComponentDescriptorTest.cpp
Expand Up @@ -22,11 +22,12 @@ TEST(ComponentDescriptorTest, createShadowNode) {

const auto &raw = RawProps(folly::dynamic::object("nativeID", "abc"));
SharedProps props = descriptor->cloneProps(nullptr, raw);
SharedShadowNode node = descriptor->createShadowNode(
ShadowNodeFragment{.tag = 9,
.rootTag = 1,
.props = props,
.eventEmitter = descriptor->createEventEmitter(0, 9)});
SharedShadowNode node = descriptor->createShadowNode(ShadowNodeFragment{
/* .tag = */ 9,
/* .rootTag = */ 1,
/* .props = */ props,
/* .eventEmitter = */ descriptor->createEventEmitter(0, 9),
});

ASSERT_EQ(node->getComponentHandle(), TestShadowNode::Handle());
ASSERT_STREQ(
Expand All @@ -43,11 +44,12 @@ TEST(ComponentDescriptorTest, cloneShadowNode) {

const auto &raw = RawProps(folly::dynamic::object("nativeID", "abc"));
SharedProps props = descriptor->cloneProps(nullptr, raw);
SharedShadowNode node = descriptor->createShadowNode(
ShadowNodeFragment{.tag = 9,
.rootTag = 1,
.props = props,
.eventEmitter = descriptor->createEventEmitter(0, 9)});
SharedShadowNode node = descriptor->createShadowNode(ShadowNodeFragment{
/* .tag = */ 9,
/* .rootTag = */ 1,
/* .props = */ props,
/* .eventEmitter = */ descriptor->createEventEmitter(0, 9),
});
SharedShadowNode cloned = descriptor->cloneShadowNode(*node, {});

ASSERT_STREQ(cloned->getComponentName().c_str(), "Test");
Expand All @@ -62,21 +64,24 @@ TEST(ComponentDescriptorTest, appendChild) {

const auto &raw = RawProps(folly::dynamic::object("nativeID", "abc"));
SharedProps props = descriptor->cloneProps(nullptr, raw);
SharedShadowNode node1 = descriptor->createShadowNode(
ShadowNodeFragment{.tag = 1,
.rootTag = 1,
.props = props,
.eventEmitter = descriptor->createEventEmitter(0, 1)});
SharedShadowNode node2 = descriptor->createShadowNode(
ShadowNodeFragment{.tag = 2,
.rootTag = 1,
.props = props,
.eventEmitter = descriptor->createEventEmitter(0, 2)});
SharedShadowNode node3 = descriptor->createShadowNode(
ShadowNodeFragment{.tag = 3,
.rootTag = 1,
.props = props,
.eventEmitter = descriptor->createEventEmitter(0, 3)});
SharedShadowNode node1 = descriptor->createShadowNode(ShadowNodeFragment{
/* .tag = */ 1,
/* .rootTag = */ 1,
/* .props = */ props,
/* .eventEmitter = */ descriptor->createEventEmitter(0, 1),
});
SharedShadowNode node2 = descriptor->createShadowNode(ShadowNodeFragment{
/* .tag = */ 2,
/* .rootTag = */ 1,
/* .props = */ props,
/* .eventEmitter = */ descriptor->createEventEmitter(0, 2),
});
SharedShadowNode node3 = descriptor->createShadowNode(ShadowNodeFragment{
/* .tag = */ 3,
/* .rootTag = */ 1,
/* .props = */ props,
/* .eventEmitter = */ descriptor->createEventEmitter(0, 3),
});

descriptor->appendChild(node1, node2);
descriptor->appendChild(node1, node3);
Expand Down