TestMarinerPageContext testContext = new TestMarinerPageContext();
testContext.pushRequestContext(requestContext);
ContextInternals.setMarinerPageContext(requestContext, testContext);
protocol.setMarinerPageContext(testContext);
ParagraphAttributes paraAttrs = new ParagraphAttributes();
paraAttrs.setStyles(StylesBuilder.getCompleteStyles(
"white-space: nowrap"));
// Create a style with a nowrap whitespace. This should mean that the
// protocol creates a paragraph with mode="nowrap".
protocol.openParagraph(buffer, paraAttrs);
Element element = buffer.getCurrentElement();
String modeValue = element.getAttributeValue("mode");
// There should be mode="nowrap" attribute.
assertEquals("Unexpected mode value on p", "nowrap", modeValue);
// Create a style with a pre whitespace. This should mean that the
// protocol creates a paragraph with no mode attribute.
paraAttrs.setStyles(StylesBuilder.getCompleteStyles(
"white-space: pre"));
protocol.openParagraph(buffer, paraAttrs);
element = buffer.getCurrentElement();
modeValue = element.getAttributeValue("mode");