*
* @throws java.io.IOException thrown if DOM cannot be converted to a String
*/
public void testTransformElementWithEmulatedElements() throws IOException {
deviceMock = new InternalDeviceMock("deviceMock", expectations);
populateEmulateEmphasisTags();
initializeTransformer();
Document orig = domFactory.createDocument();
Element wml = generateTestWML();
orig.addNode(wml);
transformer.transformElement(wml);
String expected =
"<wml>" +
"<card title=\"the test title\">" +
"<BLOCK>" +
"<div>TITLEthe test titleTITLE</div>" +
"</BLOCK>" +
"<BLOCK align=\"center\">" +
"<div>**<a href=\"wtai://wp/mc;20405050606\">20405050606</a>**</div>" +
"<div>**<anchor href=\"wtai://wp/mc;20405050606\">20405050606</anchor>**</div>" +
"<div>BIGThis is big text.BIG</div>" +
"<div>BOLDThis is b text.BOLD</div>" +
"<div>EMThis is em text.EM</div>" +
"<div>ITALICThis is i text.ITALIC</div>" +
"<div>SMALLThis is small text.SMALL</div>" +
"<div>STRONGThis is strong text.STRONG</div>" +
"<div>_This is u text._</div>" +
"</BLOCK>" +
"</card>" +
"</wml>";
assertEquals(expected, DOMUtilities.toString(orig));
// And again.
deviceMock = new InternalDeviceMock("deviceMock", expectations);
// test that prefixes on their own are correctly rendered
expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_BOLD_TAG, true,
"BOLD", "BOLD", null);
// test that an altTag on its own is correctly rendered
expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_EMPHASIZE_TAG, true,
null, null, "div");
// test that link highlighting without an alternate tag works correctly
expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_LINK_HIGHLIGHTING,
true, "**", "**", null);
// special case - test that card titles with prefixes but no altTag
// are correctly rendered
expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_CARD_TITLE, true,
"TITLE", "TITLE", null);
populateEmulateEmphasisTags();
initializeTransformer();
orig = domFactory.createDocument();
wml = generateTestWML();
orig.addNode(wml);
transformer.transformElement(wml);
expected =
"<wml>" +
"<card title=\"the test title\">" +
"<BLOCK>TITLEthe test titleTITLE</BLOCK>" +
"<BLOCK align=\"center\">" +
"**<a href=\"wtai://wp/mc;20405050606\">20405050606</a>**" +
"**<anchor href=\"wtai://wp/mc;20405050606\">20405050606</anchor>**" +
"<div>BIGThis is big text.BIG</div>" +
"BOLDThis is b text.BOLD" +
"<div>This is em text.</div>" +
"<div>ITALICThis is i text.ITALIC</div>" +
"<div>SMALLThis is small text.SMALL</div>" +
"<div>STRONGThis is strong text.STRONG</div>" +
"<div>_This is u text._</div>" +
"</BLOCK>" +
"</card>" +
"</wml>";
assertEquals(expected, DOMUtilities.toString(orig));
// And again.
deviceMock = new InternalDeviceMock("deviceMock", expectations);
// test that prefixes on their own are correctly rendered
expectEmphasisTag(DevicePolicyConstants.EMULATE_WML_BOLD_TAG, true,
"BOLD", "BOLD", null);