@@ -1,5 +1,5 @@
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2013, 2014 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -400,7 +400,10 @@ Item {
400 mockScope.setName("Mock Scope");
400 mockScope.setName("Mock Scope");
401 mockScope.categories.setCount(2);
401 mockScope.categories.setCount(2);
402 mockScope.categories.resultModel(0).setResultCount(50);
402 mockScope.categories.resultModel(0).setResultCount(50);
403+ mockScope.categories.resultModel(1).setResultCount(15);
404+ mockScope.categories.setLayout(0, "grid");
403 mockScope.categories.setLayout(1, "grid");
405 mockScope.categories.setLayout(1, "grid");
406+ mockScope.categories.setHeaderLink(0, "");
404 mockScope.categories.setHeaderLink(1, "");
407 mockScope.categories.setHeaderLink(1, "");
405 genericScopeView.scope = mockScope;
408 genericScopeView.scope = mockScope;
406 waitForRendering(genericScopeView.categoryView);
409 waitForRendering(genericScopeView.categoryView);
@@ -419,6 +422,7 @@ Item {
420 scrollToCategory("dashCategory1");
423 scrollToCategory("dashCategory1");
425+ tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory1") !== null; }, true);
422 var category1 = findChild(genericScopeView, "dashCategory1")
426 var category1 = findChild(genericScopeView, "dashCategory1")
423 var seeAll1 = findChild(category1, "seeAll")
427 var seeAll1 = findChild(category1, "seeAll")
424 verify(category1.expandable);
428 verify(category1.expandable);
@@ -433,6 +437,47 @@ Item {
433 == genericScopeView.categoryView.contentHeight;}
437 == genericScopeView.categoryView.contentHeight;}
441+ function test_seeAllTwoCategoriesScenario2() {
442+ mockScope.setId("mockScope");
443+ mockScope.setName("Mock Scope");
444+ mockScope.categories.setCount(2);
445+ mockScope.categories.resultModel(0).setResultCount(15);
446+ mockScope.categories.resultModel(1).setResultCount(50);
447+ mockScope.categories.setLayout(0, "grid");
448+ mockScope.categories.setLayout(1, "grid");
449+ mockScope.categories.setHeaderLink(0, "");
450+ mockScope.categories.setHeaderLink(1, "");
451+ genericScopeView.scope = mockScope;
452+ waitForRendering(genericScopeView.categoryView);
454+ var category0 = findChild(genericScopeView, "dashCategory0")
455+ var seeAll0 = findChild(category0, "seeAll")
457+ waitForRendering(seeAll0);
458+ verify(category0.expandable);
459+ verify(!category0.expanded);
461+ mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2);
462+ verify(category0.expanded);
463+ tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height);
465+ scrollToCategory("dashCategory1");
467+ var category1 = findChild(genericScopeView, "dashCategory1")
468+ var seeAll1 = findChild(category1, "seeAll")
469+ verify(category1.expandable);
470+ verify(!category1.expanded);
472+ mouseClick(seeAll1, seeAll1.width / 2, seeAll1.height / 2);
473+ verify(!category0.expanded);
474+ verify(category1.expanded);
475+ tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height);
476+ tryCompareFunction(function() {
477+ return category0.height + genericScopeView.categoryView.pageHeader.height + category1.y
478+ == genericScopeView.categoryView.contentY;}