KakaoCup / Compose

Nice and simple DSL for Espresso Compose UI testing in Kotlin

Home Page:https://kakaocup.github.io/Compose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with LazyColumn and clickable modifier

Majostik opened this issue · comments

Hi
There is a problem with LazyColumn and clickable modifier, if I add clickable to item of LazyColumn then KLazyListItemNode can't find child.
For example I modified your sample and tried to run

@Composable
private fun ListItemHeader(item: LazyListItem.Header, modifier: Modifier = Modifier) {
    Box(
        modifier = Modifier
            .padding(horizontal = 16.dp, vertical = 8.dp)
            .clickable {  }
            .clip(RoundedCornerShape(8.dp))
            .background(Color.Green)
            .then(modifier)
    ) {
        Text(
            item.title,
            Modifier
                .padding(8.dp)
                .testTag("LazyListHeaderTitle")
        )
    }
}

I got error

java.lang.AssertionError: Failed to assert the following: (Text + EditableText = [Items from 1 to 10])
Can't retrieve node at index '0' of '(hasAnyAncestorThat(Semantics node id = 18)) && (TestTag = 'LazyListHeaderTitle')'
There are no existing nodes for that selector.

Hi! Check that your nodes use the flag useUnmergedTree = true

This issue contains examples of how it can be configured

Yeah, it's working. Can you please explain why it's now working without this flag?

You can read more about it here