Skip to content

Commit

Permalink
Merge pull request #1531 from adobe/devMaster24Feb
Browse files Browse the repository at this point in the history
Dev master24 feb
  • Loading branch information
rismehta authored Feb 24, 2025
2 parents 2b52028 + 2cf1b6a commit 08e5f4a
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 35 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ jobs:
# echo "Before sed: $(cat VERSIONS.md)"
# update versions.md
sed -i "/$LAST_VERSION/ { p; b; }; 1,/$LAST_VERSION/ { p; d; }" VERSIONS.md
sed -i -E "0,/(\| $LAST_VERSION\s*\|) [0-9]+\.[0-9]+\.[0-9]+\s*\|/s//| $NEW_VERSION \| $WCM_CORE_COMPONENTS_VERSION |/" VERSIONS.md
echo "After sed: $(cat VERSIONS.md)"
sed -i -E "0,/(\| $LAST_VERSION\s*\|) [0-9]+\.[0-9]+\.[0-9]+\+?\s*\|/s//| $NEW_VERSION \| $WCM_CORE_COMPONENTS_VERSION |/" VERSIONS.md
# echo "After sed: $(cat VERSIONS.md)"
# echo "Before sed: $(cat README.md)"
# update readme.md
sed -i -E "s/(\| $LAST_VERSION\s*\|) [0-9]+\.[0-9]+\.[0-9]+ \s*\| /| $NEW_VERSION | $WCM_CORE_COMPONENTS_VERSION | /g" README.md
echo "After sed: $(cat README.md)"
sed -i -E "s/(\| $LAST_VERSION\s*\|) [0-9]+\.[0-9]+\.[0-9]+\+? \s*\| /| $NEW_VERSION | $WCM_CORE_COMPONENTS_VERSION | /g" README.md
# echo "After sed: $(cat README.md)"
# Check if package-lock.json is modified
if [[ $(git status --porcelain | grep "package-lock.json") ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ public boolean isFormSelected() {

@Override
public String getThankyouPage() {
if (request != null && StringUtils.isNotBlank(thankyouPage)) {
ResourceResolver resourceResolver = request.getResourceResolver();
if (resourceResolver != null) {
thankyouPage = StringUtils.replace(resourceResolver.map(thankyouPage), "_jcr_content", "jcr:content");
}
}
return GuideUtils.getRedirectUrl(thankyouPage, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ class AEMFormImplTest {
private static final String GRID_LANG = ROOT_PAGE_LANG + "/jcr:content/root/responsivegrid";
private static final String FORM_1 = "/aemform-1";
private static final String FORM_2 = "/aemform-2";
private static final String FORM_WITH_SLINGMAPPINGS = "/aemformv2_slingmappings";
private static final String PATH_FORM_1 = GRID + FORM_1;
private static final String PATH_FORM_2 = GRID + FORM_2;
private static final String PATH_FORM_SLINGMAPPINGS = GRID + FORM_WITH_SLINGMAPPINGS;
private static final String PATH_FORM_LANG = GRID_LANG + FORM_1;

private final AemContext context = FormsCoreComponentTestContext.newAemContext();
Expand Down Expand Up @@ -294,6 +296,16 @@ void testJSONExport() throws Exception {
Utils.testJSONExport(aemform, Utils.getTestExporterJSONPath(BASE, PATH_FORM_1));
}

@Test
void testGetThankYouPageWithResourceResolver() {
// Get form under test using test resource that has _jcr_content in thankyou page path
AEMForm aemForm = getAEMFormUnderTest(PATH_FORM_SLINGMAPPINGS);

// Test the method - verify _jcr_content replacement
String result = aemForm.getThankyouPage();
assertEquals("/content/jcr:content/thank/page.html", result);
}

private AEMForm getAEMFormUnderTest(String resourcePath) {
context.currentResource(resourcePath);
MockSlingHttpServletRequest request = context.request();
Expand Down
6 changes: 6 additions & 0 deletions bundles/core/src/test/resources/aemform/test-content.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
"useiframe" : "true",
"usePageLocale" : "true",
"enableFocusOnFirstField" : true
},
"aemformv2_slingmappings" : {
"jcr:primaryType": "nt:unstructured",
"jcr:title": "",
"sling:resourceType": "core/fd/components/aemform/v1/aemform",
"thankyouPage": "/content/_jcr_content/thank/page"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ Applying `data-cmp-custom-functions-module-url` attribute to the div to point to
This Url should whitelist the AEM author/publish domain in the Cross Origin Resource Sharing (CORS) configuration.

Applying `data-cmp-auto-save` attribute to the `cmp-adaptiveform-container` block to control the auto-save functionality. If the attribute's value is set to true, auto-save will be enabled for the form; otherwise, it will not be triggered. This attribute will be set to true in published mode if enableAutoSave is enabled.

Applying `data-cmp-hamburger-menu-enabled` attribute to the `cmp-adaptiveform-container` block to control the hamburger meu. If the attribute's value is set to true, hamburger menu will be enabled in the mobile view.
Original file line number Diff line number Diff line change
Expand Up @@ -334,27 +334,6 @@ if (typeof window.HamburgerMenu === 'undefined') {
return ul;
}

#hideIndividualComponentsNavigation() {
// hide all the horizontal tabs list
const tabsLists = document.getElementsByClassName('cmp-tabs__tablist');
Array.from(tabsLists).forEach(tabsList => {
tabsList.style.display = 'none';
});

// hide all the vertical tabs list
const verticalTabsLists = document.getElementsByClassName('cmp-verticaltabs__tablist');
Array.from(verticalTabsLists).forEach(tabsList => {
tabsList.style.display = 'none';
});
// hide all the wizard tabs list
const wizardTabsLists = document.getElementsByClassName('cmp-adaptiveform-wizard__tabList');
const wizardTabsNavButton = document.querySelector('.cmp-adaptiveform-wizard__containerNav');
if(wizardTabsNavButton) wizardTabsNavButton.style.display = 'none';
Array.from(wizardTabsLists).forEach(tabsList => {
tabsList.style.display = 'none';
});
}

// Function to find the currently active li
#findActiveLi() {
return document.querySelector(HamburgerMenu.selectors.active).parentElement;
Expand Down Expand Up @@ -492,8 +471,6 @@ if (typeof window.HamburgerMenu === 'undefined') {

this.#attachHamburgerEventListeners(hamburgerIcon, menu);
this.#attachOutsideClickHandler(hamburgerIcon, menu);

this.#hideIndividualComponentsNavigation();
this.#attachMenuEventListeners(menu);
this.#styleSubmenuItems(menu);
parentContainer.innerHTML='';
Expand Down Expand Up @@ -566,6 +543,7 @@ if (typeof window.HamburgerMenu === 'undefined') {

init() {
if(this.formContainer?.getModel()?.properties?.['fd:isHamburgerMenuEnabled']) {
document.querySelector('.cmp-adaptiveform-container')?.setAttribute('data-cmp-hamburger-menu-enabled', 'true');
const panels = this.#getAllPanels();
this.#renderHamburgerItems(panels);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
data-cmp-context-path="${request.contextPath}"
data-cmp-page-lang="${container.containingPageLang}"
data-cmp-path="${resource.path}"
data-cmp-hamburger-menu-enabled="${container.isHamburgerMenuEnabled ? 'true' : 'false'}"
class="cmp-adaptiveform-container cmp-container ${wcmmode.edit ? 'cmp-adaptiveform-container--edit' : ''}"
data-cmp-custom-functions-module-url="${configurationProvider.customFunctionModuleUrl}"
dir="${container.languageDirection}"
Expand Down
14 changes: 7 additions & 7 deletions ui.frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui.frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"dependencies": {
"@aemforms/af-core": "^0.22.114",
"@aemforms/af-formatters": "^0.22.114",
"@aemforms/af-custom-functions": "1.0.13"
"@aemforms/af-custom-functions": "1.0.14"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ describe("Form Runtime with Hamburger Menu", () => {
cy.get(selectors.hamburgerMenuWidget.hamburgerMenu).should("be.visible");
})

it(`Test data-cmp-hamburger-menu-enabled attribute when hamburger menu is enabled`, () => {
cy.viewport('iphone-x');
cy.get('form')
.should('have.attr', 'data-cmp-hamburger-menu-enabled', 'true');
})

it(`Test hamburger menu should render exact number of items`, () => {
cy.viewport('iphone-x');
cy.get(selectors.hamburgerMenuTopContainer.hamburgerMenuIcon).click();
Expand Down

0 comments on commit 08e5f4a

Please sign in to comment.