Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Element


    protected void checkRenderAltText(String altText, DOMOutputBuffer buffer) {
        // We changed the default for (X)HTML to render a logical SPAN to
        // avoid adding whitespace around the text. I believe SPAN might be
        // better as the default, but this would be a larger change.
        Element root = buffer.getCurrentElement();
        Element span = checkElementEquals("span", root.getHead());
        checkTextEquals(altText, span.getHead());
    }
View Full Code Here


        Element span = checkElementEquals("span", root.getHead());
        checkTextEquals(altText, span.getHead());
    }

    public void testAddPhoneNumberAttributes() throws Exception {
        Element element = domFactory.createElement();
        PhoneNumberAttributes attributes =
            createPhoneNumberAttributes(phoneNumberReference);
        element.setName("test");

        protocol.addPhoneNumberAttributes(element, attributes);

        checkAddPhoneNumberAttributes(element);
    }
View Full Code Here

        attrs.setSrc("http://www.images.com/test/image.jpg");
        attrs.setAssetURLSuffix("?name=fred");
        protocol.doImage(buffer,attrs);

        Element root = buffer.getCurrentElement();
        Element el = (Element) root.getHead();
        assertNotNull("Image element should exist.", el );
        assertEquals("Image element should exist", "img", el.getName());
        assertEquals("Incorrect src attribute",
                "http://www.images.com/test/image.jpg?name=fred",
                el.getAttributeValue("src"));
    }
View Full Code Here

        protocol.openAnchor(buffer, attributes);
        protocol.closeAnchor(buffer, attributes);

        // Check that the element generated has appropriate id and name
        // attributes.
        Element root = buffer.getCurrentElement();
        Element element = (Element) root.getHead();
//        // Handle the case where some protocols wrap the tag in another tag.
//        if (!element.getName().equals("a")) {
//            element = (Element) element.getHead();
//        }
        DOMAssertionUtilities.assertElement("a", element);
View Full Code Here

        // Oo the image to generate the markup.
        protocol.doImage(buffer, attributes);

        // Check that the element generated has appropriate id and name
        // attributes.
        Element root = buffer.getCurrentElement();
        Element element = (Element) root.getHead();
//        // Handle the case where some protocols wrap the tag in another tag.
//        if (!element.getName().equals("img")) {
//            element = (Element) element.getHead();
//        }
        DOMAssertionUtilities.assertElement("img", element);
View Full Code Here

        attributes.setAltText("Alternate Text");

        protocol.doImage(buffer, attributes);

        // valid src and alt generates <img src="url" alt="text" />
        Element root = buffer.getCurrentElement();
        Element element = (Element) root.getHead();

        DOMAssertionUtilities.assertElement("img", element);
        DOMAssertionUtilities.assertAttributeEquals("src","myImage.jpg",element);
        DOMAssertionUtilities.assertAttributeEquals("alt","Alternate Text",element);
    }
View Full Code Here

        attributes.setAltText(expected);

        protocol.doImage(buffer, attributes);

        // No src with alt text generates <span>text</span>
        Element root = buffer.getCurrentElement();
        Element span = (Element) root.getHead();

        DOMAssertionUtilities.assertElement("span", span);

        Text altText = (Text)span.getHead();
        String txtAltText = new String(altText.getContents(),
                0, expected.length());
        assertEquals("Incorrect Text", expected, txtAltText);
    }
View Full Code Here

        attributes.setAltText("    ");

        protocol.doImage(buffer, attributes);

        // No src and whitespace text generates no output
        Element root = buffer.getCurrentElement();
        Element empty = (Element) root.getHead();
        assertNull("No output should be generated", empty);
    }
View Full Code Here

        // select
        protocol.doSelectInput(attributes);

        // extract the result
        final Document document = domFactory.createDocument();
        Element root = buffer.getRoot();
        if (root.getName() == null) {
            root.setName("testRoot");
        }
        document.addNode(root);
        StyledDOMTester tester = new StyledDOMTester(true);
        final String result = tester.render(document);
View Full Code Here

        AnchorAttributes attributes = new AnchorAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        // test no link style
        Element element = domFactory.createStyledElement(attributes.getStyles());
        protocol.addAnchorAttributes(element, attributes);
        assertEquals("no link style means no button attribute",
                null, element.getAttributeValue("button"));

        // test unrelated numeric shortcut link style
        attributes.setStyles(StylesBuilder.getCompleteStyles(
                "mcs-link-style: numeric-shortcut"));
        element = domFactory.createStyledElement(attributes.getStyles());
        protocol.addAnchorAttributes(element, attributes);
        assertEquals("unrelated link style means no button attribute",
                null, element.getAttributeValue("button"));

        // test proper button link style
        attributes.setStyles(StylesBuilder.getCompleteStyles(
                "mcs-link-style: button"));
        element = domFactory.createStyledElement(attributes.getStyles());
        protocol.addAnchorAttributes(element, attributes);
        assertEquals("button link style means button attribute",
                "button", element.getAttributeValue("button"));

    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom.Element

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.