mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 09:29:07 +08:00
Make Spacing cloneable
Reviewed By: achen1 Differential Revision: D7626745 fbshipit-source-id: ca6070a99d561ee5d5dd27456116dd2de75d2bf3
This commit is contained in:
committed by
Facebook Github Bot
parent
49655c6eb3
commit
7e824867ca
@@ -29,6 +29,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.fest.assertions.data.Offset;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -113,6 +114,18 @@ public class FabricUIManagerTest {
|
||||
assertThat(clonedNode.getChildAt(0)).isEqualTo(child);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultSpacingCloning() {
|
||||
ReactShadowNode node = createViewNode();
|
||||
node.setDefaultPadding(Spacing.LEFT, 10);
|
||||
|
||||
ReactShadowNode clonedNode = mFabricUIManager.cloneNode(node);
|
||||
|
||||
node.setDefaultPadding(Spacing.LEFT, 20);
|
||||
assertThat(clonedNode.getStylePadding(Spacing.LEFT).value).isEqualTo(10f, Offset.offset(0.01f));
|
||||
assertThat(node.getStylePadding(Spacing.LEFT).value).isEqualTo(20f, Offset.offset(0.01f));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCloneVirtualNode() {
|
||||
ReactRawTextShadowNode node = new ReactRawTextShadowNode();
|
||||
|
||||
Reference in New Issue
Block a user