mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 09:31:15 +10:00
Fix search bar overflowing behind icon buttons at narrow window sizes (#4831)
* fix(search): make search bar stretch instead of overflowing at narrow window sizes * fix(ui): sync runtime MinWidth override with XAML value Add_Loaded was hardcoding $sync.Form.MinWidth back to 1000 after load, overriding the 1150 set in inputXML.xaml and letting the window shrink below the space the search bar/toolbar layout needs. * fix(ui): address responsive search review feedback * fix(ui): enforce usable toolbar width --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
@@ -135,6 +135,7 @@ Describe "XAML document" {
|
||||
"WPFTab4BT",
|
||||
"WPFTab5BT",
|
||||
"SearchBar",
|
||||
"SearchBarIcon",
|
||||
"SearchBarClearButton",
|
||||
"appscategory",
|
||||
"appspanel",
|
||||
@@ -271,6 +272,32 @@ Describe "XAML document" {
|
||||
}
|
||||
}
|
||||
|
||||
It "keeps the responsive search controls within the available screen width" {
|
||||
$window = $script:xaml.DocumentElement
|
||||
$searchBar = $script:xaml.SelectSingleNode('//*[local-name()="TextBox"][@Name="SearchBar"]')
|
||||
$searchBorder = $searchBar.ParentNode.ParentNode
|
||||
$mainScript = Get-Content -Path $script:mainScriptPath -Raw
|
||||
|
||||
$window.GetAttribute("MinWidth") | Should -Be "800"
|
||||
$searchBorder.GetAttribute("Width") | Should -BeNullOrEmpty
|
||||
$searchBorder.GetAttribute("HorizontalAlignment") | Should -Be "Stretch"
|
||||
$searchBar.GetAttribute("Width") | Should -BeNullOrEmpty
|
||||
$searchBar.GetAttribute("HorizontalAlignment") | Should -Be "Stretch"
|
||||
$mainScript | Should -Match '\$sync\.Form\.MinWidth = "1150"'
|
||||
$mainScript | Should -Match '\$sync\.Form\.MinWidth = \[Math\]::Min\(\[double\]\$sync\.Form\.MinWidth, \[double\]\$screenWidth\)'
|
||||
}
|
||||
|
||||
It "shows only one search action glyph at a time" {
|
||||
$searchIcon = $script:xaml.SelectSingleNode('//*[local-name()="TextBlock"][@Name="SearchBarIcon"]')
|
||||
$clearButton = $script:xaml.SelectSingleNode('//*[local-name()="Button"][@Name="SearchBarClearButton"]')
|
||||
$mainScript = Get-Content -Path $script:mainScriptPath -Raw
|
||||
|
||||
$searchIcon | Should -Not -BeNullOrEmpty
|
||||
$clearButton | Should -Not -BeNullOrEmpty
|
||||
$mainScript | Should -Match '\$sync\.SearchBarClearButton\.Visibility = "Visible"\s+\$sync\.SearchBarIcon\.Visibility = "Collapsed"'
|
||||
$mainScript | Should -Match '\$sync\.SearchBarClearButton\.Visibility = "Collapsed"\s+\$sync\.SearchBarIcon\.Visibility = "Visible"'
|
||||
}
|
||||
|
||||
It "scopes toggle button styles without leaking into combo boxes" {
|
||||
$resources = $script:xaml.SelectSingleNode('//*[local-name()="Window.Resources"]')
|
||||
$implicitToggleStyles = @($resources.SelectNodes('./*[local-name()="Style"][@TargetType="ToggleButton" or @TargetType="{x:Type ToggleButton}"][not(@x:Key)]', $script:xamlNamespace))
|
||||
|
||||
Reference in New Issue
Block a user