Commit 266d7bae authored by Bert Leunis's avatar Bert Leunis

HSTTWO-4247 initial picker path must be absolute

It should be prepended by the pickerRootPath if that is given, otherwise the channel root path
parent c6238763
......@@ -491,7 +491,7 @@ public class HstManageContentTagTest {
+ "\"parameterName\":\"pickerPath\","
+ "\"parameterValueIsRelativePath\":\"true\","
+ "\"pickerConfiguration\":\"picker-config\","
+ "\"pickerInitialPath\":\"initial-path\","
+ "\"pickerInitialPath\":\"/root-path/initial-path\","
+ "\"pickerRemembersLastVisited\":\"false\","
+ "\"pickerRootPath\":\"/root-path\","
+ "\"pickerSelectableNodeTypes\":\"node-type-1,node-type-2\""
......@@ -714,6 +714,33 @@ public class HstManageContentTagTest {
+ "} -->"));
}
@Test
public void supplyChannelContentRootAsDefaultPickerRootPathAndPickerInitialPath() throws Exception {
tag.setParameterName("pickerPath");
window.setComponent(new TestComponentWithoutPickerRootPath());
final ResolvedMount resolvedMount = createMock(ResolvedMount.class);
final Mount mount = createMock(Mount.class);
expect(resolvedMount.getMount()).andReturn(mount).anyTimes();
expect(mount.getContentPath()).andReturn("/my/channel/path").anyTimes();
hstRequestContext.setResolvedMount(resolvedMount);
replay(resolvedMount, mount);
assertThat(tag.doEndTag(), is(EVAL_PAGE));
assertThat(response.getContentAsString(), is("<!-- {"
+ "\"HST-Type\":\"MANAGE_CONTENT_LINK\","
+ "\"parameterName\":\"pickerPath\","
+ "\"parameterValueIsRelativePath\":\"true\","
+ "\"pickerConfiguration\":\"picker-config\","
+ "\"pickerInitialPath\":\"/my/channel/path/initial-path\","
+ "\"pickerRemembersLastVisited\":\"false\","
+ "\"pickerRootPath\":\"/my/channel/path\","
+ "\"pickerSelectableNodeTypes\":\"node-type-1,node-type-2\""
+ "} -->"));
}
private static void assertLogged(final Log4jInterceptor listener, final String expectedMessage) {
final List<String> messages = listener.messages().collect(Collectors.toList());
assertThat(messages.size(), is(1));
......
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