-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Siddharth Agarwal
committed
Sep 5, 2024
1 parent
90e03cc
commit d4233f8
Showing
2 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
149 changes: 149 additions & 0 deletions
149
...m/src/androidUnitTest/kotlin/org/hisp/dhis/mobile/ui/designsystem/MenuItemSnapshotTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
package org.hisp.dhis.mobile.ui.designsystem | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.automirrored.outlined.ArrowRight | ||
import androidx.compose.material.icons.outlined.Done | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer | ||
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnScreenContainer | ||
import org.hisp.dhis.mobile.ui.designsystem.component.MenuItem | ||
import org.hisp.dhis.mobile.ui.designsystem.component.MenuItemData | ||
import org.hisp.dhis.mobile.ui.designsystem.component.MenuItemState | ||
import org.hisp.dhis.mobile.ui.designsystem.component.MenuItemStyle | ||
import org.hisp.dhis.mobile.ui.designsystem.component.MenuLeadingElement | ||
import org.hisp.dhis.mobile.ui.designsystem.component.MenuTrailingElement | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class MenuItemSnapshotTest { | ||
@get:Rule | ||
val paparazzi = paparazzi() | ||
|
||
@Test | ||
fun launchMenuItemTest() { | ||
paparazzi.snapshot { | ||
ColumnScreenContainer("Menu Item") { | ||
ColumnComponentContainer("Menu item") { | ||
Column( | ||
modifier = Modifier.fillMaxWidth(), | ||
verticalArrangement = Arrangement.spacedBy(20.dp), | ||
) { | ||
Row( | ||
horizontalArrangement = Arrangement.spacedBy(20.dp), | ||
) { | ||
MenuItem( | ||
modifier = Modifier.weight(1f), | ||
menuItemData = MenuItemData( | ||
label = "Menu Item", | ||
supportingText = "Supporting Text", | ||
showDivider = true, | ||
leadingElement = MenuLeadingElement.Icon( | ||
icon = Icons.Outlined.Done, | ||
), | ||
trailingElement = MenuTrailingElement.Icon( | ||
icon = Icons.AutoMirrored.Outlined.ArrowRight, | ||
), | ||
), | ||
) {} | ||
|
||
MenuItem( | ||
modifier = Modifier.weight(1f), | ||
menuItemData = MenuItemData( | ||
label = "Menu Item", | ||
supportingText = "Supporting Text", | ||
showDivider = true, | ||
style = MenuItemStyle.ALERT, | ||
leadingElement = MenuLeadingElement.Icon( | ||
icon = Icons.Outlined.Done, | ||
), | ||
trailingElement = MenuTrailingElement.Icon( | ||
icon = Icons.AutoMirrored.Outlined.ArrowRight, | ||
), | ||
), | ||
) {} | ||
} | ||
|
||
Row( | ||
horizontalArrangement = Arrangement.spacedBy(20.dp), | ||
) { | ||
MenuItem( | ||
modifier = Modifier.weight(1f), | ||
menuItemData = MenuItemData( | ||
label = "Menu Item", | ||
supportingText = "Supporting Text", | ||
showDivider = true, | ||
state = MenuItemState.SELECTED, | ||
leadingElement = MenuLeadingElement.Icon( | ||
icon = Icons.Outlined.Done, | ||
), | ||
trailingElement = MenuTrailingElement.Icon( | ||
icon = Icons.AutoMirrored.Outlined.ArrowRight, | ||
), | ||
), | ||
) {} | ||
|
||
MenuItem( | ||
modifier = Modifier.weight(1f), | ||
menuItemData = MenuItemData( | ||
label = "Menu Item", | ||
supportingText = "Supporting Text", | ||
showDivider = true, | ||
state = MenuItemState.SELECTED, | ||
style = MenuItemStyle.ALERT, | ||
leadingElement = MenuLeadingElement.Icon( | ||
icon = Icons.Outlined.Done, | ||
), | ||
trailingElement = MenuTrailingElement.Icon( | ||
icon = Icons.AutoMirrored.Outlined.ArrowRight, | ||
), | ||
), | ||
) {} | ||
} | ||
|
||
Row( | ||
horizontalArrangement = Arrangement.spacedBy(20.dp), | ||
) { | ||
MenuItem( | ||
modifier = Modifier.weight(1f), | ||
menuItemData = MenuItemData( | ||
label = "Menu Item", | ||
supportingText = "Supporting Text", | ||
showDivider = true, | ||
state = MenuItemState.DISABLED, | ||
leadingElement = MenuLeadingElement.Icon( | ||
icon = Icons.Outlined.Done, | ||
), | ||
trailingElement = MenuTrailingElement.Icon( | ||
icon = Icons.AutoMirrored.Outlined.ArrowRight, | ||
), | ||
), | ||
) {} | ||
|
||
MenuItem( | ||
modifier = Modifier.weight(1f), | ||
menuItemData = MenuItemData( | ||
label = "Menu Item", | ||
supportingText = "Supporting Text", | ||
showDivider = true, | ||
state = MenuItemState.DISABLED, | ||
style = MenuItemStyle.ALERT, | ||
leadingElement = MenuLeadingElement.Icon( | ||
icon = Icons.Outlined.Done, | ||
), | ||
trailingElement = MenuTrailingElement.Icon( | ||
icon = Icons.AutoMirrored.Outlined.ArrowRight, | ||
), | ||
), | ||
) {} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Binary file added
BIN
+21 KB
...rg.hisp.dhis.mobile.ui.designsystem_MenuItemSnapshotTest_launchMenuItemTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.