Skip to content

Commit

Permalink
Fix searchbar cancel button color test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hartez committed Dec 20, 2023
1 parent 33e9249 commit 9fbc6d3
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ public async Task CancelButtonColorInitializesCorrectly(uint color)
CancelButtonColor = expected
};

searchBar.Focus();
// The cancel button won't exist in the SearchBar until the SearchBar is loaded (and OnApplyTemplate is called)
// so we need to attach the SearchBar to the running app before we can check the color

await AttachAndRun(searchBar, async (searchBarHandler) =>
{
await AssertEventually(() => searchBarHandler.PlatformView.FocusState != UI.Xaml.FocusState.Unfocused);
await ValidatePropertyInitValue(searchBar, () => searchBar.CancelButtonColor, GetNativeCancelButtonColor, expected);
});

await ValidatePropertyInitValue(searchBar, () => searchBar.CancelButtonColor, GetNativeCancelButtonColor, expected);
}

static AutoSuggestBox GetNativeSearchBar(SearchBarHandler searchBarHandler) =>
Expand Down

0 comments on commit 9fbc6d3

Please sign in to comment.