Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [62.0.1]
- [BottomSheet] Fixed crash when bottom bar buttons already have consumer-provided `AutomationId` values.

## [62.0.0]
- [StepFlow] **BREAKING**: Removed `StepFlowItem.LockWhenCompleted`. Use `StepFlowItem.CanGoBack` to allow selected completed steps to be reopened before the flow is fully completed, while resetting that step and following steps for confirmation again.
- [BarcodeScanner] Fixed invalid scan-rectangle validation results restarting detection before the overlay returned to idle by waiting for the reset animation and adding a short cooldown before rescanning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ public Grid CreateBottomBar()
grid.AddColumnDefinition(new ColumnDefinition(GridLength.Star));
var index = grid.ColumnDefinitions.Count - 1;
grid.Add(button, index);
button.AutomationId = $"BottomBarButton{index}".ToDUIAutomationId<BottomSheet>();
if (button.AutomationId is null)
{
button.AutomationId = $"BottomBarButton{index}".ToDUIAutomationId<BottomSheet>();
}
}

grid.BindingContext = BindingContext;
Expand Down
25 changes: 25 additions & 0 deletions src/tests/unittests/Components/BottomSheets/BottomSheetTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using DIPS.Mobile.UI.Components.BottomSheets;
using Button = Microsoft.Maui.Controls.Button;

namespace DIPS.Mobile.UI.UnitTests.Components.BottomSheets;

public class BottomSheetTests
{
[Fact]
public void CreateBottomBar_PreservesConsumerAutomationIdsAndGeneratesMissingIds()
{
var buttonWithConsumerId = new Button { AutomationId = "Shared_ViewOptions_ResetButton" };
var buttonWithoutConsumerId = new Button();
var bottomSheet = new BottomSheet { ShowBottombarButtonsOnSubViews = true };

bottomSheet.BottombarButtons.Add(buttonWithConsumerId);
bottomSheet.BottombarButtons.Add(buttonWithoutConsumerId);

var createBottomBar = () => bottomSheet.CreateBottomBar();

createBottomBar.Should().NotThrow();

buttonWithConsumerId.AutomationId.Should().Be("Shared_ViewOptions_ResetButton");
buttonWithoutConsumerId.AutomationId.Should().Be("DUI.BottomSheet.BottomBarButton1");
}
}