com.facebook.litho.widget.Text Java Examples
The following examples show how to use
com.facebook.litho.widget.Text.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExpandableElementUtil.java From litho with Apache License 2.0 | 6 votes |
@Nullable static Component.Builder maybeCreateBottomDetailComponent( ComponentContext c, boolean expanded, boolean seen) { if (!expanded) { return null; } return Text.create(c) .textSizeDip(14) .textColor(Color.GRAY) .alignSelf(YogaAlign.FLEX_END) .paddingDip(YogaEdge.RIGHT, 10) .transitionKey(TRANSITION_BOTTOM_DETAIL) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .text(seen ? "Seen" : "Sent"); }
Example #2
Source File: FeedItemCardSpecTest.java From litho with Apache License 2.0 | 6 votes |
@Test public void testDeepSubComponents() { final ComponentContext c = mComponentsRule.getContext(); // N.B. This manual way of testing is not recommended and will be replaced by more high-level // matchers, but illustrates how it can be used in case more fine-grained assertions are // required. assertThat(c, mComponent) .extractingSubComponentAt(0) .extractingSubComponentsDeeply(c) .hasSize(22) // TODO: T53372437 Remove or rewrite test. .has( new Condition<InspectableComponent>() { @Override public boolean matches(InspectableComponent value) { describedAs(value.getComponentClass() + " with text " + value.getTextContent()); return value.getComponentClass() == Text.class && "JavaScript Rockstar".equals(value.getTextContent()); } }, atIndex(10)); }
Example #3
Source File: InjectPropMatcherGenerationTest.java From litho with Apache License 2.0 | 6 votes |
@Test public void testInjectPropMatching() { final ComponentContext c = mComponentsRule.getContext(); final MyInjectProp component = new MyInjectProp(c.getAndroidContext()).create(c).normalString("normal string").build(); // Faking some DI mechanism doing its thing. component.injectedString = "injected string"; component.injectedKettle = new MyInjectPropSpec.Kettle(92f); component.injectedComponent = Text.create(c).text("injected text").build(); final Condition<InspectableComponent> matcher = TestMyInjectProp.matcher(c) .normalString("normal string") .injectedString("injected string") .injectedKettle( new CustomTypeSafeMatcher<MyInjectPropSpec.Kettle>("matches temperature") { @Override protected boolean matchesSafely(MyInjectPropSpec.Kettle item) { return Math.abs(item.temperatureCelsius - 92f) < 0.1; } }) .injectedComponent(TestText.matcher(c).text("injected text").build()) .build(); assertThat(c, component).has(deepSubComponentWith(c, matcher)); }
Example #4
Source File: VerySimpleGroupSectionSpecTest.java From litho with Apache License 2.0 | 6 votes |
@Test public void testInitialChildren() throws Exception { Section s = mTester.prepare( VerySimpleGroupSection.create(mTester.getContext()).numberOfDummy(4).build()); List<SubSection> subSections = mTester.getChildren(s); assertThat(subSections) .containsExactly( SubSection.of( SingleComponentSection.create(mTester.getContext()) .key("key0") .component(Text.create(mTester.getContext()).text("Lol hi 0")) .build()), SubSection.of(SingleComponentSection.class), SubSection.of(SingleComponentSection.class), SubSection.of(SingleComponentSection.class)); }
Example #5
Source File: ViewPredicatesTest.java From litho with Apache License 2.0 | 6 votes |
@Before public void setUp() { final Activity activity = Robolectric.buildActivity(Activity.class).create().get(); mView = new View(activity); mTextViewWithNull = new TextView(activity); mTextViewWithEmptyString = new TextView(activity); mTextViewWithHello = new TextView(activity); mTextViewWithWorld = new TextView(activity); mImagelessView = new ImageView(activity); mOtherImageView = new ImageView(activity); mImageView = new ImageView(activity); mImageViewWithCustomDrawable = new ImageView(activity); mTextViewWithEmptyString.setText(""); mTextViewWithHello.setText("Hello"); mTextViewWithWorld.setText("World"); mOtherImageView.setImageResource(R.drawable.background); mImageView.setImageResource(R.drawable.litho); mImageViewWithCustomDrawable.setImageResource(R.drawable.custom_drawable); final ComponentContext context = new ComponentContext(activity); mLithoViewWithText = ComponentTestHelper.mountComponent(Text.create(context).text("Hello")); }
Example #6
Source File: TitleComponentSpec.java From litho-glide with MIT License | 6 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop(resType = STRING) String title) { return Text.create(c) .text(title) .textStyle(BOLD) .textSizeDip(24) .flexShrink(0) .backgroundColor(0xDDFFFFFF) .positionType(YogaPositionType.ABSOLUTE) .positionDip(YogaEdge.BOTTOM, 4) .positionDip(YogaEdge.LEFT, 4) .paddingDip(YogaEdge.HORIZONTAL, 6) .build(); }
Example #7
Source File: StateResettingRootComponentSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop List<DataModel> dataModels, @Prop boolean showHeader) { final Component listComponent = RecyclerCollectionComponent.create(c) .disablePTR(true) .section(FavouriteGroupSection.create(new SectionContext(c)).dataModels(dataModels)) .flexGrow(1) .build(); return showHeader ? Column.create(c) .child(Text.create(c).text("Header").textSizeDip(30).build()) .child(listComponent) .build() : listComponent; }
Example #8
Source File: DebugErrorComponentSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout public static Component onCreateLayout( ComponentContext c, @Prop String message, @Prop Throwable throwable) { Log.e(TAG, message, throwable); return Column.create(c) .backgroundColor(DARK_RED_FRAME) .paddingDip(YogaEdge.ALL, 1f) .child( Text.create(c) .backgroundColor(LIGHT_RED_BACKGROUND) .paddingDip(YogaEdge.ALL, 4f) .textSizeDip(16f) .text(message)) .child( Text.create(c) .backgroundColor(LIGHT_RED_BACKGROUND) .paddingDip(YogaEdge.ALL, 4f) .textSizeDip(12f) .textColor(LIGHT_GRAY_TEXT) .typeface(Typeface.MONOSPACE) .text(StacktraceHelper.formatStacktrace(throwable))) .clickHandler(DebugErrorComponent.onClick(c)) .build(); }
Example #9
Source File: DetailActivity.java From litho with Apache License 2.0 | 6 votes |
private static Component getContent(ComponentContext c, int color, Spannable titleText) { return Column.create(c) .child(Text.create(c).textSizeSp(25).transitionName(TITLE_TRANSITION_NAME).text(titleText)) .child( Row.create(c) .marginDip(YogaEdge.START, 100) .transitionName(SQUARE_TRANSITION_NAME) .widthDip(200) .heightDip(200) .backgroundColor(color)) .child( Text.create(c) .textSizeSp(12) .transitionName("DESCRIPTION") .text( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent egestas augue venenatis suscipit maximus. Maecenas vel volutpat nunc. Etiam volutpat ultricies ante a iaculis. Fusce ultrices eleifend ligula in maximus. Fusce commodo, mauris vitae consequat tincidunt, nunc massa pharetra ante, non interdum magna sapien vel tortor. Aliquam in ultrices odio. Phasellus ac ante sit amet purus efficitur tempus fermentum in erat. Nullam auctor lorem ut justo convallis vestibulum. Fusce consequat velit eget pharetra consequat. Integer vulputate nisl eu libero luctus, id consequat ipsum eleifend. Nam quis sodales neque. Nullam nec velit sed leo feugiat imperdiet.\n" + "\n" + "Praesent lacinia lorem quis mauris molestie, ut placerat nisi ultricies. Sed a fringilla mi. Ut ornare a lorem quis consectetur. Pellentesque id leo id odio accumsan egestas. Proin sollicitudin turpis orci, in tempus dolor eleifend dapibus. Aenean facilisis fringilla orci, vel facilisis nunc commodo in. Sed scelerisque lectus ac diam feugiat, sit amet condimentum enim imperdiet. Integer urna arcu, aliquet quis facilisis quis, faucibus quis lorem. Nam congue augue est, ac porttitor mauris vehicula ut. Phasellus sapien tortor, euismod non dui quis, vulputate auctor orci. Maecenas a lectus in felis tincidunt pulvinar. Praesent nec laoreet ante, in sollicitudin quam. Vestibulum convallis, ante sit amet consequat varius, urna dui sagittis odio, suscipit rutrum ipsum nisi non eros. Cras interdum mattis libero at posuere. Phasellus venenatis dui massa, sed egestas mauris porta id.")) .build(); }
Example #10
Source File: BorderEffectsComponentSpec.java From litho with Apache License 2.0 | 6 votes |
@OnEvent(RenderEvent.class) static RenderInfo onRender(ComponentContext c, @FromEvent Class<? extends Component> model) { try { Method createMethod = model.getMethod("create", ComponentContext.class); Component.Builder componentBuilder = (Component.Builder) createMethod.invoke(null, c); return ComponentRenderInfo.create().component(componentBuilder.build()).build(); } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { return ComponentRenderInfo.create() .component(Text.create(c).textSizeDip(32).text(ex.getLocalizedMessage()).build()) .build(); } }
Example #11
Source File: AlternateColorBorderSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has all borders specified to the same width, but not colors")) .border( Border.create(c) .color(YogaEdge.LEFT, NiceColor.RED) .color(YogaEdge.TOP, NiceColor.YELLOW) .color(YogaEdge.RIGHT, NiceColor.GREEN) .color(YogaEdge.BOTTOM, NiceColor.BLUE) .widthDip(YogaEdge.ALL, 5) .build()) .build(); }
Example #12
Source File: AlternateColorCornerPathEffectBorderSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has a path effect with rounded corners + multiple colors")) .border( Border.create(c) .widthDip(YogaEdge.ALL, 20) .color(YogaEdge.LEFT, NiceColor.RED) .color(YogaEdge.TOP, NiceColor.ORANGE) .color(YogaEdge.RIGHT, NiceColor.GREEN) .color(YogaEdge.BOTTOM, NiceColor.BLUE) .radiusDip(20f) .build()) .build(); }
Example #13
Source File: AlternateColorPathEffectBorderSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has a path effect with multiple colors")) .border( Border.create(c) .color(YogaEdge.LEFT, NiceColor.RED) .color(YogaEdge.TOP, NiceColor.ORANGE) .color(YogaEdge.RIGHT, NiceColor.GREEN) .color(YogaEdge.BOTTOM, NiceColor.BLUE) .widthDip(YogaEdge.ALL, 5) .discreteEffect(5f, 10f) .build()) .build(); }
Example #14
Source File: AlternateColorWidthBorderSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has each border specified to a different color + width")) .border( Border.create(c) .color(YogaEdge.LEFT, NiceColor.RED) .color(YogaEdge.TOP, NiceColor.YELLOW) .color(YogaEdge.RIGHT, NiceColor.GREEN) .color(YogaEdge.BOTTOM, NiceColor.BLUE) .widthDip(YogaEdge.LEFT, 2) .widthDip(YogaEdge.TOP, 4) .widthDip(YogaEdge.RIGHT, 8) .widthDip(YogaEdge.BOTTOM, 16) .build()) .build(); }
Example #15
Source File: CompositePathEffectBorderSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has a composite path effect of discrete + corner")) .border( Border.create(c) .widthDip(YogaEdge.ALL, 20) .color(YogaEdge.LEFT, NiceColor.RED) .color(YogaEdge.TOP, NiceColor.ORANGE) .color(YogaEdge.RIGHT, NiceColor.GREEN) .color(YogaEdge.BOTTOM, NiceColor.BLUE) .dashEffect(new float[] {10f, 5f}, 0f) .radiusDip(20f) .build()) .build(); }
Example #16
Source File: AlternateWidthBorderSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has all borders specified to the same color, but not width")) .border( Border.create(c) .color(YogaEdge.ALL, NiceColor.MAGENTA) .widthDip(YogaEdge.LEFT, 2) .widthDip(YogaEdge.TOP, 4) .widthDip(YogaEdge.RIGHT, 8) .widthDip(YogaEdge.BOTTOM, 16) .build()) .build(); }
Example #17
Source File: BlocksSameTransitionKeyComponentSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @State boolean state, @State boolean running, @State Set<String> runningAnimations) { return Column.create(c) .child(Row.create(c).child(Text.create(c).text(running ? "RUNNING" : "STOPPED"))) .child( Column.create(c) .alignItems(!state ? YogaAlign.FLEX_START : YogaAlign.FLEX_END) .child( Text.create(c) .heightDip(50) .widthDip(50) .text(runningAnimations.toString()) .backgroundColor(Color.parseColor("#ee1111")) .alpha(!state ? 1.0f : 0.2f) .transitionKey(TRANSITION_KEY) .build())) .clickHandler(BlocksSameTransitionKeyComponent.onClick(c)) .build(); }
Example #18
Source File: AnimationStateExampleComponentSpec.java From litho with Apache License 2.0 | 6 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @State boolean shouldAlignStart, @State String actualPosition) { return Column.create(c) .paddingDip(YogaEdge.ALL, 20) .alignItems(shouldAlignStart ? YogaAlign.FLEX_START : YogaAlign.FLEX_END) .child( Text.create(c) .text(actualPosition) .textColor(Color.WHITE) .textSizeDip(20) .alignment(TextAlignment.CENTER) .heightDip(SIZE_DP) .widthDip(SIZE_DP) .backgroundColor(Color.RED)) .clickHandler(AnimationStateExampleComponent.onClick(c)) .build(); }
Example #19
Source File: ClearTextTriggerExampleComponentSpec.java From litho with Apache License 2.0 | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { final Handle textInputHandle = new Handle(); return Column.create(c) .child( Text.create(c, android.R.attr.buttonStyle, 0) .text("Clear") .clickHandler(ClearTextTriggerExampleComponent.onClearClick(c, textInputHandle))) .child(TextInputContainerComponent.create(c).textInputHandle(textInputHandle)) .build(); }
Example #20
Source File: DecadeSeparatorSpec.java From litho-picasso with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop final Decade decade) { return Row.create(c) .alignItems(YogaAlign.CENTER) .paddingDip(YogaEdge.ALL, 16) .child( Row.create(c) .heightPx(1) .backgroundColor(0xFFAAAAAA) .flex(1)) .child( Text.create(c) .text(String.valueOf(decade.year)) .textSizeDip(14) .textColor(0xFFAAAAAA) .marginDip(YogaEdge.HORIZONTAL, 10) .flex(0)) .child( Row.create(c) .heightPx(1) .backgroundColor(0xFFAAAAAA) .flex(1)) .backgroundColor(0xFFFAFAFA) .build(); }
Example #21
Source File: StoryCardComponentSpec.java From litho with Apache License 2.0 | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop String content) { return Column.create(c) .backgroundColor(Color.WHITE) .child( Text.create(c, 0, R.style.message_text) .text(content) .paddingDip(HORIZONTAL, CARD_INSET) .paddingDip(BOTTOM, CARD_INTERNAL_PADDING)) .child( Row.create(c) .alignSelf(STRETCH) .paddingDip(HORIZONTAL, CARD_INSET) .paddingDip(BOTTOM, CARD_INTERNAL_PADDING) .paddingDip(TOP, CARD_INTERNAL_PADDING) .justifyContent(CENTER) .child( Image.create(c) .drawableRes(R.drawable.save) .alignSelf(YogaAlign.CENTER) .widthDip(20) .heightDip(20) .marginDip(END, CARD_INTERNAL_PADDING)) .child(Text.create(c, 0, R.style.save_text).text("Save")) .border(Border.create(c).color(ALL, Color.BLACK).widthDip(TOP, 1).build())) .border(Border.create(c).color(ALL, Color.BLACK).widthDip(ALL, 1).build()) .build(); }
Example #22
Source File: LayoutStateCalculationWithoutDrawableOutputsTest.java From litho with Apache License 2.0 | 5 votes |
@Test public void whenDrawableOutputsDisabledAndChildrenWrappedInView_shouldNotHaveDrawableOutputsForBackgroundAndForeground() { LayoutState state; LayoutOutput output; attach(); // disable layout outputs for drawables ComponentsConfiguration.shouldDisableDrawableOutputs = true; mLithoView.setComponent(RootComponent.create(mContext).shouldWrapInView(true).build()); state = mLithoView.getComponentTree().getMainThreadLayoutState(); assertThat(state.getMountableOutputCount()).isEqualTo(5); // 2 bg and fg lesser. output = getLayoutOutput(state.getMountableOutputAt(1)); assertThat(output.getComponent()).isOfAnyClassIn(HostComponent.class); assertThat(output.getViewNodeInfo().getBackground()).isNotNull(); output = getLayoutOutput(state.getMountableOutputAt(2)); assertThat(output.getComponent()).isOfAnyClassIn(Text.class); output = getLayoutOutput(state.getMountableOutputAt(3)); assertThat(output.getComponent()).isOfAnyClassIn(HostComponent.class); assertThat(output.getViewNodeInfo().getBackground()).isNotNull(); output = getLayoutOutput(state.getMountableOutputAt(4)); assertThat(output.getComponent()).isOfAnyClassIn(Text.class); ComponentsConfiguration.shouldDisableDrawableOutputs = false; }
Example #23
Source File: StoryHeaderComponentSpec.java From litho with Apache License 2.0 | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop String title, @Prop String subtitle) { return Row.create(c) .paddingDip(HORIZONTAL, CARD_INSET) .paddingDip(TOP, CARD_INSET) .child( FrescoImage.create(c) .controller( Fresco.newDraweeControllerBuilder() .setUri("http://placekitten.com/g/200/200") .build()) .widthDip(40) .heightDip(40) .marginDip(END, CARD_INTERNAL_PADDING) .marginDip(BOTTOM, CARD_INTERNAL_PADDING)) .child( Column.create(c) .flexGrow(1f) .child( Text.create(c, 0, R.style.header_title) .text(title) .paddingDip(BOTTOM, CARD_INTERNAL_PADDING)) .child( Text.create(c, 0, R.style.header_subtitle) .text(subtitle) .paddingDip(BOTTOM, CARD_INTERNAL_PADDING))) .child( Image.create(c) .drawableRes(R.drawable.menu) .clickHandler(StoryHeaderComponent.onClickMenuButton(c)) .widthDip(15) .heightDip(15) .marginDip(START, CARD_INTERNAL_PADDING) .marginDip(BOTTOM, CARD_INTERNAL_PADDING)) .build(); }
Example #24
Source File: TestErrorBoundarySpec.java From litho with Apache License 2.0 | 5 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop Component child, @State Optional<String> error) { if (error.isPresent()) { return Text.create(c) .marginDip(YogaEdge.ALL, 8) .textSizeSp(24) .text(String.format("A WILD ERROR APPEARS:\n%s", error.get())) .build(); } return child; }
Example #25
Source File: LithoViewTestHelperTest.java From litho with Apache License 2.0 | 5 votes |
@Test public void viewToStringWithText() { final Component component = new InlineLayoutSpec() { @Override protected Component onCreateLayout(ComponentContext c) { return Column.create(c) .child( SimpleMountSpecTester.create(c) .testKey("test-drawable") .widthPx(100) .heightPx(100)) .child(Text.create(c).widthPx(100).heightPx(100).text("Hello, World")) .build(); } }; final LithoView lithoView = new LithoView(getApplicationContext()); lithoView.setComponent(component); lithoView.measure(makeMeasureSpec(0, UNSPECIFIED), makeMeasureSpec(0, UNSPECIFIED)); lithoView.layout(0, 0, lithoView.getMeasuredWidth(), lithoView.getMeasuredHeight()); final String string = LithoViewTestHelper.viewToString(lithoView); assertThat(string) .containsPattern( "litho.InlineLayout\\{\\w+ V.E..... .. 0,0-100,200\\}\n" + " litho.Column\\{\\w+ V.E..... .. 0,0-100,200\\}\n" + " litho.SimpleMountSpecTester\\{\\w+ V.E..... .. 0,0-100,100 litho:id/test-drawable\\}\n" + " litho.Text\\{\\w+ V.E..... .. 0,100-100,200 text=\"Hello, World\"\\}"); }
Example #26
Source File: LayoutStateCalculateTest.java From litho with Apache License 2.0 | 5 votes |
@Test public void whenAccessibleChildNodeExists_ParentNodeShouldImplementVirtualViews() { enableAccessibility(); final Component component = Text.create(mContext).text("hello world").build(); mLithoViewRule.setRoot(component).attachToWindow().measure().layout(); assertThat(mLithoViewRule.getLithoView().implementsVirtualViews()) .describedAs("The parent output of the Text must implement virtual views") .isTrue(); }
Example #27
Source File: AllBorderSpec.java From litho with Apache License 2.0 | 5 votes |
@OnCreateLayout static Component onCreateLayout(ComponentContext c) { return Row.create(c) .child( Text.create(c) .textSizeSp(20) .text("This component has all borders specified to the same color + width")) .border( Border.create(c).color(YogaEdge.ALL, NiceColor.BLUE).widthDip(YogaEdge.ALL, 5).build()) .build(); }
Example #28
Source File: FooterComponentSpec.java From litho-picasso with MIT License | 5 votes |
@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop(resType = STRING) String text) { return Column.create(c).flexShrink(0).alignContent(YogaAlign.FLEX_START) .paddingDip(YogaEdge.ALL, 8) .child( Text.create(c) .text(text) .textSizeDip(14) .textColor(GRAY) .textStyle(ITALIC)) .build(); }
Example #29
Source File: ComponentStyleTest.java From litho with Apache License 2.0 | 5 votes |
@Test public void testStyleLayout() { Component component = Text.create(mContext, 0, PaddingStyle).text("text").build(); InternalNode node = (InternalNode) component.resolve(mContext); node.calculateLayout(); assertThat(node.getPaddingLeft()).isEqualTo(mDimen); }
Example #30
Source File: ComponentHostTest.java From litho with Apache License 2.0 | 5 votes |
@Test public void whenTouchExpansionSetOnComponent_shouldHaveTouchDelegateOnParentOfHostView() { final Component component = Column.create(mContext) .paddingPx(YogaEdge.ALL, 15) .widthPx(100) .heightPx(100) .child( Text.create(mContext) .text("hello-world") .touchExpansionPx(YogaEdge.ALL, 5) .clickHandler(NoOpEventHandler.getNoOpEventHandler())) .child( Row.create(mContext) .wrapInView() .child( TextInput.create(mContext) .touchExpansionPx(YogaEdge.ALL, 5) .clickHandler(NoOpEventHandler.getNoOpEventHandler()))) .build(); mLithoViewRule.setRoot(component).attachToWindow().measure().layout(); TouchExpansionDelegate delegate = mLithoViewRule.getLithoView().getTouchExpansionDelegate(); assertThat(delegate) .describedAs("Should be not null for the host view of the Text") .isNotNull(); final View child1 = mLithoViewRule.getLithoView().getChildAt(0); assertThat(child1).isInstanceOf(ComponentHost.class); assertThat(((ComponentHost) child1).getTouchExpansionDelegate()) .describedAs("should be null for the Text") .isNull(); final View child2 = mLithoViewRule.getLithoView().getChildAt(1); assertThat(child2).isInstanceOf(ComponentHost.class); assertThat(((ComponentHost) child2).getTouchExpansionDelegate()) .describedAs("Should be not null for the host view of the Text Input") .isNotNull(); }