Skip to content

Commit 227547a

Browse files
cbogdan0707bcenusaandreeadracea
authored
SITES-19799: fix for nested panel containers (#2675)
* SITES-19799: fix for nested panel containers --------- Co-authored-by: bcenusa <[email protected]> Co-authored-by: adracea <[email protected]>
1 parent d6699e5 commit 227547a

File tree

4 files changed

+43
-5
lines changed
  • content/src/content/jcr_root/apps/core/wcm/components
  • testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/accordion/v1

4 files changed

+43
-5
lines changed

content/src/content/jcr_root/apps/core/wcm/components/accordion/v1/accordion/clientlibs/editorhook/js/panelcontainer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
selector: ".cmp-accordion",
2525
wrapperSelector: '[data-panelcontainer="accordion"]',
2626
itemSelector: "[data-cmp-hook-accordion='panel']",
27-
itemActiveSelector: "[data-cmp-hook-accordion='item'][data-cmp-expanded] [data-cmp-hook-accordion='panel']"
27+
itemActiveSelector: "[data-cmp-hook-accordion='item'][data-cmp-expanded] [data-cmp-hook-accordion='panel']",
28+
itemSelectorWrapper: ".cmp-accordion__item"
2829
});
2930
}
3031
});

content/src/content/jcr_root/apps/core/wcm/components/carousel/v1/carousel/clientlibs/editorhook/js/panelcontainer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
selector: ".cmp-carousel",
2525
wrapperSelector: '[data-panelcontainer="carousel"]',
2626
itemSelector: "[data-cmp-hook-carousel='item']",
27-
itemActiveSelector: ".cmp-carousel__item--active"
27+
itemActiveSelector: ".cmp-carousel__item--active",
28+
itemSelectorWrapper: ".cmp-carousel__content"
2829
});
2930
}
3031
});

content/src/content/jcr_root/apps/core/wcm/components/commons/editor/clientlibs/panelcontainer/v1/js/PanelContainer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@
102102
var that = this;
103103
var activeIndex = 0;
104104
if (that._config.el && that._config.panelContainerType) {
105-
var items = $(this._config.el).find(that._config.panelContainerType.itemSelector);
105+
var itemsSelectorWrapper = that._config.panelContainerType.itemSelectorWrapper ? that._config.panelContainerType.itemSelectorWrapper + " > " : "";
106+
var items = $(this._config.el).find("> " + itemsSelectorWrapper + that._config.panelContainerType.itemSelector);
106107
items.each(function(index) {
107108
var activeItemSelector = that._config.panelContainerType.itemActiveSelector;
108109
if (that._config.el.id) {

testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/accordion/v1/AccordionIT.java

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@
5454
import com.codeborne.selenide.SelenideElement;
5555
import com.codeborne.selenide.WebDriverRunner;
5656

57-
import static com.adobe.cq.wcm.core.components.it.seljup.util.Commons.RT_ACCORDION_V1;
58-
import static com.adobe.cq.wcm.core.components.it.seljup.util.Commons.RT_TEASER_V1;
57+
import static com.adobe.cq.wcm.core.components.it.seljup.util.Commons.*;
5958
import static org.junit.jupiter.api.Assertions.assertTrue;
6059
import static org.junit.jupiter.api.Assertions.assertFalse;
6160
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -737,6 +736,42 @@ public void testNested() throws InterruptedException, ClientException {
737736
Commons.switchToDefaultContext();
738737
}
739738

739+
/**
740+
* Test: Open Config Dialog For Accordion Items
741+
*
742+
* 1. add a nested accordion and a text
743+
* 2. check the config dialog for the accordion
744+
* 3. check the config dialog for the text
745+
*
746+
* @throws InterruptedException
747+
* @throws ClientException
748+
*/
749+
@Test
750+
@DisplayName("Test: Open Config Dialog For Accordion Items")
751+
public void testOpenConfigDialog() throws InterruptedException, ClientException {
752+
753+
//1.
754+
String textProxy = RT_TEXT_V2;
755+
String accordion1Path = addAccordionItem(proxyPath, cmpPath, "Accordion 1");
756+
String textPath = addAccordionItem(textProxy, cmpPath, "Text 1");
757+
758+
//2.
759+
selectExpandedItem(0);
760+
accordion.openEditDialog(accordion1Path);
761+
SelenideElement editDialogTitle = Selenide.$(".cq-dialog-header._coral-Dialog-title");
762+
assertTrue(editDialogTitle.getText().equals("Accordion"));
763+
Commons.saveConfigureDialog();
764+
765+
//3.
766+
selectExpandedItem(1);
767+
accordion.openEditDialog(textPath);
768+
editDialogTitle = Selenide.$(".cq-dialog-header._coral-Dialog-title");
769+
assertTrue(editDialogTitle.getText().equals("Text"));
770+
Commons.saveConfigureDialog();
771+
772+
Commons.switchToDefaultContext();
773+
}
774+
740775
/**
741776
* Test: Allowed components
742777
*/

0 commit comments

Comments
 (0)