on xenial help sign in
keepPanel open means keep, not reopen if it wasn't open
commit149f24354064e022558ded7a53eb28081d74e406 authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 1 Oct 2015, 15:39 (11 years ago) parent68e1d2b
2 files changed+23−2
qml/Dash/GenericScopeView.qml+3−2 tests/qmltests/Dash/tst_DashContent.qml+20
qml/Dash/GenericScopeView.qml+3−2
@@ -635,11 +635,12 @@ FocusScope {
635635 onSettingsClicked: subPageLoader.openSubPage("settings")
636636 onFavoriteClicked: scopeView.scope.favorite = !scopeView.scope.favorite
637637 onSearchTextFieldFocused: scopeView.showHeader()
638− onClearSearch: {
638+ onClearSearch: { // keepPanelOpen
639+ var panelOpen = peExtraPanel.visible;
639640 resetSearch(keepPanelOpen);
640641 scopeView.scope.resetPrimaryNavigationTag();
641642 peExtraPanel.resetNavigation();
642− if (keepPanelOpen) {
643+ if (panelOpen && keepPanelOpen) {
643644 openPopup();
644645 }
645646 }
tests/qmltests/Dash/tst_DashContent.qml+20
@@ -495,6 +495,26 @@ Item {
495495 compare(peExtraPanel.visible, true);
496496 }
497497
498+ function test_clearSearchWithNavigationClosed() {
499+ var dashContentList = findChild(dashContent, "dashContentList");
500+ var searchButton = findChild(dashContentList.currentItem, "search_header_button");
501+ var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel");
502+ var searchTextField = findChild(dashContentList.currentItem, "searchTextField");
503+
504+ compare(peExtraPanel.visible, false);
505+ mouseClick(searchButton);
506+ tryCompare(peExtraPanel, "visible", true);
507+
508+ typeString("A");
509+ compare(peExtraPanel.visible, false);
510+
511+ var clearIcon = findChild(searchTextField, "clearIcon");
512+ mouseClick(clearIcon);
513+
514+ expectFail("", "Extra panel should not be visible after clearing search if it was not visible before");
515+ tryCompare(peExtraPanel, "visible", true);
516+ }
517+
498518 function test_searchHint() {
499519 var dashContentList = findChild(dashContent, "dashContentList");
500520 verify(dashContentList !== null);