Commit 24a90267 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2807357 by borisson_, MathieuSpil: Use only one template instead of 2...

Issue #2807357 by borisson_, MathieuSpil: Use only one template instead of 2 different templates for links
parent 5c5a4fa6
......@@ -51,8 +51,8 @@ class IntegrationTest extends WebTestBase {
// Verify that the facet results are correct.
$this->drupalGet('search/node', ['query' => ['keys' => 'test']]);
$this->assertLink('page');
$this->assertLink('article');
$this->assertFacetLabel('page');
$this->assertFacetLabel('article');
// Verify that facet blocks appear as expected.
$this->assertFacetBlocksAppear();
......@@ -61,12 +61,12 @@ class IntegrationTest extends WebTestBase {
// Verify that the number of results per item.
$this->drupalGet('search/node', ['query' => ['keys' => 'test']]);
$this->assertRaw('page <span class="facet-count">(19)</span>');
$this->assertRaw('article <span class="facet-count">(10)</span>');
$this->assertFacetLabel('page (19)');
$this->assertFacetLabel('article (10)');
// Verify that the label is correct for a clicked link.
$this->clickLinkPartialName('page');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> page <span class="facet-count">(19)</span>');
$this->checkFacetIsActive('page');
// To make sure we have an empty result, we truncate the search_index table
// because, for the moment, we don't have the possibility to clear the index
......@@ -106,27 +106,27 @@ class IntegrationTest extends WebTestBase {
// Assert date facets.
$this->drupalGet('search/node', ['query' => ['keys' => 'test']]);
$this->assertRaw('February 2016 <span class="facet-count">(9)</span>');
$this->assertRaw('March 2016 <span class="facet-count">(10)</span>');
$this->assertRaw('April 2016 <span class="facet-count">(10)</span>');
$this->assertFacetLabel('February 2016 (9)');
$this->assertFacetLabel('March 2016 (10)');
$this->assertFacetLabel('April 2016 (10)');
$this->assertResponse(200);
$this->clickLinkPartialName('March 2016');
$this->assertResponse(200);
$this->assertRaw('March 8, 2016 <span class="facet-count">(1)</span>');
$this->assertRaw('March 9, 2016 <span class="facet-count">(2)</span>');
$this->assertFacetLabel('March 8, 2016 (1)');
$this->assertFacetLabel('March 9, 2016 (2)');
$this->clickLinkPartialName('March 9');
$this->assertResponse(200);
$this->assertRaw('10 AM <span class="facet-count">(1)</span>');
$this->assertRaw('12 PM <span class="facet-count">(1)</span>');
$this->assertFacetLabel('10 AM (1)');
$this->assertFacetLabel('12 PM (1)');
$this->drupalGet('search/node', ['query' => ['keys' => 'test']]);
$this->assertRaw('April 2016 <span class="facet-count">(10)</span>');
$this->assertFacetLabel('April 2016 (10)');
$this->clickLinkPartialName('April 2016');
$this->assertResponse(200);
$this->assertRaw('April 1, 2016 <span class="facet-count">(1)</span>');
$this->assertRaw('April 2, 2016 <span class="facet-count">(1)</span>');
$this->assertFacetLabel('April 1, 2016 (1)');
$this->assertFacetLabel('April 2, 2016 (1)');
}
/**
......@@ -154,10 +154,10 @@ class IntegrationTest extends WebTestBase {
search_update_totals();
$this->drupalGet('search/node', ['query' => ['keys' => 'test']]);
$this->assertRaw('December 2016 <span class="facet-count">(1)</span>');
$this->assertFacetLabel('December 2016 (1)');
$this->clickLinkPartialName('December 2016');
$this->assertResponse(200);
$this->assertRaw('December 3, 2016 <span class="facet-count">(1)</span>');
$this->assertFacetLabel('December 3, 2016 (1)');
$this->clickLinkPartialName('December 3, 2016');
$this->assertResponse(200);
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\core_search_facets\Tests;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\facets\Tests\TestHelperTrait;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase as SimpletestWebTestBase;
......@@ -13,6 +14,7 @@ use Drupal\simpletest\WebTestBase as SimpletestWebTestBase;
abstract class WebTestBase extends SimpletestWebTestBase {
use StringTranslationTrait;
use TestHelperTrait;
/**
* Modules to enable for this test.
......
......@@ -36,11 +36,16 @@ function facets_help($route_name, RouteMatchInterface $route_match) {
*/
function facets_theme($existing, $type, $theme, $path) {
$result_item_variables = [
'variables' => ['value' => '', 'show_count' => FALSE, 'count' => NULL],
'variables' => [
'value' => '',
'show_count' => FALSE,
'count' => NULL,
'is_active' => FALSE,
],
];
return [
'facets_result_item' => $result_item_variables,
'facets_result_item_active' => $result_item_variables,
];
}
......@@ -122,7 +127,7 @@ function facets_entity_presave(EntityInterface $entity) {
function facets_preprocess_block(&$variables) {
if ($variables['configuration']['provider'] == 'facets') {
$facet = Facet::load($variables['derivative_plugin_id']);
$variables['attributes']['class'][] = 'block-facet-widget--' . Html::cleanCssIdentifier($facet->getWidget()['type']);
$variables['attributes']['class'][] = 'block-facets--' . Html::cleanCssIdentifier($facet->getWidget()['type']);
}
}
......
......@@ -107,11 +107,11 @@ trait ExampleContentTrait {
* Another string.
*/
protected function assertStringPosition($x, $y) {
$this->assertRaw($x);
$this->assertRaw($y);
$this->assertText($x);
$this->assertText($y);
$x_position = strpos($this->getRawContent(), $x);
$y_position = strpos($this->getRawContent(), $y);
$x_position = strpos($this->getTextContent(), $x);
$y_position = strpos($this->getTextContent(), $y);
$message = new FormattableMarkup('Assert that %x is before %y in the source', ['%x' => $x, '%y' => $y]);
$this->assertTrue($x_position < $y_position, $message);
......
......@@ -195,8 +195,8 @@ class IntegrationTest extends WebTestBase {
$this->createFacet($facet_name, $facet_id);
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->clickLink('item');
$url = Url::fromUserInput('/search-api-test-fulltext', ['query' => ['f[0]' => 'ab_facet:item']]);
......@@ -206,8 +206,8 @@ class IntegrationTest extends WebTestBase {
$this->drupalPostForm(NULL, ['facet_settings[url_alias]' => 'llama'], $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->clickLink('item');
$url = Url::fromUserInput('/search-api-test-fulltext', ['query' => ['f[0]' => 'llama:item']]);
......@@ -234,10 +234,10 @@ class IntegrationTest extends WebTestBase {
// Go the the view and test that both facets are shown. Item and article
// come from the DependableFacet, orange and grape come from DependingFacet.
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('grape');
$this->assertLink('orange');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('grape');
$this->assertFacetLabel('orange');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->assertFacetBlocksAppear();
// Change the visiblity settings of the DependingFacet.
......@@ -253,13 +253,13 @@ class IntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertNoLink('grape');
$this->assertNoLink('orange');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
// Click on the item, and test that this shows the keywords.
$this->clickLink('item');
$this->assertLink('grape');
$this->assertLink('orange');
$this->assertFacetLabel('grape');
$this->assertFacetLabel('orange');
// Go back to the view, click on article and test that the keywords are
// hidden.
......@@ -279,15 +279,15 @@ class IntegrationTest extends WebTestBase {
// Go the the view and test only the type facet is shown.
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertLink('grape');
$this->assertLink('orange');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->assertFacetLabel('grape');
$this->assertFacetLabel('orange');
// Click on the article, and test that this shows the keywords.
$this->clickLink('article');
$this->assertLink('grape');
$this->assertLink('orange');
$this->assertFacetLabel('grape');
$this->assertFacetLabel('orange');
// Go back to the view, click on item and test that the keywords are
// hidden.
......@@ -311,29 +311,29 @@ class IntegrationTest extends WebTestBase {
$this->drupalPostForm(NULL, ['facet_settings[query_operator]' => 'and'], $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->clickLink('item');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> item');
$this->checkFacetIsActive('item');
$this->assertNoLink('article');
$this->drupalGet($facet_edit_page);
$this->drupalPostForm(NULL, ['facet_settings[query_operator]' => 'or'], $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->clickLink('item');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> item');
$this->assertLink('article');
$this->checkFacetIsActive('item');
$this->assertFacetLabel('article');
// Verify the number of results for OR functionality.
$this->drupalGet($facet_edit_page);
$this->drupalPostForm(NULL, ['widget' => 'links', 'widget_config[show_numbers]' => TRUE], $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
$this->clickLink('item (3)');
$this->assertText('article (2)');
$this->assertFacetLabel('article (2)');
}
......@@ -415,10 +415,10 @@ class IntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('foo bar baz');
$this->assertText('foo baz');
$this->assertLink('item');
$this->assertFacetLabel('item');
$this->clickLink('item');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> item');
$this->checkFacetIsActive('item');
$this->assertText('foo baz');
$this->assertText('bar baz');
$this->assertNoText('foo bar baz');
......@@ -431,10 +431,10 @@ class IntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('foo bar baz');
$this->assertText('foo baz');
$this->assertLink('item');
$this->assertFacetLabel('item');
$this->clickLink('item');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> item');
$this->checkFacetIsActive('item');
$this->assertText('foo bar baz');
$this->assertText('foo test');
$this->assertText('bar');
......@@ -457,18 +457,18 @@ class IntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 5 search results');
$this->assertLink('grape');
$this->assertLink('orange');
$this->assertFacetLabel('grape');
$this->assertFacetLabel('orange');
$this->clickLink('grape');
$this->assertText('Displaying 3 search results');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> grape');
$this->assertLink('orange');
$this->checkFacetIsActive('grape');
$this->assertFacetLabel('orange');
$this->clickLink('orange');
$this->assertText('Displaying 3 search results');
$this->assertLink('grape');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> orange');
$this->assertFacetLabel('grape');
$this->checkFacetIsActive('orange');
}
/**
......@@ -504,30 +504,30 @@ class IntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 5 search results');
$this->assertText('article (2)');
$this->assertText('grape (3)');
$this->assertFacetLabel('article (2)');
$this->assertFacetLabel('grape (3)');
// Make sure that after clicking on article, which has only 2 entities,
// there are only 2 items left in the results for other facets as well.
// In this case, that means we can't have 3 entities tagged with grape. Both
// remaining entities are tagged with grape and strawberry.
$this->clickLinkPartialName('article');
$this->assertNoText('grape (3)');
$this->assertText('grape (2)');
$this->assertText('strawberry (2)');
$this->assertNoText('(3)');
$this->assertFacetLabel('grape (2)');
$this->assertFacetLabel('strawberry (2)');
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 5 search results');
$this->assertText('article (2)');
$this->assertText('grape (3)');
$this->assertFacetLabel('article (2)');
$this->assertFacetLabel('grape (3)');
// Make sure that after clicking on grape, which has only 3 entities, there
// are only 3 items left in the results for other facets as well. In this
// case, that means 2 entities of type article and 1 item.
$this->clickLinkPartialName('grape');
$this->assertText('Displaying 3 search results');
$this->assertText('article (2)');
$this->assertText('item (1)');
$this->assertFacetLabel('article (2)');
$this->assertFacetLabel('item (1)');
}
/**
......
......@@ -263,9 +263,8 @@ class ProcessorIntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 10 search results');
$this->assertRaw('grape <span class="facet-count">(6)');
$this->assertNoText('apple (4)');
$this->assertNoRaw('apple <span class="facet-count">(4)');
$this->assertFacetLabel('grape (6)');
$this->assertNoText('apple');
$form = [
'widget_config[show_numbers]' => TRUE,
......@@ -277,8 +276,8 @@ class ProcessorIntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 10 search results');
$this->assertNoText('grape (6)');
$this->assertText('apple (4)');
$this->assertNoText('grape');
$this->assertFacetLabel('apple (4)');
$form = [
'widget_config[show_numbers]' => FALSE,
......@@ -331,11 +330,11 @@ class ProcessorIntegrationTest extends WebTestBase {
protected function checkHideNonNarrowingProcessor() {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 10 search results');
$this->assertLink('apple');
$this->assertFacetLabel('apple');
$this->clickLink('apple');
$this->assertText('Displaying 4 search results');
$this->assertLink('grape');
$this->assertFacetLabel('grape');
$form = [
'facet_settings[hide_non_narrowing_result_processor][status]' => TRUE,
......@@ -344,7 +343,7 @@ class ProcessorIntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 10 search results');
$this->assertLink('apple');
$this->assertFacetLabel('apple');
$this->clickLink('apple');
$this->assertText('Displaying 4 search results');
......@@ -367,13 +366,13 @@ class ProcessorIntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 10 search results');
$this->assertLink('grape');
$this->assertLink('banana');
$this->assertFacetLabel('grape');
$this->assertFacetLabel('banana');
$this->clickLink('grape');
$this->assertText('Displaying 6 search results');
$this->assertNoLink('grape');
$this->assertLink('banana');
$this->assertFacetLabel('banana');
$form = [
'facet_settings[hide_active_items_processor][status]' => FALSE,
......@@ -394,7 +393,7 @@ class ProcessorIntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->clickLink('strawberry');
$this->assertStringPosition('<span class="js-facet-deactivate">(-)</span> strawberry', 'grape');
$this->assertStringPosition('strawberry', 'grape');
$form = [
'facet_sorting[active_widget_order][status]' => TRUE,
......@@ -404,7 +403,7 @@ class ProcessorIntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->clickLink('strawberry');
$this->assertStringPosition('grape', '<span class="js-facet-deactivate">(-)</span> strawberry');
$this->assertStringPosition('grape', 'strawberry');
$form = [
'facet_sorting[active_widget_order][status]' => FALSE,
......
<?php
namespace Drupal\facets\Tests;
trait TestHelperTrait {
/**
* {@inheritdoc}
*/
protected function assertFacetLabel($label, $index = 0, $message = '', $group = 'Other') {
$label = (string) $label;
$label = strip_tags($label);
$matches = [];
if (preg_match('/(.*)\s\((\d+)\)/', $label, $matches)) {
$links = $this->xpath('//a//span[normalize-space(text())=:label]/following-sibling::span[normalize-space(text())=:count]', [':label' => $matches[1], ':count' => '(' . $matches[2] . ')']);
}
else {
$links = $this->xpath('//a//span[normalize-space(text())=:label]', [':label' => $label]);
}
$message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label]));
return $this->assert(isset($links[$index]), $message, $group);
}
/**
* Check if a facet is active by providing a label for it.
*
* We'll check by activeness by seeing that there's a span with (-) in the
* same link as the label.
*
* @param string $label
* The label of a facet that should be active.
*
* @return bool
* Returns true when the facet is found and is active.
*/
protected function checkFacetIsActive($label) {
$label = (string) $label;
$label = strip_tags($label);
$links = $this->xpath('//a/span[normalize-space(text())="(-)"]/following-sibling::span[normalize-space(text())=:label]', array(':label' => $label));
return $this->assert(isset($links[0]));
}
}
......@@ -150,9 +150,9 @@ class UrlIntegrationTest extends WebTestBase {
// Go to the overview and test that we have the expected links.
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('test:colon');
$this->assertLink('orange');
$this->assertLink('banana');
$this->assertFacetLabel('test:colon');
$this->assertFacetLabel('orange');
$this->assertFacetLabel('banana');
// Click the link with the colon.
$this->clickLink('test:colon');
......@@ -161,9 +161,9 @@ class UrlIntegrationTest extends WebTestBase {
// Make sure 'test:colon' is active.
$url = Url::fromUserInput('/search-api-test-fulltext', ['query' => ['f[0]' => 'water_bear:test:colon']]);
$this->assertUrl($url);
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> test:colon');
$this->assertLink('orange');
$this->assertLink('banana');
$this->checkFacetIsActive('test:colon');
$this->assertFacetLabel('orange');
$this->assertFacetLabel('banana');
}
/**
......@@ -175,14 +175,14 @@ class UrlIntegrationTest extends WebTestBase {
protected function checkClickedFacetUrl(Url $url) {
$this->drupalGet('search-api-test-fulltext');
$this->assertResponse(200);
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->clickLink('item');
$this->assertResponse(200);
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> item');
$this->assertLink('article');
$this->checkFacetIsActive('item');
$this->assertFacetLabel('article');
$this->assertUrl($url);
}
......
......@@ -15,6 +15,7 @@ abstract class WebTestBase extends SimpletestWebTestBase {
use StringTranslationTrait;
use ExampleContentTrait;
use BlockTestTrait;
use TestHelperTrait;
/**
* Modules to enable for this test.
......
......@@ -46,8 +46,8 @@ class WidgetIntegrationTest extends WebTestBase {
$this->drupalPostForm(NULL, ['widget' => 'checkbox'], $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
}
/**
......@@ -61,11 +61,11 @@ class WidgetIntegrationTest extends WebTestBase {
$this->drupalPostForm(NULL, ['widget' => 'links'], $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->clickLink('item');
$this->assertRaw('<span class="js-facet-deactivate">(-)</span> item');
$this->checkFacetIsActive('item');
}
/**
......@@ -81,8 +81,8 @@ class WidgetIntegrationTest extends WebTestBase {
$this->drupalGet('search-api-test-fulltext');
$this->assertText('Displaying 5 search results');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
}
/**
......@@ -98,16 +98,16 @@ class WidgetIntegrationTest extends WebTestBase {
// Go to the view and check that the facet links are shown with their
// default settings.
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
$this->drupalGet($facet_edit_page);
$this->drupalPostForm(NULL, ['widget' => 'links', 'widget_config[show_numbers]' => TRUE], $this->t('Save'));
// Go back to the same view and check that links now display the count.
$this->drupalGet('search-api-test-fulltext');
$this->assertRaw('item <span class="facet-count">(3)</span>');
$this->assertRaw('article <span class="facet-count">(2)</span>');
$this->assertFacetLabel('item (3)');
$this->assertFacetLabel('article (2)');
$edit = [
'widget' => 'links',
......@@ -117,19 +117,19 @@ class WidgetIntegrationTest extends WebTestBase {
$this->drupalPostForm($facet_edit_page, $edit, $this->t('Save'));
$this->drupalGet('search-api-test-fulltext');
$this->assertRaw('item <span class="facet-count">(3)</span>');
$this->assertRaw('article <span class="facet-count">(2)</span>');
$this->assertFacetLabel('item (3)');
$this->assertFacetLabel('article (2)');
$this->clickLinkPartialName('item');
$this->assertRaw('item <span class="facet-count">(3)</span>');
$this->assertRaw('article <span class="facet-count">(2)</span>');
$this->assertFacetLabel('item (3)');
$this->assertFacetLabel('article (2)');
$this->drupalGet($facet_edit_page);
$this->drupalPostForm(NULL, ['widget' => 'links', 'widget_config[show_numbers]' => FALSE], $this->t('Save'));
// The count should be hidden again.
$this->drupalGet('search-api-test-fulltext');
$this->assertLink('item');
$this->assertLink('article');
$this->assertFacetLabel('item');
$this->assertFacetLabel('article');
}
}
......@@ -207,7 +207,8 @@ abstract class WidgetPluginBase extends PluginBase implements WidgetPluginInterf
protected function buildResultItem(ResultInterface $result) {
$count = $result->getCount();
return [
'#theme' => $result->isActive() ? 'facets_result_item_active' : 'facets_result_item',
'#theme' => 'facets_result_item',
'#is_active' => $result->isActive(),
'#value' => $result->getDisplayValue(),
'#show_count' => $this->getConfiguration()['show_numbers'] && ($count !== NULL),
'#count' => $count,
......
{#
/**
* @file
* Default theme implementation of an active facet result item.
*
* Available variables:
* - value: The item value.
* - show_count: If this facet provides count.
* - count: The amount of results.
*
* @ingroup themeable
*/
#}
<span class="js-facet-deactivate">(-)</span> {{ value }} {% if show_count %}<span class="facet-count">({{ count }})</span>{% endif %}
......@@ -7,8 +7,15 @@
* - value: The item value.
* - show_count: If this facet provides count.
* - count: The amount of results.
* - is_active: The item is active.
*
* @ingroup themeable
*/
#}
{{ value }} {% if show_count %}<span class="facet-count">({{ count }})</span>{% endif %}
{% if is_active %}
<span class="facet-item__status js-facet-deactivate">(-)</span>
{% endif %}
<span class="facet-item__value">{{ value }}</span>
{% if show_count %}
<span class="facet-item__count">({{ count }})</span>
{% endif %}
......@@ -105,10 +105,11 @@ class CheckboxWidgetTest extends UnitTestCase {
*/
protected function buildLinkAssertion($text, $count = 0, $active = FALSE, $show_numbers = TRUE) {
return [
'#theme' => $active ? 'facets_result_item_active' : 'facets_result_item',
'#theme' => 'facets_result_item',
'#value' => $text,
'#show_count' => $show_numbers && ($count !== NULL),
'#count' => $count,
'#is_active' => $active,
];
}
......
......@@ -105,10 +105,11 @@ class DropdownWidgetTest extends UnitTestCase {
*/
protected function buildLinkAssertion($text, $count = 0, $active = FALSE, $show_numbers = TRUE) {
return [
'#theme' => $active ? 'facets_result_item_active' : 'facets_result_item',
'#theme' => 'facets_result_item',
'#value' => $text,
'#show_count' => $show_numbers && ($count !== NULL),
'#count' => $count,
'#is_active' => $active,
];
}
......
......@@ -236,10 +236,11 @@ class LinksWidgetTest extends UnitTestCase {
*/
protected function buildLinkAssertion($text, $count = 0, $active = FALSE, $show_numbers = TRUE) {
return [
'#theme' => $active ? 'facets_result_item_active' : 'facets_result_item',
'#theme' => 'facets_result_item',
'#value' => $text,
'#show_count' => $show_numbers && ($count !== NULL),
'#count' => $count,
'#is_active' => $active,
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment