Move ShadowNode::getAncestors to ShadowNodeFamily

Summary:
Changelog: [internal]

1. Moves `ShadowNode::getAncestors` to `ShadowNodeFamily`.
2. Exposes shadowNode's family through `ShadowNode::getFamily()`.

# Why?
This is a first step in order to merge `StateCoordinator` into `ShadowNodeFamily` and use it as target for state updates.

Reviewed By: shergin

Differential Revision: D19465188

fbshipit-source-id: b5a3625aa21c040301259de02beedbf97e11f20e
This commit is contained in:
Samuel Susla
2020-01-28 09:32:52 -08:00
committed by Facebook Github Bot
parent 8259a9d369
commit 01805636b9
12 changed files with 176 additions and 73 deletions
@@ -222,18 +222,6 @@ TEST_F(ShadowNodeTest, handleCloneFunction) {
EXPECT_EQ(nodeAB_->getProps(), nodeABClone->getProps());
}
TEST_F(ShadowNodeTest, handleBacktracking) {
// Negative case:
auto ancestors1 = nodeZ_->getAncestors(*nodeA_);
EXPECT_EQ(ancestors1.size(), 0);
// Positive case:
auto ancestors2 = nodeABB_->getAncestors(*nodeA_);
EXPECT_EQ(ancestors2.size(), 2);
EXPECT_EQ(&ancestors2[0].first.get(), nodeA_.get());
EXPECT_EQ(&ancestors2[1].first.get(), nodeAB_.get());
}
TEST_F(ShadowNodeTest, handleState) {
auto family = std::make_shared<ShadowNodeFamily>(
ShadowNodeFamilyFragment{