use of com.adobe.granite.ui.components.rendercondition.RenderCondition in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageDelegateRenderConditionTest method testDoGet.
@Test
public void testDoGet() throws Exception {
ImageDelegateRenderCondition imageDelegateRenderCondition = new ImageDelegateRenderCondition();
context.requestPathInfo().setSuffix(SUFFIX);
imageDelegateRenderCondition.doGet(context.request(), context.response());
RenderCondition renderCondition = (RenderCondition) context.request().getAttribute(RenderCondition.class.getName());
assertNotNull(renderCondition);
assertTrue(renderCondition.check());
ExpressionCustomizer expressionCustomizer = (ExpressionCustomizer) context.request().getAttribute(ExpressionCustomizer.class.getName());
assertNotNull(expressionCustomizer);
assertTrue(expressionCustomizer.hasVariable(AbstractImageDelegatingModel.IMAGE_DELEGATE));
}
use of com.adobe.granite.ui.components.rendercondition.RenderCondition in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementNamesRenderConditionTest method testSingleTextDisplayMode.
@Test
void testSingleTextDisplayMode() throws ServletException, IOException {
RenderCondition renderCondition = getRenderCondition(RC_SINGLE_TEXT);
assertTrue(renderCondition.check(), "Invalid value of render condition");
}
use of com.adobe.granite.ui.components.rendercondition.RenderCondition in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementNamesRenderConditionTest method getRenderCondition.
/**
* Calls the servlet with the specified render conditino resource and returns the resulting render condition.
*/
private RenderCondition getRenderCondition(String name) throws ServletException, IOException {
// get render condition resource
ResourceResolver resolver = context.resourceResolver();
Resource renderCondition = resolver.getResource(RENDERCONDITIONS_PATH + "/" + name);
// mock the request
MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(resolver, context.bundleContext());
request.setResource(renderCondition);
// call the servlet
servlet.doGet(request, new MockSlingHttpServletResponse());
// return the resulting render condition
return (RenderCondition) request.getAttribute(RenderCondition.class.getName());
}
use of com.adobe.granite.ui.components.rendercondition.RenderCondition in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ElementNamesRenderConditionTest method testMultipleElementsDisplayMode.
@Test
void testMultipleElementsDisplayMode() throws ServletException, IOException {
RenderCondition renderCondition = getRenderCondition(RC_MULTI);
assertFalse(renderCondition.check(), "Invalid value of render condition");
}
Aggregations