Browse Source

Fixed datepicker tests

Tig 10 months ago
parent
commit
49c6f7a0a7
2 changed files with 3 additions and 7 deletions
  1. 1 1
      Terminal.Gui/View/View.Navigation.cs
  2. 2 6
      UnitTests/Views/DatePickerTests.cs

+ 1 - 1
Terminal.Gui/View/View.Navigation.cs

@@ -665,7 +665,7 @@ public partial class View // Focus and cross-view navigation management (TabStop
 
         if (SuperView is { })
         {
-            //SuperView._previouslyMostFocused = focusedPeer;
+            SuperView._previouslyMostFocused = focusedPeer;
         }
 
         // Post-conditions - prove correctness

+ 2 - 6
UnitTests/Views/DatePickerTests.cs

@@ -86,10 +86,8 @@ public class DatePickerTests
         Assert.Equal (12, datePicker.Date.Month);
 
         // Next month button is disabled, so focus advanced to edit field
-        Assert.Equal (datePicker.Subviews.First (v => v.Id == "_dateField"), datePicker.Focused);
+        Assert.Equal (datePicker.Subviews.First (v => v.Id == "_previousMonthButton"), datePicker.Focused);
 
-        // Pressing enter on datefield does nothing
-        Assert.False (Application.OnKeyDown (Key.Enter));
         top.Dispose ();
     }
 
@@ -117,10 +115,8 @@ public class DatePickerTests
         Assert.Equal (1, datePicker.Date.Month);
 
         // Next prev button is disabled, so focus advanced to edit button
-        Assert.Equal (datePicker.Subviews.First (v => v.Id == "_dateField"), datePicker.Focused);
+        Assert.Equal (datePicker.Subviews.First (v => v.Id == "_calendar"), datePicker.Focused);
 
-        // Pressing enter on datefield does nothing
-        Assert.False (Application.OnKeyDown (Key.Enter));
         top.Dispose ();
     }
 }