mirror of
https://github.com/bitwarden/android.git
synced 2025-03-15 18:58:59 +03:00
BIT-1592 Update element ID location for search items (#970)
This commit is contained in:
parent
dc2e07c130
commit
80a024f9dd
6 changed files with 16 additions and 5 deletions
|
@ -26,6 +26,7 @@ import com.x8bit.bitwarden.ui.platform.components.SelectionItemData
|
|||
import com.x8bit.bitwarden.ui.platform.components.model.toIconResources
|
||||
import com.x8bit.bitwarden.ui.platform.feature.search.handlers.SearchHandlers
|
||||
import com.x8bit.bitwarden.ui.platform.feature.search.model.AutofillSelectionOption
|
||||
import com.x8bit.bitwarden.ui.platform.feature.search.util.searchItemTestTag
|
||||
import com.x8bit.bitwarden.ui.vault.feature.itemlisting.model.ListingItemOverflowAction
|
||||
import kotlinx.collections.immutable.toPersistentList
|
||||
|
||||
|
@ -37,6 +38,7 @@ import kotlinx.collections.immutable.toPersistentList
|
|||
fun SearchContent(
|
||||
viewState: SearchState.ViewState.Content,
|
||||
searchHandlers: SearchHandlers,
|
||||
searchType: SearchTypeData,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var showConfirmationDialog: ListingItemOverflowAction? by rememberSaveable {
|
||||
|
@ -153,7 +155,7 @@ fun SearchContent(
|
|||
}
|
||||
.toPersistentList(),
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "CipherCell" }
|
||||
.semantics { testTag = searchType.searchItemTestTag }
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = 16.dp,
|
||||
|
|
|
@ -15,6 +15,8 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
|
@ -47,6 +49,7 @@ fun SearchEmptyContent(
|
|||
Text(
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "NoSearchResultsLabel" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
text = it(),
|
||||
|
|
|
@ -130,6 +130,7 @@ fun SearchScreen(
|
|||
is SearchState.ViewState.Content -> SearchContent(
|
||||
viewState = viewState,
|
||||
searchHandlers = searchHandlers,
|
||||
searchType = state.searchType,
|
||||
modifier = innerModifier,
|
||||
)
|
||||
|
||||
|
|
|
@ -63,6 +63,15 @@ fun SearchTypeData.updateWithAdditionalDataIfNecessary(
|
|||
SearchTypeData.Vault.VerificationCodes -> this
|
||||
}
|
||||
|
||||
/**
|
||||
* The semantic test tag to use for the search item.
|
||||
*/
|
||||
val SearchTypeData.searchItemTestTag: String
|
||||
get() = when (this) {
|
||||
is SearchTypeData.Sends -> "SendCell"
|
||||
is SearchTypeData.Vault -> "CipherCell"
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out any [CipherView]s that do not adhere to the [searchTypeData] and [searchTerm] and
|
||||
* sorts the remaining items.
|
||||
|
|
|
@ -108,7 +108,6 @@ fun SendContent(
|
|||
null
|
||||
},
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "SendCell" }
|
||||
.padding(
|
||||
start = 16.dp,
|
||||
// There is some built-in padding to the menu button that makes up
|
||||
|
|
|
@ -15,8 +15,6 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
|
@ -52,7 +50,6 @@ fun SendEmpty(
|
|||
text = stringResource(id = R.string.no_sends),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier
|
||||
.semantics { testTag = "NoSearchResultsLabel" }
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue