feat(content): 추천 섹션 전체 탭 이동을 연결한다
This commit is contained in:
@@ -73,6 +73,24 @@ class MainV2ActivitySourceTest {
|
||||
assertTrue(navigationSource.contains("R.id.menu_main_v2_chat -> selectChatTabWithLoginGuard()"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MainV2Activity는 콘텐츠 전체 탭 type sort 진입 contract를 제공한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
|
||||
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.common.data.ContentSort"))
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.main.content.data.MainContentAllType"))
|
||||
assertTrue(source.contains("fun openContentAllTab(type: MainContentAllType, sort: ContentSort = ContentSort.LATEST)"))
|
||||
|
||||
val openContentSource = source.substringFrom("fun openContentAllTab(type: MainContentAllType")
|
||||
assertTrue(openContentSource.contains("if (viewModel.currentTab.value != MainV2Tab.CONTENT)"))
|
||||
assertTrue(openContentSource.contains("viewModel.clickTab(MainV2Tab.CONTENT)"))
|
||||
assertTrue(openContentSource.contains("changeFragment(MainV2Tab.CONTENT)"))
|
||||
assertTrue(openContentSource.contains("supportFragmentManager.findFragmentByTag(MainV2Tab.CONTENT.toString())"))
|
||||
assertTrue(openContentSource.contains("as? ContentMainFragment"))
|
||||
assertTrue(openContentSource.contains("?.selectAllTab(type, sort)"))
|
||||
assertBefore(openContentSource, "changeFragment(MainV2Tab.CONTENT)", "?.selectAllTab(type, sort)")
|
||||
}
|
||||
|
||||
private fun assertBefore(source: String, expectedBefore: String, expectedAfter: String) {
|
||||
val beforeIndex = source.indexOf(expectedBefore)
|
||||
val afterIndex = source.indexOf(expectedAfter, beforeIndex)
|
||||
|
||||
@@ -335,6 +335,50 @@ class ContentMainFragmentSourceTest {
|
||||
assertFalse(source.contains("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `content 전체 탭 외부 선택 source는 pending 처리와 중복 초기 로드 방지를 포함한다`() {
|
||||
val source = projectFile(
|
||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/content/ContentMainFragment.kt"
|
||||
).readText()
|
||||
|
||||
assertSourceContains(source, "fun selectAllTab(type: MainContentAllType, sort: ContentSort = ContentSort.LATEST)")
|
||||
assertSourceContains(source, "private var pendingAllTabSelection: ContentAllTabSelection? = null")
|
||||
assertSourceContains(source, "pendingAllTabSelection = ContentAllTabSelection(type, sort)")
|
||||
assertSourceContains(source, "if (view != null)")
|
||||
assertSourceContains(source, "applyPendingAllTabSelection()")
|
||||
assertSourceContains(source, "private fun applyPendingAllTabSelection()")
|
||||
assertSourceContains(source, "hasSelectedAllTab = true")
|
||||
assertSourceContains(source, "binding.textTabBarContent.root.selectTab(CONTENT_TAB_ALL)")
|
||||
assertSourceContains(source, "showContentTab(CONTENT_TAB_ALL)")
|
||||
assertSourceContains(source, "contentAllTabViewModel.selectTypeAndSort(selection.type, selection.sort)")
|
||||
assertTrue(
|
||||
"전체 탭 selectTab listener가 loadInitial을 일으키지 않도록 hasSelectedAllTab을 먼저 설정해야 한다.",
|
||||
source.indexOf("hasSelectedAllTab = true") <
|
||||
source.indexOf("binding.textTabBarContent.root.selectTab(CONTENT_TAB_ALL)")
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `content 추천 기존 전체보기 chevron은 MainV2Activity 전체 탭 routing을 호출한다`() {
|
||||
val source = projectFile(
|
||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/content/ContentMainFragment.kt"
|
||||
).readText()
|
||||
|
||||
assertSourceContains(source, "import kr.co.vividnext.sodalive.v2.main.MainV2Activity")
|
||||
assertSourceContains(source, "private fun openContentAllTab(type: MainContentAllType, sort: ContentSort)")
|
||||
assertSourceContains(source, "ensureMainV2NavigationAllowed")
|
||||
assertSourceContains(source, "(activity as? MainV2Activity)?.openContentAllTab(type, sort)")
|
||||
assertSourceContains(source, "binding.viewContentOriginalSeriesTitle.ivSectionTitleChevron.setOnClickListener")
|
||||
assertSourceContains(source, "openContentAllTab(MainContentAllType.ORIGINAL, ContentSort.LATEST)")
|
||||
assertSourceContains(source, "binding.viewContentLatestAudioTitle.ivSectionTitleChevron.setOnClickListener")
|
||||
assertSourceContains(source, "openContentAllTab(MainContentAllType.AUDIO, ContentSort.LATEST)")
|
||||
assertSourceContains(source, "binding.viewContentFreeAudioTitle.ivSectionTitleChevron.setOnClickListener")
|
||||
assertSourceContains(source, "openContentAllTab(MainContentAllType.FREE, ContentSort.POPULAR)")
|
||||
assertSourceContains(source, "binding.viewContentPointAudioTitle.ivSectionTitleChevron.setOnClickListener")
|
||||
assertSourceContains(source, "openContentAllTab(MainContentAllType.POINT, ContentSort.POPULAR)")
|
||||
assertFalse(source.contains("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Phase 4~5 adapter source는 grouping과 badge comment 정책을 포함한다`() {
|
||||
val cardView = projectFile(
|
||||
|
||||
Reference in New Issue
Block a user