Commit 0fb92001 authored by My Nguyen's avatar My Nguyen Committed by Commit Bot

Allow pressing up to enter emoji suggestion popup

Updated according to UX designer.

Bug: 1109570
Change-Id: I0a39e294dd023241680a936e2551f160307402b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2319806Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: My Nguyen <myy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791703}
parent ca8066ee
......@@ -150,8 +150,8 @@ SuggestionStatus EmojiSuggester::HandleKeyEvent(
return SuggestionStatus::kDismiss;
}
if (highlighted_index_ == kNoneHighlighted && buttons_.size() > 0) {
if (event.key == "Down") {
highlighted_index_ = 0;
if (event.key == "Down" || event.key == "Up") {
highlighted_index_ = event.key == "Down" ? 0 : buttons_.size() - 1;
ShowSuggestionWindowWithIndices(true);
SetButtonHighlighted(buttons_[highlighted_index_], true);
return SuggestionStatus::kBrowsing;
......
......@@ -168,20 +168,10 @@ TEST_F(EmojiSuggesterTest, ReturnkBrowsingWhenPressingDown) {
emoji_suggester_->HandleKeyEvent(event));
}
TEST_F(EmojiSuggesterTest, ReturnkNotHandledWhenPressingUp) {
TEST_F(EmojiSuggesterTest, ReturnkBrowsingWhenPressingUp) {
EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy ")));
InputMethodEngineBase::KeyboardEvent event;
event.key = "Up";
EXPECT_EQ(SuggestionStatus::kNotHandled,
emoji_suggester_->HandleKeyEvent(event));
}
TEST_F(EmojiSuggesterTest, ReturnkBrowsingWhenPressingDownAndUp) {
EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy ")));
// Go into the window.
Press("Down");
InputMethodEngineBase::KeyboardEvent event;
event.key = "Up";
EXPECT_EQ(SuggestionStatus::kBrowsing,
emoji_suggester_->HandleKeyEvent(event));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment