String colorStyle_Expected =
"<table align=\"center\" border=\"0\" cellpadding=\"0\" " +
"cellspacing=\"0\" height=\"1\" width=\"100%\">" +
"<tr><td bgcolor=\"red\" bordercolor=\"red\"/></tr></table>";
HorizontalRuleEmulator emulator = new TableAttrHREmulator();
/**
* Test no style applied
*/
DOMOutputBuffer domOutputBuffer = new DOMOutputBuffer() ;
emulator.emulateHorizontalRule(
domOutputBuffer, createHorizontalRuleAttributes(null));
assertEquals("Incorrect Hr Emulation",noStyle_Expected,
helper.render(domOutputBuffer.getRoot()));
/**
* Test width style applied
*/
domOutputBuffer = new DOMOutputBuffer() ;
emulator.emulateHorizontalRule(
domOutputBuffer, createHorizontalRuleAttributes("width: 50%"));
assertEquals("Incorrect Hr Emulation",widthStyle_Expected,
helper.render(domOutputBuffer.getRoot()));
/**
* Test height style applied
*/
domOutputBuffer = new DOMOutputBuffer() ;
emulator.emulateHorizontalRule(domOutputBuffer,
createHorizontalRuleAttributes("height: 5px"));
assertEquals("Incorrect Hr Emulation",heightStyle_Expected,
helper.render(domOutputBuffer.getRoot()));
/**
* Test colour style applied
*/
domOutputBuffer = new DOMOutputBuffer() ;
emulator.emulateHorizontalRule(domOutputBuffer,
createHorizontalRuleAttributes("color: red"));
assertEquals("Incorrect Hr Emulation",colorStyle_Expected,
helper.render(domOutputBuffer.getRoot()));