Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sites 19919 1 #2694

Merged
merged 6 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public Collection<ListItem> getListItems() {
private Collection<ListItem> getStaticListItems() {
Stream<AbstractListItemImpl> itemStream = getStaticItemResourceStream().map(linkResource -> {
Link link = linkManager.get(linkResource).build();
if (LinkManagerImpl.isExternalLink(link.getURL())) {
if (LinkManagerImpl.isExternalLink(link.getURL()) && (link.getReference() == null)) {
return new ExternalLinkListItemImpl(link, linkResource, getId(), component);
} else {
Object reference = link.getReference();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ public void testList() throws ClientException, IOException {
.select(".list.list-v4", 2).expect("list-v4-static-pages-and-links.html")
.select(".list.list-v4", 3).expect("list-v4-static-pages-linked-description-modified.html")
.select(".list.list-v4", 4).expect("list-v4-static-pages-linked-description-modifieddate-teaser.html")
.select(".list.list-v4", 5).expect("list-v4-static-pages-empty.html");
.select(".list.list-v4", 5).expect("list_v4_static_internal_pages_containing_external_redirect.html")
.select(".list.list-v4", 6).expect("list-v4-static-pages-empty.html");

}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2020 Adobe
hrayrpapikyan marked this conversation as resolved.
Show resolved Hide resolved
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
package com.adobe.cq.wcm.core.components.it.http;

import com.adobe.cq.testing.client.CQClient;
import com.adobe.cq.testing.junit.rules.CQAuthorPublishClassRule;
import com.adobe.cq.testing.junit.rules.CQRule;
import org.apache.sling.testing.clients.ClientException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.junit.*;
import org.junit.rules.ErrorCollector;

public class ListIT {
@ClassRule
public static final CQAuthorPublishClassRule cqBaseClassRule = new CQAuthorPublishClassRule();

@Rule
public CQRule cqBaseRule = new CQRule(cqBaseClassRule.authorRule, cqBaseClassRule.publishRule);

@Rule
public ErrorCollector collector = new ErrorCollector();

static CQClient adminAuthor;

@Test
@Ignore
public void testTeaserIsVisibleWhenPointingToRedirectingPage() throws ClientException {
String content = adminAuthor.doGet("/content/core-components/list.html", 200).getContent();
Elements html = Jsoup.parse(content).select("html");

Elements images = html.select("[data-cmp-is=image] img");
Assert.assertEquals(1, images.size());
Element img = images.first();
String imageSource = img.attr("src");
Assert.assertEquals("/content/dam/core-components-examples/library/components/teaser.svg", imageSource);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="list-v4 list">
<ul class="cmp-list" data-cmp-data-layer="{&quot;list-v4-86b9010139&quot;:{&quot;@type&quot;:&quot;core-component/components/list-v4&quot;}}" id="list-v4-86b9010139">
<li class="cmp-list__item" data-cmp-data-layer="{&quot;list-v4-86b9010139-item-5a69939138&quot;:{&quot;@type&quot;:&quot;core-component/components/list-v4/item&quot;,&quot;dc:title&quot;:&quot;List&quot;,&quot;repo:modifyDate&quot;:&quot;0000-00-00T00:00:00Z&quot;,&quot;xdm:linkURL&quot;:&quot;/content/core-components/redirect.html&quot;}}">
<div id="teaser-21291462f0" class="cmp-teaser" data-cmp-data-layer="{&quot;teaser-21291462f0&quot;:{&quot;@type&quot;:&quot;core/wcm/components/teaser/v2/teaser&quot;,&quot;repo:modifyDate&quot;:&quot;2024-03-12T10:24:43Z&quot;,&quot;dc:title&quot;:&quot;teaser title&quot;,&quot;dc:description&quot;:&quot;Test Description. &quot;,&quot;xdm:linkURL&quot;:&quot;/content/core-components/redirect.html&quot;}}">
<a class="cmp-teaser__link" data-cmp-clickable="" href="/content/core-components/redirect.html">
<div class="cmp-teaser__content">
<h2 class="cmp-teaser__title">
Test Page
</h2>
<div class="cmp-teaser__description">Test Description </div>
</div>
<div class="cmp-teaser__image">
<div data-cmp-is="image" data-cmp-src="/content/dam/core-components-examples/library/components/teaser.svg" id="teaser-21291462f0-image" data-cmp-data-layer="{&quot;teaser-21291462f0-image&quot;:{&quot;@type&quot;:&quot;core/wcm/components/image/v3/image&quot;,&quot;repo:modifyDate&quot;:&quot;2024-03-12T10:24:43Z&quot;,&quot;xdm:linkURL&quot;:&quot;/content/core-components/redirect.html&quot;}}" data-cmp-hook-image="imageV3" class="cmp-image" itemscope="" itemtype="http://schema.org/ImageObject">
<img src="/content/dam/core-components-examples/library/components/teaser.svg" loading="lazy" class="cmp-image__image" itemprop="contentUrl" alt="">
</div>
</div>
</a>
</div>
</li>
</ul>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,24 @@
linkTarget="_blank"/>
</static>
</list_v4_static_pages_linked_description_modifieddate_teaser>
<list_v4_static_internal_pages_containing_external_redirect
jcr:primaryType="nt:unstructured"
sling:resourceType="core-component/components/list-v4"
listFrom="static"
linkItems="true"
showDescription="true"
showModificationDate="true"
displayItemAsTeaser="true"
childDepth="1"
>
<static
jcr:primaryType="nt:unstructured">
<item0
jcr:primaryType="nt:unstructured"
linkURL="/content/core-components/redirect"
/>
</static>
</list_v4_static_internal_pages_containing_external_redirect>
<list_v4_static_pages_empty
jcr:primaryType="nt:unstructured"
sling:resourceType="core-component/components/list-v4"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2021 Adobe
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Page">
<jcr:content
cq:lastModified="{Date}2021-01-15T16:44:49.861+02:00"
cq:lastModifiedBy="admin"
cq:template="/conf/core-components/settings/wcm/templates/simple-template"
jcr:primaryType="cq:PageContent"
jcr:title="Page redirecting to external link"
cq:redirectTarget="https://www.adobe.com"
cq:redirectPermanent="true"
sling:resourceType="core/wcm/components/page/v2/page">
<root
jcr:lastModified="{Date}2020-11-27T17:51:51.431+02:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/container/v1/container"
layout="simple">
<container
jcr:created="{Date}2020-11-27T17:53:54.583+02:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2020-11-27T17:54:02.429+02:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/container/v1/container">
</container>
</root>
<cq:featuredimage
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/image/v3/image"
altValueFromDAM="true"
fileReference="/content/dam/core-components-examples/library/components/teaser.svg"/>
</jcr:content>
</jcr:root>
Loading