Commit dd97510d authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Close folder after editting the name and hitting enter

Bug: 812828
Change-Id: I41b5880225b500cebcbf1581c18538e686f9d9c0
Reviewed-on: https://chromium-review.googlesource.com/933109
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543556}
parent 2c551613
......@@ -1191,6 +1191,28 @@ TEST_F(AppListViewFocusTest, ItemFocusedWhenContextMenuOpened) {
EXPECT_TRUE(second_suggestion_app->HasFocus());
}
// Tests that the focus is reset onto the search box and the folder exits after
// hitting enter on folder name.
TEST_P(AppListViewFocusTest, FocusResetAfterHittingEnterOnFolderName) {
Show();
// Transition to FULLSCREEN_ALL_APPS state and open the folder.
SetAppListState(AppListViewState::FULLSCREEN_ALL_APPS);
folder_item_view()->RequestFocus();
SimulateKeyPress(ui::VKEY_RETURN, false);
EXPECT_TRUE(contents_view()->GetAppsContainerView()->IsInFolderView());
// Set focus on the folder name.
views::View* folder_name_view =
app_list_folder_view()->folder_header_view()->GetFolderNameViewForTest();
folder_name_view->RequestFocus();
// Hit enter key.
SimulateKeyPress(ui::VKEY_RETURN, false);
search_box_view()->search_box()->RequestFocus();
EXPECT_FALSE(contents_view()->GetAppsContainerView()->IsInFolderView());
}
// Tests that opening the app list opens in peeking mode by default.
TEST_F(AppListViewTest, ShowPeekingByDefault) {
Initialize(0, false, false);
......
......@@ -217,6 +217,7 @@ bool FolderHeaderView::HandleKeyEvent(views::Textfield* sender,
if (key_event.key_code() == ui::VKEY_RETURN &&
key_event.type() == ui::ET_KEY_PRESSED) {
delegate_->GiveBackFocusToSearchBox();
delegate_->NavigateBack(folder_item_, key_event);
return true;
}
if (!CanProcessLeftRightKeyTraversal(key_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