Skip to content

Commit

Permalink
LPD-40036 This taglib and its tests should follow the same approach w…
Browse files Browse the repository at this point in the history
…ithin frontend-taglib-sample-web module
  • Loading branch information
antonio-ortega authored and brianchandotcom committed Dec 17, 2024
1 parent 7062edb commit 556110a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ public SampleDisplayContext(
public List<NavigationItem> getNavigationItems() {
String navigation = ParamUtil.getString(
PortalUtil.getHttpServletRequest(_renderRequest), "navigation",
"search-iterator");
"fieldset");

return NavigationItemList.of(
NavigationItemBuilder.setActive(
navigation.equals("fieldset")
).setHref(
_renderResponse.createRenderURL(), "navigation", "fieldset"
).setLabel(
"Fieldset"
).build(),
NavigationItemBuilder.setActive(
navigation.equals("search-iterator")
).setHref(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ SampleDisplayContext sampleDisplayContext = (SampleDisplayContext)request.getAtt
/>

<%
String navigation = ParamUtil.getString(request, "navigation", "search-iterator");
String navigation = ParamUtil.getString(request, "navigation", "fieldset");
%>

<c:choose>
<c:when test='<%= navigation.equals("fieldset") %>'>
<liferay-util:include page="/partials/fieldset.jsp" servletContext="<%= application %>" />
</c:when>
<c:when test='<%= navigation.equals("search-iterator") %>'>
<liferay-util:include page="/partials/search_iterator.jsp" servletContext="<%= application %>" />
</c:when>
<c:otherwise>
<liferay-util:include page="/partials/search_paginator.jsp" servletContext="<%= application %>" />
</c:otherwise>
</c:choose>
</c:choose>
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,37 @@

import {expect, mergeTests} from '@playwright/test';

import {apiHelpersTest} from '../../../../fixtures/apiHelpersTest';
import {featureFlagsTest} from '../../../../fixtures/featureFlagsTest';
import {isolatedSiteTest} from '../../../../fixtures/isolatedSiteTest';
import {loginTest} from '../../../../fixtures/loginTest';
import {liferayConfig} from '../../../../liferay.config';
import getRandomString from '../../../../utils/getRandomString';
import {journalPagesTest} from '../../../journal-web/fixtures/journalPagesTest';
import getPageDefinition from '../../../layout-content-page-editor-web/utils/getPageDefinition';
import getWidgetDefinition from '../../../layout-content-page-editor-web/utils/getWidgetDefinition';
import {samplePageTest} from '../../fixtures/samplePageTest';

export const test = mergeTests(
apiHelpersTest,
isolatedSiteTest,
featureFlagsTest({
'LPS-178052': true,
}),
journalPagesTest,
loginTest()
loginTest(),
samplePageTest
);

const linkName = 'Fieldset';

test(
'Tooltip should be translated correctly',
{
tag: '@LPD-43309',
},
async ({apiHelpers, page, site}) => {
let layout: Layout;

async ({page, samplePage, site}) => {
await test.step('Add taglib sample to page', async () => {
const widgetDefinition = getWidgetDefinition({
id: getRandomString(),
widgetName: 'com_liferay_sample_web_portlet_SamplePortlet',
await samplePage.setupSampleWidget({
site,
});

layout = await apiHelpers.headlessDelivery.createSitePage({
pageDefinition: getPageDefinition([widgetDefinition]),
siteId: site.id,
title: getRandomString(),
});
await samplePage.selectLink(linkName);
});

await test.step('Check tooltip is translated', async () => {
await page.goto(
`${liferayConfig.environment.baseUrl}/web${site.friendlyUrlPath}${layout.friendlyUrlPath}`
);

const svgElement = page
.locator('svg[aria-label="Help Text"]')
.first();
Expand Down

0 comments on commit 556110a

Please sign in to comment.