From 176d8bdc50f0142a7ecff9e23e61780a7980cb29 Mon Sep 17 00:00:00 2001 From: Pavitra Khatri Date: Tue, 8 Oct 2024 15:17:35 +0530 Subject: [PATCH] Add Show Popup property under custom property --- .../core/components/internal/form/ReservedProperties.java | 1 + .../internal/models/v1/form/TermsAndConditionsImpl.java | 1 + .../internal/models/v1/form/TermsAndConditionsImplTest.java | 2 +- .../form/termsandconditions/exporter-termsandconditions.json | 1 + .../exporter-termsandconditionsNoWrapData.json | 3 ++- .../test/resources/form/termsandconditions/test-content.json | 2 +- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/ReservedProperties.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/ReservedProperties.java index e32da39217..37317de405 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/ReservedProperties.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/ReservedProperties.java @@ -162,6 +162,7 @@ private ReservedProperties() { public static final String FD_ENABLE_AUTO_SAVE = "fd:enableAutoSave"; public static final String FD_AUTO_SAVE_STRATEGY_TYPE = "fd:autoSaveStrategyType"; public static final String FD_AUTO_SAVE_INTERVAL = "fd:autoSaveInterval"; + public static final String FD_PN_SHOW_AS_POPUP = "fd:showAsPopup"; private static final Set reservedProperties = aggregateReservedProperties(); private static Set aggregateReservedProperties() { diff --git a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImpl.java b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImpl.java index ba467f2eab..f17017485c 100644 --- a/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImpl.java +++ b/bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImpl.java @@ -87,6 +87,7 @@ public boolean isShowAsPopup() { Map properties = super.getProperties(); if (resource.getValueMap().containsKey(CUSTOM_TNC_PROPERTY)) { properties.put(CUSTOM_TNC_PROPERTY, true); + properties.put(ReservedProperties.FD_PN_SHOW_AS_POPUP, isShowAsPopup()); } return properties; } diff --git a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java index 228abc2260..bc2d902a4e 100644 --- a/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java +++ b/bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TermsAndConditionsImplTest.java @@ -95,7 +95,6 @@ void testExportedType() throws Exception { public void testGetProperties() { TermsAndConditions tnc = Utils.getComponentUnderTest(PATH_TNC, TermsAndConditions.class, context); Assert.assertTrue(tnc.isShowApprovalOption()); - Assert.assertTrue(tnc.isShowAsPopup()); Assert.assertFalse(tnc.isShowLink()); } @@ -105,6 +104,7 @@ public void testCustomFDProperty() { Map props = tnc.getProperties(); Assert.assertTrue(props.containsKey("fd:tnc")); Assert.assertTrue((Boolean) props.get("fd:tnc")); + Assert.assertFalse((Boolean) props.get("fd:showAsPopup")); } diff --git a/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditions.json b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditions.json index 0a4f38eebb..500683b6e1 100644 --- a/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditions.json +++ b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditions.json @@ -11,6 +11,7 @@ }, "fd:path": "/content/termsandconditions", "fd:tnc": true, + "fd:showAsPopup": false, "customProp": "customPropValue" }, "label": { diff --git a/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json index a2e0b6ead3..24325d7850 100644 --- a/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json +++ b/bundles/af-core/src/test/resources/form/termsandconditions/exporter-termsandconditionsNoWrapData.json @@ -9,7 +9,8 @@ "dorExcludeDescription": false }, "fd:path": "/content/termsandconditionsNoWrapData", - "fd:tnc": true + "fd:tnc": true, + "fd:showAsPopup": true }, "label": { "value": "Terms And Conditions" diff --git a/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json b/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json index 3394a3594b..d44b72fe3f 100644 --- a/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json +++ b/bundles/af-core/src/test/resources/form/termsandconditions/test-content.json @@ -3,7 +3,7 @@ "showApprovalOption": true, "jcr:title": "Terms And Conditions", "fd:tnc": true, - "showAsPopup": true, + "showAsPopup": false, "name": "termsandconditions1694159302516", "sling:resourceType": "core/fd/components/form/termsandconditions/v1/termsandconditions", "wrapData": true,