Skip to content

Commit b5e571f

Browse files
committed
Modified test
1 parent f0233ca commit b5e571f

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/Controls/tests/TestCases.HostApp/Issues/Issue18797.xaml.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using Microsoft.Maui.Controls;
2-
using Microsoft.Maui.Controls.Xaml;
3-
4-
namespace Maui.Controls.Sample.Issues
1+
namespace Maui.Controls.Sample.Issues
52
{
63
[XamlCompilation(XamlCompilationOptions.Compile)]
74
[Issue(IssueTracker.Github, 18797, "[Android] Datepicker focus and unfocus event not firing on android", PlatformAffected.Android)]
@@ -12,12 +9,12 @@ public Issue18797()
129
InitializeComponent();
1310
}
1411

15-
void DatePicker_Focused(System.Object sender, Microsoft.Maui.Controls.FocusEventArgs e)
12+
void DatePicker_Focused(object sender, FocusEventArgs e)
1613
{
1714
FocusedLabel.Text = "Focused: true";
1815
}
1916

20-
void DatePicker_Unfocused(System.Object sender, Microsoft.Maui.Controls.FocusEventArgs e)
17+
void DatePicker_Unfocused(object sender, FocusEventArgs e)
2118
{
2219
UnfocusedLabel.Text = "Unfocused: true";
2320
}

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18797.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ public void DatePickerFocusedAndUnfocusedEventsShouldFire()
2222
_ = App.WaitForElement("datePicker");
2323

2424
App.Click("datePicker");
25-
26-
((AppiumApp)App).Driver.FindElements(MobileBy.XPath("//android.widget.Button[@resource-id=\"android:id/button1\"]")).First().Click();
27-
25+
App.WaitForElement("Cancel");
26+
App.Click("Cancel");
27+
App.WaitForElement("focusedLabel");
2828
var focusedLabelText = App.FindElement("focusedLabel").GetText();
2929
var unfocusedLabelText = App.FindElement("unfocusedLabel").GetText();
3030

31-
ClassicAssert.True(focusedLabelText == "Focused: true");
32-
ClassicAssert.True(unfocusedLabelText == "Unfocused: true");
31+
Assert.That(focusedLabelText, Is.EqualTo("Focused: true"));
32+
Assert.That(unfocusedLabelText, Is.EqualTo("Unfocused: true"));
3333
}
3434
}
3535
}

0 commit comments

Comments
 (0)