From d288a5b85cf141e3c93256fa1dfedbf7ddd1283c 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 --- .../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 +- 5 files changed, 6 insertions(+), 3 deletions(-) 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..0242fb3fbe 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.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..c8faff554d 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("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 895f1838db..492ce77ac8 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, + "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..5dcbed1b5b 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, + "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,