on xenial help sign in
Fix collapsing of categories not working

+test

commit7333f3d61e8a4839fc526a061b34ed98507f6a25 authorAlbert Astals <albert.astals@canonical.com> dateThu 5 Dec 2013, 10:45 (13 years ago) parent0b5080e
3 files changed+26
Dash/DashFilterGrid.qml+4 Dash/GenericScopeView.qml+2 tests/qmltests/Dash/tst_GenericScopeView.qml+20
Dash/DashFilterGrid.qml+4
@@ -56,5 +56,9 @@ DashRenderer {
5656 model: dashFilterGrid.model
5757 filter: dashFilterGrid.filter
5858 highlightIndex: dashFilterGrid.highlightIndex
59+
60+ onFilterChanged: {
61+ dashFilterGrid.filter = filter
62+ }
5963 }
6064}
Dash/GenericScopeView.qml+2
@@ -126,6 +126,7 @@ FocusScope {
126126
127127 delegate: ListItems.Base {
128128 id: baseItem
129+ objectName: "dashCategory" + category
129130 highlightWhenPressed: false
130131
131132 readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
@@ -271,6 +272,7 @@ FocusScope {
271272
272273 sectionProperty: "name"
273274 sectionDelegate: ListItems.Header {
275+ objectName: "dashSectionHeader" + delegate.category
274276 property var delegate: categoryView.item(delegateIndex)
275277 width: categoryView.width
276278 text: section
tests/qmltests/Dash/tst_GenericScopeView.qml+20
@@ -222,6 +222,26 @@ Item {
222222 genericScopeView.scope = scopes.get(0)
223223 tryCompare(genericScopeView.scope, "searchQuery", "")
224224 }
225+
226+ function test_filter_expand_collapse() {
227+ // wait for the item to be there
228+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != undefined; }, true);
229+
230+ var header = findChild(genericScopeView, "dashSectionHeader0")
231+ var category = findChild(genericScopeView, "dashCategory0")
232+
233+ waitForRendering(header);
234+ verify(category.expandable);
235+ verify(category.filtered);
236+
237+ mouseClick(header, header.width / 2, header.height / 2);
238+ verify(category.expandable);
239+ tryCompare(category, "filtered", false);
240+
241+ mouseClick(header, header.width / 2, header.height / 2);
242+ verify(category.expandable);
243+ tryCompare(category, "filtered", true);
244+ }
225245 }
226246 }
227247}