Skip to content

Commit

Permalink
PLANET-7191: Fix search action and content toggles (#2110)
Browse files Browse the repository at this point in the history
  • Loading branch information
lithrel authored Sep 1, 2023
1 parent 74f3fbb commit 2148ed1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions templates/search.twig
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@
{% endif %}
{% if ( action_types|length > 0 ) %}
<div class="filteritem">
<a data-bs-toggle="collapse" href="#item-content" class="{{ collapsed }}" aria-expanded="{{ expanded }}">
<a data-bs-toggle="collapse" href="#item-action" class="{{ collapsed }}" aria-expanded="{{ expanded }}">
{{ __( 'Action Type', 'planet4-master-theme' ) }} <span></span>
</a>
<div id="item-content" class="collapse {{ show }}" role="tabpanel">
<div id="item-action" class="collapse {{ show }}" role="tabpanel">
<ul class="list-unstyled">
{% for id, action_type in action_types %}
{% if ( action_type.results > 0 ) %}
Expand Down
29 changes: 29 additions & 0 deletions tests/e2e/tickets/PLANET-7191/PLANET-7191.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {test, expect} from '../../tools/lib/test-utils.js';

test('check search filters toggles', async ({page}) => {
await page.goto('./?s=');

const actionLink = await page.getByRole('link', {name: 'Action Type'});
const contentLink = await page.getByRole('link', {name: 'Content Type'});
const actionList = await page.locator('.filteritem').filter({has: actionLink}).getByRole('tabpanel');
const contentList = await page.locator('.filteritem').filter({has: contentLink}).getByRole('tabpanel');

await expect(actionList).toBeVisible();
await expect(contentList).toBeVisible();

await actionLink.click();
await expect(actionList).toBeHidden();
await expect(contentList).toBeVisible();

await contentLink.click();
await expect(actionList).toBeHidden();
await expect(contentList).toBeHidden();

await contentLink.click();
await expect(actionList).toBeHidden();
await expect(contentList).toBeVisible();

await actionLink.click();
await expect(actionList).toBeVisible();
await expect(contentList).toBeVisible();
});

0 comments on commit 2148ed1

Please sign in to comment.