mirror of
https://github.com/bitwarden/android.git
synced 2024-11-26 03:16:10 +03:00
BIT-2040 Correct redirect behavior for Import Items action (#1150)
This commit is contained in:
parent
143a46165c
commit
3ba2f704e3
3 changed files with 10 additions and 8 deletions
|
@ -117,7 +117,7 @@ fun VaultSettingsScreen(
|
|||
dialogMessage =
|
||||
stringResource(
|
||||
id = R.string.you_can_import_data_to_your_vault_on_x,
|
||||
state.value.baseUrl,
|
||||
state.value.importUrl,
|
||||
),
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "ImportItemsLinkItemView" }
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.x8bit.bitwarden.ui.platform.feature.settings.vault
|
||||
|
||||
import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository
|
||||
import com.x8bit.bitwarden.data.platform.repository.util.baseWebVaultUrlOrDefault
|
||||
import com.x8bit.bitwarden.data.platform.repository.util.toBaseWebVaultImportUrl
|
||||
import com.x8bit.bitwarden.ui.platform.base.BaseViewModel
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
|
@ -16,10 +15,6 @@ class VaultSettingsViewModel @Inject constructor(
|
|||
) : BaseViewModel<VaultSettingsState, VaultSettingsEvent, VaultSettingsAction>(
|
||||
initialState = run {
|
||||
VaultSettingsState(
|
||||
baseUrl = environmentRepository
|
||||
.environment
|
||||
.environmentUrlData
|
||||
.baseWebVaultUrlOrDefault,
|
||||
importUrl = environmentRepository
|
||||
.environment
|
||||
.environmentUrlData
|
||||
|
@ -58,7 +53,6 @@ class VaultSettingsViewModel @Inject constructor(
|
|||
* Models the state for the VaultSettingScreen.
|
||||
*/
|
||||
data class VaultSettingsState(
|
||||
val baseUrl: String,
|
||||
val importUrl: String,
|
||||
)
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class VaultSettingsScreenTest : BaseComposeTest() {
|
|||
private val mutableEventFlow = bufferedMutableSharedFlow<VaultSettingsEvent>()
|
||||
private val mutableStateFlow = MutableStateFlow(
|
||||
VaultSettingsState(
|
||||
baseUrl = "testUrl", importUrl = "testUrl/#/tools/import",
|
||||
importUrl = "testUrl/#/tools/import",
|
||||
),
|
||||
)
|
||||
private val intentManager: IntentManager = mockk(relaxed = true) {
|
||||
|
@ -97,6 +97,14 @@ class VaultSettingsScreenTest : BaseComposeTest() {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `import items click should display dialog with importUrl`() {
|
||||
composeTestRule.onNodeWithText("Import items").performClick()
|
||||
composeTestRule
|
||||
.onNodeWithText(mutableStateFlow.value.importUrl, substring = true)
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `NavigateBack should call onNavigateBack`() {
|
||||
mutableEventFlow.tryEmit(VaultSettingsEvent.NavigateBack)
|
||||
|
|
Loading…
Reference in a new issue