forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored by: Chris Hallberg <[email protected]>
- Loading branch information
1 parent
d735c6c
commit 4a0d57b
Showing
1 changed file
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
* PHP version 8 | ||
* | ||
* Copyright (C) Villanova University 2011. | ||
* Copyright (C) The National Library of Finland 2023. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2, | ||
|
@@ -23,6 +24,7 @@ | |
* @category VuFind | ||
* @package Tests | ||
* @author Demian Katz <[email protected]> | ||
* @author Ere Maijala <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Page | ||
*/ | ||
|
@@ -35,19 +37,62 @@ | |
* @category VuFind | ||
* @package Tests | ||
* @author Demian Katz <[email protected]> | ||
* @author Ere Maijala <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Page | ||
* @retry 4 | ||
*/ | ||
class SearchFacetsTest extends \VuFindTest\Integration\MinkTestCase | ||
{ | ||
/** | ||
* CSS selector for finding active filters | ||
* CSS selector for finding the active filter values | ||
* | ||
* @var string | ||
*/ | ||
protected $activeFilterSelector = '.active-filters.hidden-xs .filters .filter-value'; | ||
|
||
/** | ||
* CSS selector for finding the active filter labels | ||
* | ||
* @var string | ||
*/ | ||
protected $activeFilterLabelSelector = '.active-filters.hidden-xs .filters .filters-title'; | ||
|
||
/** | ||
* CSS selector for finding the first collapsed hierarchical facet | ||
* | ||
* @var string | ||
*/ | ||
protected $facetExpandSelector = '.facet-tree .facet-tree__icon-container .facet-tree__closed'; | ||
|
||
/** | ||
* CSS selector for finding the first expanded hierarchical facet | ||
* | ||
* @var string | ||
*/ | ||
protected $facetExpandedSelector = '.facet-tree details[open]'; | ||
|
||
/** | ||
* CSS selector for finding the first second level hierarchical facet | ||
* | ||
* @var string | ||
*/ | ||
protected $facetSecondLevelLinkSelector = '.facet-tree details[open] ul a'; | ||
|
||
/** | ||
* CSS selector for finding the first active second level hierarchical facet | ||
* | ||
* @var string | ||
*/ | ||
protected $facetSecondLevelActiveLinkSelector = '.facet-tree details[open] ul a.active'; | ||
|
||
/** | ||
* CSS selector for finding the first second level hierarchical facet | ||
* | ||
* @var string | ||
*/ | ||
protected $facetSecondLevelExcludeLinkSelector = '.facet-tree details[open] ul a.exclude'; | ||
|
||
/** | ||
* Get filtered search | ||
* | ||
|
@@ -305,14 +350,19 @@ public function testFacetLightboxExclusion() | |
*/ | ||
protected function clickHierarchyFacet($page) | ||
{ | ||
$this->clickCss($page, '#j1_1.jstree-closed .jstree-icon'); | ||
$this->findCss($page, '#j1_1.jstree-open .jstree-icon'); | ||
$this->clickCss($page, '#j1_2 a'); | ||
// Open second level: | ||
$this->clickCss($page, $this->facetExpandSelector); | ||
// Check results: | ||
$this->findCss($page, $this->facetExpandedSelector); | ||
// Click second level facet: | ||
$this->clickCss($page, $this->facetSecondLevelLinkSelector); | ||
// Check the active filter: | ||
$filter = $this->findCss($page, $this->activeFilterSelector); | ||
$label = $this->findCss($page, '.filters .filters-title'); | ||
$label = $this->findCss($page, $this->activeFilterLabelSelector); | ||
$this->assertEquals('hierarchy:', $label->getText()); | ||
$this->assertEquals('Remove Filter level1a/level2a', $filter->getText()); | ||
$this->findCss($page, '#j1_2 .applied'); | ||
// Check that the applied facet is displayed properly: | ||
$this->findCss($page, $this->facetSecondLevelActiveLinkSelector); | ||
} | ||
|
||
/** | ||
|
@@ -370,9 +420,8 @@ public function testHierarchicalFacetExclude() | |
'Showing 1 - 10 results of 10 for search \'building:"hierarchy.mrc"\'', | ||
$extractCount($stats->getText()) | ||
); | ||
$this->clickCss($page, '#j1_1.jstree-closed .jstree-icon'); | ||
$this->findCss($page, '#j1_1.jstree-open .jstree-icon'); | ||
$this->clickCss($page, '#j1_2 a.exclude'); | ||
$this->clickCss($page, $this->facetExpandSelector); | ||
$this->clickCss($page, $this->facetSecondLevelExcludeLinkSelector); | ||
$filter = $this->findCss($page, $this->activeFilterSelector); | ||
$label = $this->findCss($page, '.filters .filters-title'); | ||
$this->assertEquals('hierarchy:', $label->getText()); | ||
|