mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-12 02:51:16 +10:00
Turn the Install category filters into toggle chips (#4926)
* Turn the Install category filters into toggle chips - Replace the filter buttons with toggles that show which ones are active - Add ctrl click to select more than one category - Keep the search box and the category filter independent of each other - Expand matching categories while a filter is active * Fix the filter interactions the category chips missed - Pass the selected categories to the lazy rendering batches, the old call used a parameter that no longer exists and threw while typing - Keep the category filter when switching tabs, the chips stayed checked while the filter itself was dropped - Put a category back to collapsed once the filter that expanded it is gone * Document the Install category filters - Add a guide section for the chips, ctrl click and clearing the filter - Note that search and the category chips apply together * Correct the category filter guide wording - Clearing by clicking the chip only applies when it is the only one selected - Only categories with matches expand, and only auto expanded ones re-collapse
This commit is contained in:
@@ -379,12 +379,86 @@ Describe "Find-AppsByNameOrDescription" {
|
||||
$category = New-WinUtilAppCategory -Label "- Tools" -Items @($utilityItem, $powerToysItem)
|
||||
New-WinUtilAppSearchContext -Categories @($category)
|
||||
|
||||
Find-AppsByNameOrDescription -SearchString "Utilities" -Category "Utilities"
|
||||
Find-AppsByNameOrDescription -Categories @("Utilities")
|
||||
|
||||
$utilityItem.Visibility | Should -Be ([Windows.Visibility]::Visible)
|
||||
$powerToysItem.Visibility | Should -Be ([Windows.Visibility]::Collapsed)
|
||||
$category.Visibility | Should -Be ([Windows.Visibility]::Visible)
|
||||
}
|
||||
|
||||
It "shows apps from every selected category when several chips are active" {
|
||||
$utilityItem = New-WinUtilAppSearchItem -Tag "WPFInstallLiteral"
|
||||
$powerToysItem = New-WinUtilAppSearchItem -Tag "WPFInstallPowerToys"
|
||||
$browserItem = New-WinUtilAppSearchItem -Tag "WPFInstallBrowser"
|
||||
$category = New-WinUtilAppCategory -Label "- Tools" -Items @($utilityItem, $powerToysItem, $browserItem)
|
||||
New-WinUtilAppSearchContext -Categories @($category)
|
||||
|
||||
Find-AppsByNameOrDescription -Categories @("Utilities", "Microsoft Tools")
|
||||
|
||||
$utilityItem.Visibility | Should -Be ([Windows.Visibility]::Visible)
|
||||
$powerToysItem.Visibility | Should -Be ([Windows.Visibility]::Visible)
|
||||
$browserItem.Visibility | Should -Be ([Windows.Visibility]::Collapsed)
|
||||
}
|
||||
|
||||
It "applies the search text and the category filter together" {
|
||||
$powerToysItem = New-WinUtilAppSearchItem -Tag "WPFInstallPowerToys"
|
||||
$literalItem = New-WinUtilAppSearchItem -Tag "WPFInstallLiteral"
|
||||
$category = New-WinUtilAppCategory -Label "- Tools" -Items @($powerToysItem, $literalItem)
|
||||
New-WinUtilAppSearchContext -Categories @($category)
|
||||
|
||||
Find-AppsByNameOrDescription -SearchString "PowerToys" -Categories @("Microsoft Tools")
|
||||
|
||||
$powerToysItem.Visibility | Should -Be ([Windows.Visibility]::Visible)
|
||||
$literalItem.Visibility | Should -Be ([Windows.Visibility]::Collapsed)
|
||||
}
|
||||
|
||||
It "hides a category when the search text matches nothing inside the selected categories" {
|
||||
$powerToysItem = New-WinUtilAppSearchItem -Tag "WPFInstallPowerToys"
|
||||
$category = New-WinUtilAppCategory -Label "- Tools" -Items @($powerToysItem)
|
||||
New-WinUtilAppSearchContext -Categories @($category)
|
||||
|
||||
Find-AppsByNameOrDescription -SearchString "Firefox" -Categories @("Microsoft Tools")
|
||||
|
||||
$powerToysItem.Visibility | Should -Be ([Windows.Visibility]::Collapsed)
|
||||
$category.Visibility | Should -Be ([Windows.Visibility]::Collapsed)
|
||||
}
|
||||
|
||||
It "expands a collapsed category that has matches for the selected filter" {
|
||||
$powerToysItem = New-WinUtilAppSearchItem -Tag "WPFInstallPowerToys"
|
||||
$category = New-WinUtilAppCategory -Label "+ Tools" -Items @($powerToysItem)
|
||||
New-WinUtilAppSearchContext -Categories @($category)
|
||||
|
||||
Find-AppsByNameOrDescription -Categories @("Microsoft Tools")
|
||||
|
||||
$category.Children[0].Content | Should -Be "- Tools"
|
||||
$category.Children[1].Visibility | Should -Be ([Windows.Visibility]::Visible)
|
||||
}
|
||||
|
||||
It "re-collapses a category it expanded once the filter is cleared" {
|
||||
$powerToysItem = New-WinUtilAppSearchItem -Tag "WPFInstallPowerToys"
|
||||
$category = New-WinUtilAppCategory -Label "+ Tools" -Items @($powerToysItem)
|
||||
New-WinUtilAppSearchContext -Categories @($category)
|
||||
|
||||
Find-AppsByNameOrDescription -Categories @("Microsoft Tools")
|
||||
$category.Children[0].Content | Should -Be "- Tools"
|
||||
|
||||
Find-AppsByNameOrDescription -SearchString ""
|
||||
|
||||
$category.Children[0].Content | Should -Be "+ Tools"
|
||||
$category.Children[1].Visibility | Should -Be ([Windows.Visibility]::Collapsed)
|
||||
}
|
||||
|
||||
It "leaves a category the user had expanded alone when the filter is cleared" {
|
||||
$powerToysItem = New-WinUtilAppSearchItem -Tag "WPFInstallPowerToys"
|
||||
$category = New-WinUtilAppCategory -Label "- Tools" -Items @($powerToysItem)
|
||||
New-WinUtilAppSearchContext -Categories @($category)
|
||||
|
||||
Find-AppsByNameOrDescription -Categories @("Microsoft Tools")
|
||||
Find-AppsByNameOrDescription -SearchString ""
|
||||
|
||||
$category.Children[0].Content | Should -Be "- Tools"
|
||||
$category.Children[1].Visibility | Should -Be ([Windows.Visibility]::Visible)
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Find-TweaksByNameOrDescription" {
|
||||
|
||||
Reference in New Issue
Block a user