diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragment.kt index 200d2557..dc529fba 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragment.kt @@ -18,7 +18,12 @@ class CreatorChannelDonationFragment : BaseFragment + viewModel.postChannelDonation(can, isSecret, message) + } + } ) private var lastContentLayoutKey: CreatorChannelDonationContentLayoutKey? = null private val creatorId: Long by lazy { arguments?.getLong(ARG_CREATOR_ID) ?: 0L } @@ -56,9 +61,7 @@ class CreatorChannelDonationFragment : BaseFragment @@ -75,11 +78,6 @@ class CreatorChannelDonationFragment : BaseFragment - viewModel.postChannelDonation(can, isSecret, message) - } - } } private fun observeViewModel() { @@ -99,8 +97,6 @@ class CreatorChannelDonationFragment : BaseFragment - - - - - - - - - - - - ")) - assertTrue(fragment.contains("viewModel.postChannelDonation(can, isSecret, message)")) + assertFalse(fragment.contains("btnCreatorChannelDonationEmptyWrite")) } @Test @@ -85,9 +84,14 @@ class CreatorChannelDonationActionTest { assertTrue(adapter.contains("ItemCreatorChannelDonationBinding")) assertTrue(adapter.contains("ItemCreatorChannelDonationRankingBinding")) + assertTrue(adapter.contains("ItemCreatorChannelDonationEmptyBinding")) assertTrue(adapter.contains("submitItems")) + assertTrue(adapter.contains("submitEmpty")) assertTrue(adapter.contains("onRankingAllClick")) + assertTrue(adapter.contains("onEmptyDonationClick")) assertTrue(adapter.contains("btnCreatorChannelDonationRankingAll.setOnClickListener")) + assertTrue(adapter.contains("btnCreatorChannelDonationEmptyWrite.isVisible = !isOwner")) + assertTrue(adapter.contains("btnCreatorChannelDonationEmptyWrite.setOnClickListener")) assertTrue(adapter.contains("setBackgroundColor(root.context.getColor(item.headerColorResId))")) assertTrue(adapter.contains("R.string.creator_channel_donation_can_format")) assertTrue(adapter.contains("GridLayoutManager(itemView.context, 4)")) diff --git a/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragmentLayoutTest.kt b/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragmentLayoutTest.kt index a3b05934..9d8eb3eb 100644 --- a/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragmentLayoutTest.kt +++ b/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/CreatorChannelDonationFragmentLayoutTest.kt @@ -23,38 +23,33 @@ import java.io.File class CreatorChannelDonationFragmentLayoutTest { @Test - fun `후원 fragment layout은 list empty error retry floating button을 제공한다`() { + fun `후원 fragment layout은 list error retry를 제공하고 empty overlay를 만들지 않는다`() { val root = inflateView(R.layout.fragment_creator_channel_donation) val layout = projectFile("app/src/main/res/layout/fragment_creator_channel_donation.xml").readText() val countBar = requireNotNull(root.findViewById(R.id.layout_creator_channel_donation_count_bar)) val donationList = requireNotNull(root.findViewById(R.id.rv_creator_channel_donation)) - val emptyContainer = requireNotNull(root.findViewById(R.id.layout_creator_channel_donation_empty)) - val emptyMessage = requireNotNull(root.findViewById(R.id.tv_creator_channel_donation_empty_message)) - val emptyDonationButton = requireNotNull(root.findViewById(R.id.btn_creator_channel_donation_empty_write)) val errorMessage = requireNotNull(root.findViewById(R.id.tv_creator_channel_donation_error_message)) val retryButton = requireNotNull(root.findViewById(R.id.btn_creator_channel_donation_retry)) assertSame(root, countBar.parent) assertSame(root, donationList.parent) - assertSame(root, emptyContainer.parent) - assertSame(emptyContainer, emptyMessage.parent) - assertSame(emptyContainer, emptyDonationButton.parent) assertSame(root, errorMessage.parent) assertSame(root, retryButton.parent) assertTrue(layout.contains("android:background=\"@color/black\"")) assertTrue(layout.contains("tools:listitem=\"@layout/item_creator_channel_donation\"")) + assertTrue(!layout.contains("layout_creator_channel_donation_empty")) assertTrue(!layout.contains("btn_creator_channel_donation_write")) assertTrue(!layout.contains("creator_channel_donation_sort")) } @Test - fun `후원 empty layout은 Figma 중앙 capsule 후원하기 button을 제공한다`() { - val root = inflateView(R.layout.fragment_creator_channel_donation) - val layout = projectFile("app/src/main/res/layout/fragment_creator_channel_donation.xml").readText() + fun `후원 empty item layout은 Figma capsule 후원하기 button을 제공하고 minHeight를 쓰지 않는다`() { + val item = inflateView(R.layout.item_creator_channel_donation_empty) + val layout = projectFile("app/src/main/res/layout/item_creator_channel_donation_empty.xml").readText() - val emptyContainer = requireNotNull(root.findViewById(R.id.layout_creator_channel_donation_empty)) - val emptyDonationButton = requireNotNull(root.findViewById(R.id.btn_creator_channel_donation_empty_write)) + val emptyContainer = requireNotNull(item.findViewById(R.id.layout_creator_channel_donation_empty)) + val emptyDonationButton = requireNotNull(item.findViewById(R.id.btn_creator_channel_donation_empty_write)) assertSame(emptyContainer, emptyDonationButton.parent) assertNotNull(emptyDonationButton.findViewById(R.id.iv_creator_channel_donation_empty_write)) @@ -64,6 +59,8 @@ class CreatorChannelDonationFragmentLayoutTest { assertTrue(layout.contains("android:background=\"@drawable/bg_creator_channel_donation_empty_button\"")) assertTrue(layout.contains("android:layout_marginTop=\"@dimen/spacing_14\"")) assertTrue(layout.contains("android:src=\"@drawable/ic_new_donation\"")) + assertTrue(layout.contains("android:paddingTop=\"@dimen/spacing_48\"")) + assertTrue(!layout.contains("minHeight")) assertTrue( projectFile("app/src/main/res/drawable/bg_creator_channel_donation_empty_button.xml") .readText() @@ -91,6 +88,8 @@ class CreatorChannelDonationFragmentLayoutTest { val adapter = projectFile( "app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/donation/ui/CreatorChannelDonationAdapter.kt" ).readText() + val rankingIndex = adapter.indexOf("add(CreatorChannelDonationListItem.Ranking(rankings))") + val emptyIndex = adapter.indexOf("add(CreatorChannelDonationListItem.Empty(isOwner))") assertNotNull(item.findViewById(R.id.tv_creator_channel_donation_ranking_title)) assertNotNull(item.findViewById(R.id.rv_creator_channel_donation_ranking_members)) @@ -104,6 +103,8 @@ class CreatorChannelDonationFragmentLayoutTest { assertTrue(adapter.contains("CreatorChannelDonationRankingItemDecoration(itemView.context, spanCount = 4)")) assertTrue(adapter.contains("column * spacing / spanCount")) assertTrue(adapter.contains("spacing - (column + 1) * spacing / spanCount")) + assertTrue(rankingIndex >= 0) + assertTrue(emptyIndex > rankingIndex) } @Test