@@ -36,6 +36,16 @@ Item {
37 function init() {
37 function init() {
38 searchEnabled = true;
38 searchEnabled = true;
40+ // Reset to initial state
41+ pageHeader.searchQuery = "";
42+ pageHeader.closePopup();
43+ pageHeader.searchHistory.clear();
45+ // Check initial state
46+ var headerContainer = findChild(pageHeader, "headerContainer");
47+ tryCompareFunction(function() { return headerContainer.popover === null; }, true);
48+ compare(pageHeader.searchHistory.count, 0);
41 function test_search_disabled() {
51 function test_search_disabled() {
@@ -80,9 +90,6 @@ Item {
82 function test_history() {
92 function test_history() {
83− pageHeader.searchHistory.clear()
84− compare(pageHeader.searchHistory.count, 0)
86 pageHeader.triggerSearch()
93 pageHeader.triggerSearch()
87 typeString("humppa1")
94 typeString("humppa1")
88 pageHeader.resetSearch()
95 pageHeader.resetSearch()
@@ -168,14 +175,14 @@ Item {
168 tryCompare(headerContainer.popover, "visible", true);
175 tryCompare(headerContainer.popover, "visible", true);
171− function test_tap_outside_closes_popup_data() {
178+ function test_popup_closing_data() {
173 { tag: "with search text", searchText: "foobar", hideSearch: false },
180 { tag: "with search text", searchText: "foobar", hideSearch: false },
174 { tag: "without search text", searchText: "", hideSearch: true }
181 { tag: "without search text", searchText: "", hideSearch: true }
178− function test_tap_outside_closes_popup(data) {
185+ function test_popup_closing(data) {
179 searchEnabled = true;
186 searchEnabled = true;
180 pageHeader.searchHistory.clear();
187 pageHeader.searchHistory.clear();
@@ -191,7 +198,11 @@ Item {
192 pageHeader.searchQuery = data.searchText;
199 pageHeader.searchQuery = data.searchText;
201+ if (data.searchText == "") {
202+ // When the text is empty the user can also close the
203+ // popup by clicking outside the header instead of by starting a search
194− mouseClick(root, root.width / 2, root.height - 1);
204+ mouseClick(root, root.width / 2, root.height - 1);
196 tryCompare(headerContainer, "showSearch", !data.hideSearch);
207 tryCompare(headerContainer, "showSearch", !data.hideSearch);
197 tryCompareFunction(function() { return headerContainer.popover === null; }, true);
208 tryCompareFunction(function() { return headerContainer.popover === null; }, true);