Fabric: Remove designated initializers in ComponentDescriptorTest (#23713)

Summary:
This pull request removes the designated initializers in `ComponentDescriptorTest.cpp`. This will help improve the portability of this file.

[General] [Fixed] - Removed designated initializers in `ComponentDescriptorTest`
Pull Request resolved: https://github.com/facebook/react-native/pull/23713

Differential Revision: D14305123

Pulled By: shergin

fbshipit-source-id: 64cfc76dd7eaf74b4b4395bac18a9fc370a3b322
This commit is contained in:
empyrical 2019-03-04 11:09:09 -08:00 коммит произвёл Facebook Github Bot
Родитель 56501dcc47
Коммит 74870d71a6
1 изменённых файлов: 30 добавлений и 25 удалений

Просмотреть файл

@ -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(
@ -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");
@ -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);