Repository navigation
fix(mindrecord): MEMORIES 카드의 '그날의 기록 다시 읽기' 죽은 영역을 없앤다 (#793) #1105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7ebeac7
e752462
1ca279c
cafaa04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| package com.afternote.feature.mindrecord.presentation.hometab | ||
|
|
||
| import androidx.annotation.VisibleForTesting | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.interaction.MutableInteractionSource | ||
| import androidx.compose.foundation.layout.Arrangement | ||
|
|
@@ -118,8 +119,9 @@ private fun HomeTabMindRecordMemoriesItem( | |
| ) | ||
| } | ||
|
|
||
| @VisibleForTesting | ||
| @Composable | ||
| private fun MemoriesSectionContent( | ||
| internal fun MemoriesSectionContent( | ||
| onMemoriesSectionClick: () -> Unit, | ||
| clickLabel: String, | ||
| interactionSource: MutableInteractionSource, | ||
|
|
@@ -141,12 +143,16 @@ private fun MemoriesSectionContent( | |
| ) { | ||
| AfternoteSectionHeader(title = stringResource(mindrecord_home_tab_memories_section_title)) | ||
| Spacer(modifier = Modifier.height(12.dp)) | ||
| // "그날의 기록 다시 읽기" 목적지는 넘기지 않는다 — Figma 의 이 버튼에 프로토타입 | ||
| // 연결이 없고 #559 에도 확정 답변이 없다. 임의 목적지를 붙이면 미확정 탐색 동작이 | ||
| // 제품 동작으로 굳는다. 확정되면 여기서 `onReadAgainClick` 을 채운다. | ||
| // 버튼은 **자기 컨테이너와 같은 곳**으로 보낸다 (#793). | ||
| // | ||
| // 목적지가 미확정이라 비워 뒀는데, 버튼이 자체 clickable 이라 클릭을 삼켜 카드 | ||
| // 안에서 버튼만 죽은 영역이 됐다 — 카드 여백을 누르면 추억 공간이 열리고, 가장 | ||
| // 눌러 보고 싶은 버튼만 아무 일도 안 한다. 새 목적지를 지어내는 게 아니라 이미 | ||
| // 동작하는 카드의 목적지를 물려주는 것이라, 확정이 오면 이 인자만 바꾸면 된다. | ||
| MemoriesCard( | ||
| question = question, | ||
| answer = answer, | ||
| onReadAgainClick = onMemoriesSectionClick, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [normal] 이 인자를 비워 둔 것은 실수가 아니라 PR #721 리뷰에서 합의한 결정이었고, 이슈 #793 이 그 이유를 «확정 전까지 임의 목적지를 붙이지 않는 이유는 미확정 탐색 동작이 제품 동작으로 굳는 것을 막기 위해서다» 라고 명시적으로 기록해 두었다. 이 PR 의 논리(죽은 영역 > 미확정 보류, 그리고 새 목적지가 아니라 컨테이너 목적지의 승계)에는 동의한다. 다만 결정이 뒤집힌 사실이 이슈에는 남지 않는다 — 지금 상태로 머지되면 #793 은 여전히 «목적지 미확정, 무동작» 이라고 적혀 있고, 나중에 이 코드를 보는 사람은 종전 합의를 모른 채 되돌릴 수 있다. 같은 저자의 #1103 은 이 상황을 |
||
| ) | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package com.afternote.feature.mindrecord.presentation.hometab | ||
|
|
||
| import androidx.activity.ComponentActivity | ||
| import androidx.compose.foundation.interaction.MutableInteractionSource | ||
| import androidx.compose.ui.test.junit4.createAndroidComposeRule | ||
| import androidx.compose.ui.test.onNodeWithText | ||
| import androidx.compose.ui.test.performClick | ||
| import com.afternote.core.ui.theme.AfternoteTheme | ||
| import org.junit.Assert.assertEquals | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
| import org.robolectric.RobolectricTestRunner | ||
| import org.robolectric.annotation.Config | ||
|
|
||
| /** | ||
| * MEMORIES 카드의 "그날의 기록 다시 읽기" 가 죽은 영역이 아닌지 (#793). | ||
| * | ||
| * 목적지가 미확정이라 인자를 비워 뒀는데, 버튼이 자체 `clickable` 이라 클릭을 삼켰다. | ||
| * 결과는 «카드 여백을 누르면 추억 공간이 열리고, 정작 버튼만 아무 일도 안 한다» 였다. | ||
| * 최종 목적지가 확정될 때까지 버튼은 자기 컨테이너와 같은 곳으로 간다. | ||
| */ | ||
| @RunWith(RobolectricTestRunner::class) | ||
| @Config(sdk = [35]) | ||
| class MemoriesReadAgainTest { | ||
| @get:Rule | ||
| val composeRule = createAndroidComposeRule<ComponentActivity>() | ||
|
|
||
| @Test | ||
| fun `버튼을 누르면 카드와 같은 목적지로 간다`() { | ||
| var clicks = 0 | ||
| // MutableInteractionSource 는 @RememberInComposition 이라 컴포지션 안에서 맨손으로 | ||
| // 만들 수 없다 — 컴포지션마다 새 인스턴스가 생겨 상호작용 상태가 유실된다. | ||
| val interactionSource = MutableInteractionSource() | ||
| composeRule.setContent { | ||
| AfternoteTheme { | ||
| MemoriesSectionContent( | ||
| onMemoriesSectionClick = { clicks += 1 }, | ||
| clickLabel = "추억 공간 열기", | ||
| interactionSource = interactionSource, | ||
| question = "가장 소중했던 순간은?", | ||
| answer = "아이가 태어났을 때.", | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| composeRule.onNodeWithText("그날의 기록 다시 읽기").performClick() | ||
|
|
||
| assertEquals(1, clicks) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[normal]
private→internal완화의 유일한 이유가 테스트 접근으로 보인다. 이 정도는 이 레포에서 흔한 타협이라 blocking 으로 올리지 않지만, 모듈 공개 표면이 한 칸 넓어지는 것은 사실이다.homeTabMindRecordMemoriesSection(이미 public 인 LazyListScope 확장) 쪽에서 같은 클릭 경로를 태울 수 있다면 가시성을 되돌릴 수 있고, 그게 어렵다면@VisibleForTesting을 붙여 의도를 표시해 두는 편이 낫다.