Package com.volantis.mcs.protocols.menu.shared.model

Examples of com.volantis.mcs.protocols.menu.shared.model.ConcreteMenuItem


     */
    public void testOuter() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
       
        // Create the renderer we are to test.
        MenuItemBracketingRenderer renderer =
                new DefaultAnchorMenuItemRenderer(
                        new TestDeprecatedAnchorOutput(), true, null);

        // Do a render.
        String actual = getRenderOutputAsString(renderer, item,
                                                "[test delegate]");
        //System.out.println(actual);
       
        // Assemble the expected value (rendered menu item).
        String expected = 
                "<test-anchor " +
                        "href=\"" + item.getHref().getURL() + "\" " +
                        "id=\"the id\"" + " " +
//                        "style-class=\"the style class\"" + " " +
                        "tag-name=\"the tag name\"" + ">" +
                    "[test delegate]" +
                "</test-anchor>";
View Full Code Here


    public void testEmulation() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setElementName("the tag name");
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
       
        // Create the renderer we are to test.
        MenuItemBracketingRenderer renderer =
                new DefaultAnchorMenuItemRenderer(
                        new TestDeprecatedAnchorOutput(), false,
                        new TestNumericShortcutEmulationRenderer());

        // Do a render.
        String actual = getRenderOutputAsString(renderer, item,
                                                "[test delegate]");
        System.out.println(actual);
       
        // Assemble the expected value (rendered menu item).
        String expected = 
                "[emul-start]" +
                "<test-anchor " +
                        "href=\"" + item.getHref().getURL() + "\" " +
                        "shortcut=\"[emul-access-key]\"" + " " +
                        "tag-name=\"a\"" + ">" +
                    "[emul-prefix]" +
                    "[test delegate]" +
                "</test-anchor>" +
View Full Code Here

        // Create the menu item for the test
        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setElementName(elementTagName);
        elementDetails.setStyles(StylesBuilder.getEmptyStyles());
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setSegment("anotherframe");

        // Create the renderer to test
        MenuItemBracketingRenderer renderer =
                new DefaultAnchorMenuItemRenderer(
                        new TestDeprecatedAnchorOutput(), true, null);

        // Render the anchor
        String actual = getRenderOutputAsString(renderer, item,
                                                "[test delegate]");
        // Assemble the expected value
        String expected =
                "<test-anchor " +
                        "href=\"" + item.getHref().getURL() + "\" " +
                        "tag-name=\"" + elementTagName + "\" " +
                        "target=\"" + item.getSegment() + "\"" +
                        ">" +
                    "[test delegate]" +
                "</test-anchor>";
        expected = DOMUtilities.provideDOMNormalizedString(expected);
View Full Code Here

     */
    public void testMCSAttributesAnnotatedWithStyles() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item =
                new ConcreteMenuItem(elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("http://www.bbc.co.uk"));

        // Create the renderer we are to test.
        DefaultAnchorMenuItemRenderer renderer =
                new DefaultAnchorMenuItemRenderer(
                        new TestDeprecatedAnchorOutput(), true, null);
View Full Code Here

                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(
View Full Code Here

            throws Exception {

        // Create the menu item to test.
        final ConcreteElementDetails elementDetails =
                createTestElementDetails();
        final ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setShortcut(new LiteralTextAssetReference("the shortcut"));

        // Create the renderer we are to test.
        final TestDeprecatedExternalLinkOutput externalLinkOutput =
                new TestDeprecatedExternalLinkOutput();
        final VDXMLExternalLinkMenuItemRenderer renderer =
                new VDXMLExternalLinkMenuItemRenderer(externalLinkOutput,
                        spanMenuItemRenderer);

        // Do a render.
        final String actualNormal = getRenderOutputAsString(renderer, item,
                                                "[test delegate]");
        //System.out.println(actualNormal);
        final String actualExternal = externalLinkOutput.getResult();
        //System.out.println(actualExternal);

        // Assemble the expected value which was rendered normally.
        String expectedNormal;
        // If we have a span renderer
        if (spanMenuItemRenderer != null) {
            // then it should render something.
            expectedNormal =
                "<span " +
//                    "class=\"the style class\"" + " " +
                ">" +
                    "[test delegate]" +
                "</span>";
            expectedNormal = DOMUtilities.provideDOMNormalizedString(
                    expectedNormal);
        } else {
            // otherwise it can't render the span.
            expectedNormal = "[test delegate]" ;
        }

        // Compare the expected value we calculated with the actual value
        // which was rendered.
        assertEquals("Normal not as expected",
                expectedNormal, actualNormal);

        // Assemble the expected value which was rendered externally.
        String expectedExternal =
                "<external-link " +
                        "href=\"" + item.getHref().getURL() + "\" " +
                        "shortcut=\"" + item.getShortcut().getText(TextEncoding.PLAIN) + "\" " +
                        // style attributes ignored here
                "/>";
        expectedExternal = DOMUtilities.provideDOMNormalizedString(
                expectedExternal);
View Full Code Here

     * nothing to be rendered, as a link without a href makes no sense.
     */
    public void testNullHref() throws Exception {

        // Create the menu item to test.
        ConcreteMenuItem item = new ConcreteMenuItem(
                new ElementDetailsStub(), new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference(null));
        item.setShortcut(new LiteralTextAssetReference("the shortcut"));

        // Check that the renderer did not open any output.
        checkUnopened(item);
    }
View Full Code Here

     * sense as the user cannot action it.
     */
    public void testNullShortcut() throws Exception {

        // Create the menu item to test.
        ConcreteMenuItem item = new ConcreteMenuItem(
                new ElementDetailsStub(), new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setShortcut(null);

        // Check that the renderer did not open any output.
        checkUnopened(item);

    }
View Full Code Here

        // Create the test text, label, and then the menu item
        final ConcreteMenuText text = new ConcreteMenuText(elementDetails);
        text.setText(menuText);
        final ConcreteMenuLabel label = new ConcreteMenuLabel(
                new ElementDetailsStub(), text);
        final ConcreteMenuItem item = new ConcreteMenuItem(
                new ElementDetailsStub(), label);
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setShortcut(new LiteralTextAssetReference("the shortcut"));

        String expectedContent = createExpectedContent(item);
        String expected = null;
        if (withStyle) {
            expected =
View Full Code Here

     */
    public void testInner() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setShortcut(new LiteralTextAssetReference("the shortcut"));
        item.setTitle("the title");
       
        // Create the renderer we are to test.
        MenuItemBracketingRenderer renderer =
                new DefaultAnchorMenuItemRenderer(
                        new TestDeprecatedAnchorOutput(), false, null);

        // Do a render.
        String actual = getRenderOutputAsString(renderer, item,
                                                "[test delegate]");
        //System.out.println(actual);
       
        // Assemble the expected value (rendered menu item).
        String expected = 
                "<test-anchor " +
                        "href=\"" + item.getHref().getURL() + "\" " +
                        "shortcut=\"" + item.getShortcut().getText(TextEncoding.PLAIN) + "\" " +
                        "title=\"" + item.getTitle() + "\" " +
                        // style attributes ignored here
                        "tag-name=\"a\"" + ">" +
                    "[test delegate]" +
                "</test-anchor>";
        expected = DOMUtilities.provideDOMNormalizedString(expected);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.menu.shared.model.ConcreteMenuItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.