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

CCVAR: Fixed Same Attribute not updating correctly #3275

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)

## Unreleased ([details][unreleased changes details])

### Fix

- #3275 - CCVAR: Fixed Same Attribute not updating correctly.

## Added

- #3333 - Use lodash embedded by ACS AEM Commons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void startElement(String uri, String localName, String quaName, Attribute
(String) ContentVariableReplacementUtil.getValue(contentVariableReplacements, key);
String newAttrValue = ContentVariableReplacementUtil.doReplacement(currentAttribute, key,
replaceValue, propertyConfigService.getAction(key));
currentAttribute = newAttrValue;
newAttrs.setValue(i, newAttrValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,21 @@ public void testHrefReplacementNotEncoded() throws Exception {
assertEquals("/content/page.html?title=inheritedValue", out.getValue(0));
}

@Test
public void testMultipleAttributeReplacement() throws Exception {
reinitTransformer(true);

AttributesImpl attributes = new AttributesImpl();
attributes.addAttribute(null, "title", null, "CDATA", "((page_properties.jcr:title)) and ((inherited_page_properties.inheritedProperty))");
transformer.startElement(null, "a", null, attributes);

ArgumentCaptor<AttributesImpl> attributesCaptor = ArgumentCaptor.forClass(AttributesImpl.class);
verify(handler, atLeast(1)).startElement(isNull(String.class), eq("a"), isNull(String.class), attributesCaptor.capture());

Attributes out = attributesCaptor.getValue();
assertEquals("Arctic Surfing In Lofoten and inheritedValue", out.getValue(0));
}

private void reinitTransformer(boolean defaultService) throws Exception {
if (defaultService) {
defaultService(context);
Expand Down
Loading