[PM-40535] fix: Organization policy restriction notice padding and icon (#7341)

This commit is contained in:
André Bispo authored and GitHub committed 2026-09-01 17:04:03 +00:00
1 parent 8152f5c6f8
commit bcace0727a
3 files changed
+38 -6

No files matched your search

@@ -18,7 +18,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
@@ -263,8 +262,7 @@ private fun ViewStateContent(
leadingContent = {
BitwardenIcon(
iconData = IconData.Local(iconRes = BitwardenDrawable.ic_info_circle),
tint = BitwardenTheme.colorScheme.text.primary,
modifier = Modifier.size(size = 16.dp),
tint = BitwardenTheme.colorScheme.icon.secondary,
)
},
modifier = Modifier
@@ -44,9 +44,9 @@ import com.bitwarden.ui.util.asText
* button, and leading icon content.
*
* @param cardTitle The title of the card.
* @param modifier The [Modifier] to be applied to the card.
* @param actionButton The data for the CTA button, or `null` to omit it, which suits a card that
* only explains something.
* @param modifier The [Modifier] to be applied to the card.
* @param onDismissClick Optional action to perform when the dismiss button is clicked.
* @param cardSubtitle The subtitle of the card.
* @param secondaryButton The optional data for a secondary button.
@@ -118,12 +118,16 @@ fun BitwardenActionCard(
}
}
}
onDismissClick?.let {
if (onDismissClick != null) {
BitwardenStandardIconButton(
painter = rememberVectorPainter(id = BitwardenDrawable.ic_close),
contentDescription = stringResource(id = BitwardenString.close),
onClick = it,
onClick = onDismissClick,
)
} else {
// The dismiss button normally supplies the trailing inset, so without it the
// content would otherwise run to the edge of the card.
Spacer(modifier = Modifier.width(width = 16.dp))
}
}
if (actionButton != null || secondaryButton != null) {
@@ -1,13 +1,18 @@
package com.bitwarden.ui.platform.components.card
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.getUnclippedBoundsInRoot
import androidx.compose.ui.test.hasClickAction
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import com.bitwarden.ui.platform.base.BaseComposeTest
import com.bitwarden.ui.platform.components.button.model.BitwardenButtonData
import com.bitwarden.ui.platform.theme.BitwardenTheme
import com.bitwarden.ui.util.asText
import org.junit.Assert.assertEquals
import org.junit.Test
class BitwardenActionCardTest : BaseComposeTest() {
@@ -87,4 +92,29 @@ class BitwardenActionCardTest : BaseComposeTest() {
.onNodeWithText(text = "Learn more")
.assertIsDisplayed()
}
@Test
fun `content is inset from the trailing edge when the dismiss button is omitted`() {
setTestContent {
BitwardenTheme {
BitwardenActionCard(
cardTitle = "Title",
cardSubtitle = "Subtitle",
modifier = Modifier.testTag(tag = "ActionCard"),
)
}
}
val cardRight = composeTestRule
.onNodeWithTag(testTag = "ActionCard")
.getUnclippedBoundsInRoot()
.right
val subtitleRight = composeTestRule
.onNodeWithText(text = "Subtitle")
.getUnclippedBoundsInRoot()
.right
// Without a dismiss button there is nothing else to inset the text, so the card itself
// must keep the content 16dp away from its trailing edge.
assertEquals(16f, (cardRight - subtitleRight).value, 0.5f)
}
}