-
-
Notifications
You must be signed in to change notification settings - Fork 964
feat(Sensors): Add search filter to sensor setting allow list dialog #6567
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
Draft
danielgomezrico
wants to merge
15
commits into
home-assistant:main
Choose a base branch
from
danielgomezrico:feature/search-sensor-allow-list
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2baef1b
feat(sensors): add search filter to sensor setting allow list dialog
danielgomezrico 6fdce1a
refactor(sensors): extract search field composable and hide for small…
danielgomezrico f015d0c
Update dialog
danielgomezrico 65d0321
fix(sensors): sort imports in lexicographic order for ktlint
danielgomezrico efcacd9
chore(UI): Use styles to present better data on the UI
danielgomezrico 0c07286
style(Sensors): Add braces to if/else in filterSettingEntries
danielgomezrico ec55766
style(Sensors): Convert short function signatures to single-line format
danielgomezrico b38107c
Cleanup
danielgomezrico 0f35f26
refactor(Sensors): address review feedback on multi-select bottom sheet
danielgomezrico 271dca3
test(Sensors): rename filter test to match SensorDetailSettingSheet
danielgomezrico 28cdedd
test(Sensors): cover joinSelectedValues, label parsing, and dialog st…
danielgomezrico 5f03e84
test(common): cover HASearchField debounce behaviour
danielgomezrico 9e50c02
Merge remote-tracking branch 'origin/main' into feature/search-sensor…
danielgomezrico 1182eee
style(common): collapse debouncedSearchUpdate signature to single line
danielgomezrico fee247f
fix(Sensors): satisfy Compose stability lint and drop misplaced @Visi…
danielgomezrico 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
Some comments aren't visible on the classic Files Changed page.
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
62 changes: 62 additions & 0 deletions
62
...eassistant/companion/android/settings/sensor/views/SensorDetailSettingDialogFilterTest.kt
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,62 @@ | ||
| package io.homeassistant.companion.android.settings.sensor.views | ||
|
|
||
| import org.junit.jupiter.api.Assertions.assertEquals | ||
| import org.junit.jupiter.api.Test | ||
|
|
||
| class SensorDetailSettingDialogFilterTest { | ||
|
|
||
| private val entries = listOf( | ||
| "com.google.chrome" to "Chrome\n(com.google.chrome)", | ||
| "org.mozilla.firefox" to "Firefox\n(org.mozilla.firefox)", | ||
| "com.example.app" to "Example App\n(com.example.app)", | ||
| ) | ||
|
|
||
| @Test | ||
| fun `Given empty query when filtering then return all entries`() { | ||
| val result = filterSettingEntries(entries, query = "") | ||
|
|
||
| assertEquals(entries, result) | ||
| } | ||
|
|
||
| @Test | ||
| fun `Given blank query when filtering then return all entries`() { | ||
| val result = filterSettingEntries(entries, query = " ") | ||
|
|
||
| assertEquals(entries, result) | ||
| } | ||
|
|
||
| @Test | ||
| fun `Given query matching app name when filtering then return matching entries`() { | ||
| val result = filterSettingEntries(entries, query = "Chrome") | ||
|
|
||
| assertEquals(listOf(entries[0]), result) | ||
| } | ||
|
|
||
| @Test | ||
| fun `Given query matching package name in label when filtering then return matching entries`() { | ||
| val result = filterSettingEntries(entries, query = "com.google") | ||
|
|
||
| assertEquals(listOf(entries[0]), result) | ||
| } | ||
|
|
||
| @Test | ||
| fun `Given case-insensitive query when filtering then return matches`() { | ||
| val result = filterSettingEntries(entries, query = "CHROME") | ||
|
|
||
| assertEquals(listOf(entries[0]), result) | ||
| } | ||
|
|
||
| @Test | ||
| fun `Given query matching no entries when filtering then return empty list`() { | ||
| val result = filterSettingEntries(entries, query = "nonexistent") | ||
|
|
||
| assertEquals(emptyList<Pair<String, String>>(), result) | ||
| } | ||
|
|
||
| @Test | ||
| fun `Given query with leading and trailing spaces when filtering then trim and match`() { | ||
| val result = filterSettingEntries(entries, query = " Chrome ") | ||
|
|
||
| assertEquals(listOf(entries[0]), result) | ||
| } | ||
| } |
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.