Skip to content

Commit

Permalink
Fixed: All unit test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
MohitMaliDeveloper committed Jan 20, 2025
1 parent b56145c commit 8718526
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import org.kiwix.kiwixmobile.core.R
import org.kiwix.kiwixmobile.core.base.BaseFragment
import org.kiwix.kiwixmobile.core.base.FragmentActivityExtensions
import org.kiwix.kiwixmobile.core.databinding.FragmentPageBinding
import org.kiwix.kiwixmobile.core.downloader.downloadManager.FIVE
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.isCustomApp
import org.kiwix.kiwixmobile.core.extensions.closeKeyboard
import org.kiwix.kiwixmobile.core.extensions.setToolTipWithContentDescription
Expand Down Expand Up @@ -205,7 +206,16 @@ abstract class PageFragment : OnItemClickListener, BaseFragment(), FragmentActiv
}

state.isLoading -> {
fragmentPageBinding?.loadingZimfileContent?.visibility = View.VISIBLE
fragmentPageBinding?.loadingZimfileContent?.apply {
if (state.isLoading) {
progress = FIVE
visibility = View.VISIBLE
show()
} else {
visibility = View.GONE
hide()
}
}
}

else -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ fun historyState(
historyItems,
showAll,
zimId,
searchTerm
searchTerm,
false
)

fun bookmark(
Expand Down Expand Up @@ -148,6 +149,6 @@ fun bookmarkState(
showAll: Boolean = true,
zimId: String = "id",
searchTerm: String = ""
): BookmarkState = BookmarkState(bookmarks, showAll, zimId, searchTerm)
): BookmarkState = BookmarkState(bookmarks, showAll, zimId, searchTerm, false)

fun pageState(): TestablePageState = TestablePageState()
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class TestablePageViewModel(
var createDeletePageDialogEffectCalled = false

override fun initialState(): TestablePageState = pageState()
override fun loadData(state: TestablePageState, action: Action.LoadingData): TestablePageState =
state.copy(isLoading = action.isLoading)

override fun updatePagesBasedOnFilter(
state: TestablePageState,
Expand Down Expand Up @@ -76,7 +78,8 @@ data class TestablePageState(
override val visiblePageItems: List<PageRelated> = pageItems,
override val showAll: Boolean = true,
override val currentZimId: String? = "currentZimId",
override val searchTerm: String = ""
override val searchTerm: String = "",
override val isLoading: Boolean = false
) : PageState<Page>() {
override fun copyWithNewItems(newItems: List<Page>): PageState<Page> =
TestablePageState(pageItems = pageItems)
Expand Down

0 comments on commit 8718526

Please sign in to comment.