From a466653368ac32f02dc5534c1ff263b982bd430f Mon Sep 17 00:00:00 2001 From: bcenusa Date: Mon, 5 Feb 2024 13:32:23 +0200 Subject: [PATCH 1/8] validate alt text only when decorative text is unchecked --- .../components/image/v2/image/clientlibs/editor/js/image.js | 3 ++- .../components/image/v3/image/clientlibs/editor/js/image.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js index 61c95ab28a..3f706e7d4b 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js @@ -135,7 +135,8 @@ var seededValue = $(altInputSelector).attr("data-seeded-value"); var isAltCheckboxChecked = $(altCheckboxSelector).attr("checked"); var assetWithoutDescriptionErrorMessage = "Error: Please provide an asset which has a description that can be used as alt text."; - if (isAltCheckboxChecked && !seededValue) { + var isDecorative = $("coral-checkbox[name='./isDecorative']"); + if (isAltCheckboxChecked && !seededValue && !isDecorative.prop("checked")) { return Granite.I18n.get(assetWithoutDescriptionErrorMessage); } } diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js index ec3e692d9e..f96ef3d44c 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js @@ -171,7 +171,8 @@ var seededValue = $(altInputSelector).attr("data-seeded-value"); var isAltCheckboxChecked = $(altCheckboxSelector).attr("checked"); var assetWithoutDescriptionErrorMessage = "Error: Please provide an asset which has a description that can be used as alt text."; - if (isAltCheckboxChecked && !seededValue) { + var isDecorative = $("coral-checkbox[name='./isDecorative']"); + if (isAltCheckboxChecked && !seededValue && !isDecorative.prop("checked")) { return Granite.I18n.get(assetWithoutDescriptionErrorMessage); } } @@ -344,7 +345,7 @@ $dynamicMediaGroup.hide(); } else { $dynamicMediaGroup.show(); - getSmartCropRenditions(data["dam:scene7File"]); + getSmartCropRenditions(data["dam:sce©ne7File"]); } } }); From 716df14de54c068106b74a8f9f18b5b1b16b8c4d Mon Sep 17 00:00:00 2001 From: bcenusa Date: Mon, 5 Feb 2024 13:33:20 +0200 Subject: [PATCH 2/8] fixed typo --- .../wcm/components/image/v3/image/clientlibs/editor/js/image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js index f96ef3d44c..cc171a7f95 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js @@ -345,7 +345,7 @@ $dynamicMediaGroup.hide(); } else { $dynamicMediaGroup.show(); - getSmartCropRenditions(data["dam:sce©ne7File"]); + getSmartCropRenditions(data["dam:scene7File"]); } } }); From d79a1535658e4986b9eef6349bb591b8f1400138 Mon Sep 17 00:00:00 2001 From: bcenusa Date: Mon, 5 Feb 2024 14:16:37 +0200 Subject: [PATCH 3/8] use vanilla JS to query the isDecorative selector --- .../components/image/v2/image/clientlibs/editor/js/image.js | 4 ++-- .../components/image/v3/image/clientlibs/editor/js/image.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js index 3f706e7d4b..df19264ad3 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js @@ -135,8 +135,8 @@ var seededValue = $(altInputSelector).attr("data-seeded-value"); var isAltCheckboxChecked = $(altCheckboxSelector).attr("checked"); var assetWithoutDescriptionErrorMessage = "Error: Please provide an asset which has a description that can be used as alt text."; - var isDecorative = $("coral-checkbox[name='./isDecorative']"); - if (isAltCheckboxChecked && !seededValue && !isDecorative.prop("checked")) { + var isDecorative = document.querySelector("coral-checkbox[name='./isDecorative']"); + if (isAltCheckboxChecked && !seededValue && !isDecorative.checked) { return Granite.I18n.get(assetWithoutDescriptionErrorMessage); } } diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js index cc171a7f95..813a4962d7 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js @@ -171,8 +171,8 @@ var seededValue = $(altInputSelector).attr("data-seeded-value"); var isAltCheckboxChecked = $(altCheckboxSelector).attr("checked"); var assetWithoutDescriptionErrorMessage = "Error: Please provide an asset which has a description that can be used as alt text."; - var isDecorative = $("coral-checkbox[name='./isDecorative']"); - if (isAltCheckboxChecked && !seededValue && !isDecorative.prop("checked")) { + var isDecorative = document.querySelector("coral-checkbox[name='./isDecorative']"); + if (isAltCheckboxChecked && !seededValue && !isDecorative.checked) { return Granite.I18n.get(assetWithoutDescriptionErrorMessage); } } @@ -345,7 +345,7 @@ $dynamicMediaGroup.hide(); } else { $dynamicMediaGroup.show(); - getSmartCropRenditions(data["dam:scene7File"]); + getSmartCropRenditions(data["dam:sce©ne7File"]); } } }); From b41454e968396c76eab0ca317cf949f833336786 Mon Sep 17 00:00:00 2001 From: bcenusa Date: Mon, 5 Feb 2024 14:21:20 +0200 Subject: [PATCH 4/8] use vanilla JS to query the isDecorative and altValueFromDAM selectors --- .../components/image/v2/image/clientlibs/editor/js/image.js | 6 +++--- .../components/image/v3/image/clientlibs/editor/js/image.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js index df19264ad3..f1ccc65ea0 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v2/image/clientlibs/editor/js/image.js @@ -133,10 +133,10 @@ selector: altInputSelector, validate: function() { var seededValue = $(altInputSelector).attr("data-seeded-value"); - var isAltCheckboxChecked = $(altCheckboxSelector).attr("checked"); + var isAltCheckboxChecked = document.querySelector('coral-checkbox[name="./altValueFromDAM"]').checked; + var isDecorativeChecked = document.querySelector("coral-checkbox[name='./isDecorative']").checked; var assetWithoutDescriptionErrorMessage = "Error: Please provide an asset which has a description that can be used as alt text."; - var isDecorative = document.querySelector("coral-checkbox[name='./isDecorative']"); - if (isAltCheckboxChecked && !seededValue && !isDecorative.checked) { + if (isAltCheckboxChecked && !seededValue && !isDecorativeChecked) { return Granite.I18n.get(assetWithoutDescriptionErrorMessage); } } diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js index 813a4962d7..37294fdbbb 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js @@ -169,10 +169,10 @@ selector: altInputSelector, validate: function() { var seededValue = $(altInputSelector).attr("data-seeded-value"); - var isAltCheckboxChecked = $(altCheckboxSelector).attr("checked"); + var isAltCheckboxChecked = document.querySelector('coral-checkbox[name="./altValueFromDAM"]').checked; + var isDecorativeChecked = document.querySelector("coral-checkbox[name='./isDecorative']").checked; var assetWithoutDescriptionErrorMessage = "Error: Please provide an asset which has a description that can be used as alt text."; - var isDecorative = document.querySelector("coral-checkbox[name='./isDecorative']"); - if (isAltCheckboxChecked && !seededValue && !isDecorative.checked) { + if (isAltCheckboxChecked && !seededValue && !isDecorativeChecked) { return Granite.I18n.get(assetWithoutDescriptionErrorMessage); } } From 7151247b8b2910eb9130ae94d97912358c4b7807 Mon Sep 17 00:00:00 2001 From: bcenusa Date: Mon, 5 Feb 2024 14:58:47 +0200 Subject: [PATCH 5/8] fixed typo --- .../components/image/v3/image/clientlibs/editor/js/image.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js index 37294fdbbb..efba281af5 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js @@ -345,7 +345,7 @@ $dynamicMediaGroup.hide(); } else { $dynamicMediaGroup.show(); - getSmartCropRenditions(data["dam:sce©ne7File"]); + getSmartCropRenditions(data["dam:scene7File"]); } } }); @@ -422,7 +422,6 @@ } }; imagePropertiesRequest.send(); - } /** * Helper function for populating dropdown list From c400019a9f019c50ee8fb0db506c75e0fcafbf75 Mon Sep 17 00:00:00 2001 From: bcenusa Date: Mon, 5 Feb 2024 15:00:09 +0200 Subject: [PATCH 6/8] fixed typo --- .../wcm/components/image/v3/image/clientlibs/editor/js/image.js | 1 + 1 file changed, 1 insertion(+) diff --git a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js index efba281af5..0d1183d5db 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/image/v3/image/clientlibs/editor/js/image.js @@ -422,6 +422,7 @@ } }; imagePropertiesRequest.send(); + } /** * Helper function for populating dropdown list From 7b7e025d32b491d55de6958dce05401c77f39fbe Mon Sep 17 00:00:00 2001 From: levente Date: Mon, 12 Feb 2024 23:51:57 +0200 Subject: [PATCH 7/8] SITES-9113 - Unable to save teaser and image without alt text * added selenium tests --- .../components/it/seljup/tests/image/ImageTests.java | 12 ++++++++++++ .../components/it/seljup/tests/image/v2/ImageIT.java | 9 +++++++++ .../components/it/seljup/tests/image/v3/ImageIT.java | 9 +++++++++ 3 files changed, 30 insertions(+) diff --git a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java index 38e19efe27..4435e53687 100644 --- a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java +++ b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java @@ -224,6 +224,18 @@ public void testAddAltTextAndTitle() throws TimeoutException, InterruptedExcepti + " and title " + captionText); } + public void testSetAssetWithoutDescriptionAsDecorative(boolean imageV3) throws InterruptedException, TimeoutException { + Commons.openSidePanel(); + dragImageWithoutDescription(); + ImageEditDialog editDialog = image.getEditDialog(); + if (!imageV3) { + editDialog.openMetadataTab(); + } + editDialog.checkDecorative(); + Commons.saveConfigureDialog(); + assertFalse(editDialog.isVisible()); + } + public void testSetAssetWithoutDescription() throws InterruptedException, TimeoutException { Commons.openSidePanel(); dragImageWithoutDescription(); diff --git a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v2/ImageIT.java b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v2/ImageIT.java index e9fc92ac80..4d753d9c37 100644 --- a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v2/ImageIT.java +++ b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v2/ImageIT.java @@ -124,4 +124,13 @@ public void testSetAssetWithoutDescription() throws TimeoutException, Interrupte imageTests.testSetAssetWithoutDescription(); } + /** + * Test: set asset from DAM without description as decorative image + */ + @Test + @DisplayName("Test: set asset from DAM without description as decorative") + public void testSetAssetWithoutDescriptionAsDecorative() throws TimeoutException, InterruptedException { + imageTests.testSetAssetWithoutDescriptionAsDecorative(false); + } + } diff --git a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java index 9c550ca04d..5e4c433607 100644 --- a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java +++ b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/v3/ImageIT.java @@ -279,4 +279,13 @@ public void testSmartCropDialogOnNGDMImageV3_customAspectRatio() throws TimeoutE public void testSmartCropDialogOnNGDMImageV3_flipAspectRatio() throws TimeoutException, InterruptedException, ClientException { imageTests.testNGDMSmartCropDialogImageV3_aspectRatioFlip(); } + + /** + * Test: set asset from DAM without description as decorative image + */ + @Test + @DisplayName("Test: set asset from DAM without description as decorative") + public void testSetAssetWithoutDescriptionAsDecorative() throws TimeoutException, InterruptedException { + imageTests.testSetAssetWithoutDescriptionAsDecorative(true); + } } From 58358f3fae711414f3d46c003998d1ca1428043b Mon Sep 17 00:00:00 2001 From: levente Date: Tue, 13 Feb 2024 11:00:07 +0200 Subject: [PATCH 8/8] SITES-9113 - Unable to save teaser and image without alt text * added selenium tests --- .../wcm/core/components/it/seljup/tests/image/ImageTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java index 4435e53687..74c0613103 100644 --- a/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java +++ b/testing/it/e2e-selenium/src/test/java/com/adobe/cq/wcm/core/components/it/seljup/tests/image/ImageTests.java @@ -233,7 +233,7 @@ public void testSetAssetWithoutDescriptionAsDecorative(boolean imageV3) throws I } editDialog.checkDecorative(); Commons.saveConfigureDialog(); - assertFalse(editDialog.isVisible()); + assertFalse(editDialog.isVisible(), "Configuration dialog should be closed with no errors."); } public void testSetAssetWithoutDescription() throws InterruptedException, TimeoutException {