Commit 70e61a37 authored by Bert Leunis's avatar Bert Leunis

HSTTWO-4238 add unit test for providing default pickerRootPath if no rootpath is configured

parent 0c45bef8
......@@ -618,6 +618,29 @@ public class HstManageContentTagTest {
+ "} -->"));
}
@Test
public void supplyChannelContentRootAsDefaultPickerRootPath() throws Exception {
tag.setParameterName("docPathParameter");
window.setComponent(new TestComponentWithoutPickerRootPath());
Session jcrSession = createMock(Session.class);
hstRequestContext.setSession(jcrSession);
hstRequestContext.setSiteContentBasePath("my/channel/path");
replay(jcrSession);
assertThat(tag.doEndTag(), is(EVAL_PAGE));
assertThat(response.getContentAsString(), is("<!-- {"
+ "\"HST-Type\":\"MANAGE_CONTENT_LINK\","
+ "\"parameterName\":\"docPathParameter\","
+ "\"parameterValueIsRelativePath\":\"false\","
+ "\"pickerConfiguration\":\"cms-pickers/documents\","
+ "\"pickerRemembersLastVisited\":\"true\","
+ "\"pickerRootPath\":\"/my/channel/path\""
+ "} -->"));
}
private static void assertLogged(final Log4jInterceptor listener, final String expectedMessage) {
assertThat("expected log message '" + expectedMessage + "'", listener.messages().anyMatch((msg) -> msg.equals(expectedMessage)), is(true));
assertThat(listener.getEvents().size(), is(1));
......@@ -665,4 +688,32 @@ public class HstManageContentTagTest {
String getString();
}
@ParametersInfo(type = TestComponentInfoWithoutPickerRootPath.class)
public class TestComponentWithoutPickerRootPath extends GenericHstComponent {
}
private interface TestComponentInfoWithoutPickerRootPath {
@Parameter(name = "docPathParameter")
@JcrPath
String getAbsPath();
@Parameter(name = "relPath")
@JcrPath(isRelative = true)
String getRelPath();
@Parameter(name = "pickerPath")
@JcrPath(
isRelative = true,
pickerInitialPath = "initial-path",
pickerConfiguration = "picker-config",
pickerRemembersLastVisited = false,
pickerSelectableNodeTypes = {"node-type-1", "node-type-2"}
)
String getPickerPath();
@Parameter(name = "string")
String getString();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment