From ae85a40b63da68873e87d6733145a374d1c5c435 Mon Sep 17 00:00:00 2001 From: Chris Hallberg <crhallberg@gmail.com> Date: Tue, 28 Apr 2020 16:18:31 -0400 Subject: [PATCH] Exclude facet labels. Closes #1592. --- .../src/VuFindTest/Mink/SearchFacetsTest.php | 27 ++++++++++--------- .../Recommend/SideFacets/single-facet.phtml | 5 +++- .../templates/Recommend/TopFacets.phtml | 5 +++- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchFacetsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchFacetsTest.php index c6d5283f969..a07d2761306 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchFacetsTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchFacetsTest.php @@ -85,15 +85,16 @@ class SearchFacetsTest extends \VuFindTest\Unit\MinkTestCase $this->snooze(); $items = $page->findAll('css', '#modal #facet-list-count .js-facet-item'); $this->assertEquals($limit * 2, count($items)); + $excludeControl = $exclusionActive ? 'Exclude matching results ' : ''; $this->assertEquals( - 'Weird IDs 9 ' - . 'Fiction 7 ' - . 'The Study Of P|pes 1 ' - . 'The Study and Scor_ng of Dots.and-Dashes:Colons 1 ' - . 'The Study of "Important" Things 1 ' - . 'The Study of %\'s? 1 ' - . 'The Study of +\'s? 1 ' - . 'The Study of @Twitter #test 1 ' + 'Weird IDs 9 ' . $excludeControl + . 'Fiction 7 ' . $excludeControl + . 'The Study Of P|pes 1 ' . $excludeControl + . 'The Study and Scor_ng of Dots.and-Dashes:Colons 1 ' . $excludeControl + . 'The Study of "Important" Things 1 ' . $excludeControl + . 'The Study of %\'s? 1 ' . $excludeControl + . 'The Study of +\'s? 1 ' . $excludeControl + . 'The Study of @Twitter #test 1 ' . $excludeControl . 'more ...', $this->findCss($page, '#modal #facet-list-count')->getText() ); @@ -107,10 +108,10 @@ class SearchFacetsTest extends \VuFindTest\Unit\MinkTestCase $items = $page->findAll('css', '#modal #facet-list-index .js-facet-item'); $this->assertEquals($limit, count($items)); // reset number of items $this->assertEquals( - 'Fiction 7 ' - . 'The Study Of P|pes 1 ' - . 'The Study and Scor_ng of Dots.and-Dashes:Colons 1 ' - . 'The Study of "Important" Things 1 ' + 'Fiction 7 ' . $excludeControl + . 'The Study Of P|pes 1 ' . $excludeControl + . 'The Study and Scor_ng of Dots.and-Dashes:Colons 1 ' . $excludeControl + . 'The Study of "Important" Things 1 ' . $excludeControl . 'more ...', $this->findCss($page, '#modal #facet-list-index')->getText() ); @@ -219,7 +220,7 @@ class SearchFacetsTest extends \VuFindTest\Unit\MinkTestCase $genreMore = $this->findCss($page, '#more-narrowGroupHidden-genre_facet'); $genreMore->click(); $this->facetListProcedure($page, $limit, true); - $this->assertEquals(1, count($page->find('css', '.active-filters'))); + $this->assertEquals(1, count($page->findAll('css', '.active-filters'))); } /** diff --git a/themes/bootstrap3/templates/Recommend/SideFacets/single-facet.phtml b/themes/bootstrap3/templates/Recommend/SideFacets/single-facet.phtml index 719347269a1..39707d78bd2 100644 --- a/themes/bootstrap3/templates/Recommend/SideFacets/single-facet.phtml +++ b/themes/bootstrap3/templates/Recommend/SideFacets/single-facet.phtml @@ -50,7 +50,10 @@ <?php if ($this->exclude && !$this->facet['isApplied']): ?> <?php $excludeURL = $this->urlBase . $this->url->addFacet($this->group, $this->facet['value'], 'NOT'); ?> - <a href="<?=$excludeURL ?>" data-lightbox-ignore title="<?=$this->transEsc('exclude_facet') ?>" class="exclude"><i class="fa fa-times" aria-hidden="true"></i></a> + <a href="<?=$excludeURL ?>" data-lightbox-ignore class="exclude"> + <i class="fa fa-times" aria-hidden="true"></i> + <span class="sr-only"><?=$this->transEsc('exclude_facet') ?></span> + </a> <?php endif; ?> <?=$hasSubLinks ? '</li>' : '</a>'; ?> diff --git a/themes/bootstrap3/templates/Recommend/TopFacets.phtml b/themes/bootstrap3/templates/Recommend/TopFacets.phtml index 4c9325c4f2d..88c63586320 100644 --- a/themes/bootstrap3/templates/Recommend/TopFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/TopFacets.phtml @@ -33,7 +33,10 @@ --></a> <span class="badge"><?=$this->localizedNumber($thisFacet['count']) ?></span> <?php if ($allowExclude): ?> - <a href="<?=$this->currentPath() . $results->getUrlQuery()->addFacet($title, $thisFacet['value'], 'NOT')?>" title="<?=$this->transEsc('exclude_facet')?>"><i class="fa fa-times" aria-hidden="true"></i></a> + <a href="<?=$this->currentPath() . $results->getUrlQuery()->addFacet($title, $thisFacet['value'], 'NOT')?>"> + <i class="fa fa-times" aria-hidden="true"></i> + <span class="sr-only"><?=$this->transEsc('exclude_facet') ?></span> + </a> <?php endif; ?> <?php endif; ?> </span> -- GitLab