use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class LiveEditAttributeInjectionTest method injectHtmlWithBom.
@Test
public void injectHtmlWithBom() throws Exception {
final String html = readResource("part1SourceBom.html");
final LiveEditAttributeInjection liveEditAttributeInjection = new LiveEditAttributeInjection();
final PortalResponse.Builder responseBuilder = PortalResponse.create().body(html);
final PortalResponse portalResponse = liveEditAttributeInjection.injectLiveEditAttribute(responseBuilder.build(), TextComponentType.INSTANCE);
final String outputHtml = portalResponse.getBody().toString();
final String expectedResult = readResource("part1RenderedBom.html");
assertEquals(expectedResult, outputHtml);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class LiveEditAttributeInjectionTest method simpleInjection.
@Test
public void simpleInjection() throws Exception {
final String html = readResource("part1Source.html");
final LiveEditAttributeInjection liveEditAttributeInjection = new LiveEditAttributeInjection();
final PortalResponse.Builder responseBuilder = PortalResponse.create().body(html);
final PortalResponse portalResponse = liveEditAttributeInjection.injectLiveEditAttribute(responseBuilder.build(), TextComponentType.INSTANCE);
final String outputHtml = portalResponse.getBody().toString();
final String expectedResult = readResource("part1Rendered.html");
assertEquals(expectedResult, outputHtml);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class LiveEditAttributeInjectionTest method injectWithAttributes.
@Test
public void injectWithAttributes() throws Exception {
final String html = readResource("part2Source.html");
final LiveEditAttributeInjection liveEditAttributeInjection = new LiveEditAttributeInjection();
final PortalResponse.Builder responseBuilder = PortalResponse.create().body(html);
final PortalResponse portalResponse = liveEditAttributeInjection.injectLiveEditAttribute(responseBuilder.build(), TextComponentType.INSTANCE);
final String outputHtml = portalResponse.getBody().toString();
final String expectedResult = readResource("part2Rendered.html");
assertEquals(expectedResult, outputHtml);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class LiveEditAttributeInjectionTest method injectWithXmlDeclaration.
@Test
public void injectWithXmlDeclaration() throws Exception {
final String html = readResource("part4Source.html");
final LiveEditAttributeInjection liveEditAttributeInjection = new LiveEditAttributeInjection();
final PortalResponse.Builder responseBuilder = PortalResponse.create().body(html);
final PortalResponse portalResponse = liveEditAttributeInjection.injectLiveEditAttribute(responseBuilder.build(), TextComponentType.INSTANCE);
final String outputHtml = portalResponse.getBody().toString();
final String expectedResult = readResource("part4Rendered.html");
assertEquals(expectedResult, outputHtml);
}
use of com.enonic.xp.portal.PortalResponse in project xp by enonic.
the class LiveEditAttributeInjectionTest method injectEmptySingleTag.
@Test
public void injectEmptySingleTag() throws Exception {
final String html = readResource("part3Source.html");
final LiveEditAttributeInjection liveEditAttributeInjection = new LiveEditAttributeInjection();
final PortalResponse.Builder responseBuilder = PortalResponse.create().body(html);
final PortalResponse portalResponse = liveEditAttributeInjection.injectLiveEditAttribute(responseBuilder.build(), TextComponentType.INSTANCE);
final String outputHtml = portalResponse.getBody().toString();
final String expectedResult = readResource("part3Rendered.html");
assertEquals(expectedResult, outputHtml);
}
Aggregations