File tree Expand file tree Collapse file tree
androidTest/java/dev/typetype/android/feature/player/components
java/dev/typetype/android/feature/player/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class CommentBodyTest {
4747 }
4848
4949 composeRule.onNodeWithText(" Read more" ).assertExists().performClick()
50- composeRule.onNodeWithText(" Long comment starts here$suffix " ).assertExists()
50+ composeRule.onNodeWithText(" Show less" ).assertExists().performClick()
51+ composeRule.onNodeWithText(" Read more" ).assertExists()
5152 }
5253}
Original file line number Diff line number Diff line change @@ -139,13 +139,17 @@ private fun ExpandableCommentText(
139139 maxLines = if (expanded) Int .MAX_VALUE else COMMENT_COLLAPSE_LINE_LIMIT ,
140140 overflow = if (expanded) TextOverflow .Clip else TextOverflow .Ellipsis ,
141141 )
142- if (needsTruncation && ! expanded ) {
142+ if (needsTruncation) {
143143 TextButton (
144- onClick = { expanded = true },
144+ onClick = { expanded = ! expanded },
145145 contentPadding = PaddingValues (horizontal = 4 .dp),
146146 modifier = Modifier .padding(top = 2 .dp),
147147 ) {
148- Text (stringResource(R .string.comments_read_more))
148+ Text (
149+ stringResource(
150+ if (expanded) R .string.comments_show_less else R .string.comments_read_more,
151+ )
152+ )
149153 }
150154 }
151155 }
Original file line number Diff line number Diff line change 497497 <string name =" comments_title" >Comments</string >
498498 <string name =" comments_empty" >No comments</string >
499499 <string name =" comments_read_more" >Read more</string >
500+ <string name =" comments_show_less" >Show less</string >
500501 <string name =" comments_like_count" >Likes: %1$s</string >
501502 <string name =" comments_replies_failed" >Couldn\'t load replies</string >
502503 <string name =" comments_load_failed" >Couldn\'t load comments</string >
You can’t perform that action at this time.
0 commit comments