Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITES-9113 - Unable to save teaser and image without alt text #2665

Merged
merged 10 commits into from
Feb 13, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +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.";
if (isAltCheckboxChecked && !seededValue) {
if (isAltCheckboxChecked && !seededValue && !isDecorativeChecked) {
return Granite.I18n.get(assetWithoutDescriptionErrorMessage);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +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.";
if (isAltCheckboxChecked && !seededValue) {
if (isAltCheckboxChecked && !seededValue && !isDecorativeChecked) {
return Granite.I18n.get(assetWithoutDescriptionErrorMessage);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(), "Configuration dialog should be closed with no errors.");
}

public void testSetAssetWithoutDescription() throws InterruptedException, TimeoutException {
Commons.openSidePanel();
dragImageWithoutDescription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading