-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[MacCatalyst] Fix DatePicker Opened/Closed events not being raised #34970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+206
−17
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b6cc60
Fix for macCatalyst DatePicker Open and close events
SubhikshaSf4851 10527f6
Fix using Recursive uiTextField.
SubhikshaSf4851 d688d7e
Fixed UIdatePicker focused after close event
SubhikshaSf4851 8b91270
Optimised recursive method
SubhikshaSf4851 27a08d8
Test Sample added
SubhikshaSf4851 846faa4
modified observer changes
SubhikshaSf4851 fe3199d
Updated sugggestion
SubhikshaSf4851 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,46 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 34848, "DatePicker Opened and Closed events are not raised on MacCatalyst", PlatformAffected.macOS)] | ||
| public class Issue34848 : TestContentPage | ||
| { | ||
| DatePicker _datePicker; | ||
| Label _openStatusLabel; | ||
| Label _closeStatusLabel; | ||
| protected override void Init() | ||
| { | ||
| _openStatusLabel = new Label | ||
| { | ||
| AutomationId = "Issue34848OpenStatusLabel", | ||
| Text = "Opened: Unknown", | ||
| HorizontalOptions = LayoutOptions.Center | ||
| }; | ||
|
|
||
| _closeStatusLabel = new Label | ||
| { | ||
| AutomationId = "Issue34848CloseStatusLabel", | ||
| Text = "Closed: Unknown", | ||
| HorizontalOptions = LayoutOptions.Center | ||
| }; | ||
|
|
||
| _datePicker = new DatePicker | ||
| { | ||
| AutomationId = "Issue34848TestDatePicker", | ||
| Date = DateTime.Today, | ||
| HorizontalOptions = LayoutOptions.Center | ||
| }; | ||
|
|
||
| _datePicker.Opened += (s, e) => _openStatusLabel.Text = "Opened"; | ||
| _datePicker.Closed += (s, e) => _closeStatusLabel.Text = "Closed"; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Spacing = 10, | ||
| Children = | ||
| { | ||
| _openStatusLabel, | ||
| _closeStatusLabel, | ||
| _datePicker | ||
| } | ||
| }; | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34848.cs
This file contains hidden or 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,41 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue34848 : _IssuesUITest | ||
| { | ||
| public Issue34848(TestDevice testDevice) : base(testDevice) { } | ||
|
|
||
| public override string Issue => "DatePicker Opened and Closed events are not raised on MacCatalyst"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.DatePicker)] | ||
| public void DatePickerOpenedAndClosedEventsAreRaised() | ||
| { | ||
| App.WaitForElement("Issue34848OpenStatusLabel"); | ||
| App.WaitForElement("Issue34848CloseStatusLabel"); | ||
| App.WaitForElement("Issue34848TestDatePicker"); | ||
|
|
||
| // Open the DatePicker | ||
| App.Tap("Issue34848TestDatePicker"); | ||
|
|
||
| #if IOS | ||
| // iOS DatePicker uses a wheel picker, so we can just tap the "Done" button to close it | ||
| App.Tap("Done"); | ||
| #elif WINDOWS | ||
| // On Windows, we can tap a date to close the DatePicker | ||
| App.Tap("16"); | ||
| #elif ANDROID | ||
| // On Android, we can tap the "Cancel" button to close the DatePicker | ||
| App.Tap("Cancel"); | ||
| #else | ||
| // On MacCatalyst, we can tap outside the DatePicker to close it | ||
| App.TapCoordinates(30, 30); | ||
| #endif | ||
|
|
||
| Assert.That(App.WaitForElement("Issue34848OpenStatusLabel").GetText(), Is.EqualTo("Opened")); | ||
| Assert.That(App.WaitForElement("Issue34848CloseStatusLabel").GetText(), Is.EqualTo("Closed")); | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.