// Create the menu item to test.
ConcreteElementDetails elementDetails = new ConcreteElementDetails();
elementDetails.setElementName("the tag name");
elementDetails.setStyles(StylesBuilder.getEmptyStyles());
ConcreteMenuIcon icon = new ConcreteMenuIcon(elementDetails);
ImageAssetReference normalRef =
new TestNormalImageAssetReference("the normal url");
ImageAssetReference overRef =
new TestNormalImageAssetReference("the over url");
icon.setNormalURL(normalRef);
icon.setOverURL(overRef);
ConcreteMenuItem item = new ConcreteMenuItem(
new ElementDetailsStub(), new ConcreteMenuLabel(
new ElementDetailsStub(), createMenuText(), icon));
// Create the renderer we are to test.
MenuItemComponentRenderer renderer = createImageMenuItemRenderer(
new TestDeprecatedImageOutput(), false);
// Do a render.
String actual = getRenderOutputAsString(renderer, item);
//System.out.println(actual);
// Assemble the expected value (rendered menu item).
String expected =
"<test-image " +
// Old code used to do this - but too bodgy for new code
// and no time to fix it properly..
// "border=\"0\" " +
"event-" + EventConstants.ON_MOUSE_OUT + "=" +
"\"this.src='" + normalRef.getURL() + "'\" " +
"event-" + EventConstants.ON_MOUSE_OVER + "=" +
"\"this.src='" + overRef.getURL() + "'\" " +
"src=\"" + normalRef.getURL() + "\" " +
"tag-name=\"the tag name\"" +
"/>";
expected = DOMUtilities.provideDOMNormalizedString(expected);
//System.out.println(expected);