File tree Expand file tree Collapse file tree
src/MaterialDesignThemes.Wpf
tests/MaterialDesignThemes.UITests/WPF Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 120120 Template =" {StaticResource CalendarButtonTemplate}" />
121121 <Popup x : Name =" PART_Popup"
122122 AllowsTransparency =" True"
123- CustomPopupPlacementCallback =" {x:Static wpf:CustomPopupPlacementCallbackHelper.LargePopupCallback}"
124- Placement =" Custom"
123+ Placement =" Bottom"
125124 PlacementTarget =" {Binding ElementName=PART_TextBox}"
126125 PopupAnimation =" Fade"
127126 StaysOpen =" False" />
Original file line number Diff line number Diff line change 132132 Template =" {StaticResource ClockButtonTemplate}" />
133133 <Popup x : Name =" PART_Popup"
134134 AllowsTransparency =" True"
135- CustomPopupPlacementCallback =" {x:Static wpf:CustomPopupPlacementCallbackHelper.LargePopupCallback}"
136- Placement =" Custom"
135+ Placement =" Bottom"
137136 PlacementTarget =" {Binding ElementName=PART_TextBox}"
138137 PopupAnimation =" Fade"
139138 StaysOpen =" False" />
Original file line number Diff line number Diff line change @@ -333,6 +333,35 @@ public async Task DatePicker_ShouldApplyIsMouseOverTriggers_WhenHoveringCalendar
333333
334334 recorder . Success ( ) ;
335335 }
336+
337+ [ Test ]
338+ [ Description ( "Issue 4050" ) ]
339+ public async Task DatePicker_PopupOpensBelowTextBoxByDefault ( )
340+ {
341+ await using var recorder = new TestRecorder ( App ) ;
342+
343+ var stackPanel = await LoadXaml < StackPanel > ( """
344+ <StackPanel Margin="40">
345+ <DatePicker Width="200" />
346+ </StackPanel>
347+ """ ) ;
348+ var datePicker = await stackPanel . GetElement < DatePicker > ( "/DatePicker" ) ;
349+ var datePickerTextBox = await datePicker . GetElement < DatePickerTextBox > ( "/DatePickerTextBox" ) ;
350+ var button = await datePicker . GetElement < Button > ( "PART_Button" ) ;
351+ var popup = await datePicker . GetElement < Popup > ( "PART_Popup" ) ;
352+
353+ await button . LeftClick ( ) ;
354+ await Wait . For ( async ( ) => await popup . GetIsOpen ( ) ) ;
355+
356+ Rect ? textBoxCoordinates = await datePickerTextBox . GetCoordinates ( ) ;
357+ Rect ? popupCoordinates = await popup . GetCoordinates ( ) ;
358+
359+ await Assert . That ( textBoxCoordinates ) . IsNotNull ( ) ;
360+ await Assert . That ( popupCoordinates ) . IsNotNull ( ) ;
361+ await Assert . That ( popupCoordinates . Value . Top ) . IsGreaterThanOrEqualTo ( textBoxCoordinates . Value . Bottom - 1 ) ;
362+
363+ recorder . Success ( ) ;
364+ }
336365}
337366
338367public class FutureDateValidationRule : ValidationRule
Original file line number Diff line number Diff line change @@ -642,6 +642,35 @@ public async Task TimePicker_ShouldApplyIsMouseOverTriggers_WhenHoveringTimeButt
642642 recorder . Success ( ) ;
643643 }
644644
645+ [ Test ]
646+ [ Description ( "Issue 4050" ) ]
647+ public async Task TimePicker_PopupOpensBelowTextBoxByDefault ( )
648+ {
649+ await using var recorder = new TestRecorder ( App ) ;
650+
651+ var stackPanel = await LoadXaml < StackPanel > ( """
652+ <StackPanel Margin="40">
653+ <materialDesign:TimePicker Width="200" />
654+ </StackPanel>
655+ """ ) ;
656+ var timePicker = await stackPanel . GetElement < TimePicker > ( "/TimePicker" ) ;
657+ var timePickerTextBox = await timePicker . GetElement < TimePickerTextBox > ( "/TimePickerTextBox" ) ;
658+ var button = await timePicker . GetElement < Button > ( "PART_Button" ) ;
659+ var popup = await timePicker . GetElement < Popup > ( "PART_Popup" ) ;
660+
661+ await button . LeftClick ( ) ;
662+ await Wait . For ( async ( ) => await popup . GetIsOpen ( ) ) ;
663+
664+ Rect ? textBoxCoordinates = await timePickerTextBox . GetCoordinates ( ) ;
665+ Rect ? popupCoordinates = await popup . GetCoordinates ( ) ;
666+
667+ await Assert . That ( textBoxCoordinates ) . IsNotNull ( ) ;
668+ await Assert . That ( popupCoordinates ) . IsNotNull ( ) ;
669+ await Assert . That ( popupCoordinates . Value . Top ) . IsGreaterThanOrEqualTo ( textBoxCoordinates . Value . Bottom - 1 ) ;
670+
671+ recorder . Success ( ) ;
672+ }
673+
645674 [ Test ]
646675 [ Description ( "Issue 3650" ) ]
647676 public async Task TimePicker_MovesFocusToPrevious_WhenShiftAndTabIsPressed ( )
You can’t perform that action at this time.
0 commit comments