Skip to content

Commit

Permalink
Add further test cases for action sheets.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanpalmer committed Nov 18, 2020
1 parent 7b23ee4 commit b1f03f0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
20 changes: 20 additions & 0 deletions DemoApp/DemoPages/PopupDemoPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public PopupDemoPage()
Text = "Show action sheet",
Command = new Command(ShowActionSheet),
},
new Button {
Text = "Show action sheet without cancel",
Command = new Command(ShowActionSheetWithoutCancel),
},
new Button {
Text = "Show action sheet without destruction",
Command = new Command(ShowActionSheetWithoutDestruction),
},
(result = new Label()),
}
};
Expand All @@ -46,5 +54,17 @@ async void ShowActionSheet()
var result = await DisplayActionSheet("Action sheet", "Cancel", "Destroy", "Option 1", "Option 2");
this.result.Text = $"Action sheet result: {result}";
}

async void ShowActionSheetWithoutCancel()
{
var result = await DisplayActionSheet("Action sheet without cancel", null, "Destroy", "Option 1");
this.result.Text = $"Action sheet without cancel: {result}";
}

async void ShowActionSheetWithoutDestruction()
{
var result = await DisplayActionSheet("Action sheet without destruction", "Cancel", null);
this.result.Text = $"Action sheet without destruction result: {result}";
}
}
}
33 changes: 33 additions & 0 deletions Tests/PopupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,39 @@ public void TestActionSheetRendering()
[Destroy]
[Option 1]
[Option 2]
[Cancel]"));
}

[Test]
public void TestActionSheetWithoutCancel()
{
Tap("Show action sheet without cancel");
ShouldSee("Action sheet without cancel", "Destroy", "Option 1");
Tap("Option 1");
}

[Test]
public void TestActionSheetWithoutCancelRendering()
{
Tap("Show action sheet without cancel");
Assert.That(Render(), Is.EqualTo(@"Action sheet without cancel
[Destroy]
[Option 1]"));
}

[Test]
public void TestActionSheetWithoutDestruction()
{
Tap("Show action sheet without destruction");
ShouldSee("Action sheet without destruction", "Cancel");
Tap("Cancel");
}

[Test]
public void TestActionSheetWithoutDestructionRendering()
{
Tap("Show action sheet without destruction");
Assert.That(Render(), Is.EqualTo(@"Action sheet without destruction
[Cancel]"));
}
}
Expand Down

0 comments on commit b1f03f0

Please sign in to comment.