Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlLink


        createAndAddStyleResource(RESOURCE_URI_PREFIX + userXcss);
        createAndAddStyleResource(RESOURCE_URI_PREFIX + componentXcss).setRendered(false);

        HtmlPage page = renderView();
        List<HtmlLink> styles;
        HtmlLink userLink;

        styles = selectStylesByHhref(page, userXcss);
        assertEquals(1, styles.size());
        userLink = styles.get(0);
        assertEquals("user", userLink.getClassAttribute());
        assertEquals("", userLink.getMediaAttribute());
        styles = selectStylesByHhref(page, componentXcss);
        assertEquals(0, styles.size());
    }
View Full Code Here


        styleComponent.setSrc(InternetResourceBuilder.getInstance().getResourceForKey(userXcss));
        facesContext.getViewRoot().getChildren().add(styleComponent);

        HtmlPage page = renderView();
        List<HtmlLink> styles;
        HtmlLink userLink;

        styles = selectStylesByHhref(page, userXcss);
        assertEquals(1, styles.size());
        userLink = styles.get(0);
        assertEquals("user", userLink.getClassAttribute());
        assertEquals("", userLink.getMediaAttribute());
        styles = selectStylesByHhref(page, componentXcss);
        assertEquals(1, styles.size());
        userLink = styles.get(0);
        assertEquals("user", userLink.getClassAttribute());
        assertEquals("", userLink.getMediaAttribute());
    }
View Full Code Here

        HtmlPage page = renderView();
        List<HtmlLink> styles = selectStylesByHhref(page, userXcss);

        assertEquals(1, styles.size());

        HtmlLink userLink = styles.get(0);

        assertEquals("user", userLink.getClassAttribute());
        assertEquals("screen print", userLink.getMediaAttribute());
    }
View Full Code Here

    /**
     * <p>Verify the presence and contents of a stylesheet element.</p>
     */
    public void testStylesheet() throws Exception {

        HtmlLink link = null;
        Iterator kids = head().getChildElementsIterator();
        while (kids.hasNext()) {
            HtmlElement kid = (HtmlElement) kids.next();
            if (kid instanceof HtmlLink) {
                assertNull("Only one stylesheet element present", link);
                link = (HtmlLink) kid;
            }
        }
        assertNotNull("Exactly one stylesheet element present", link);
        assertEquals("link", link.getTagName());
        assertEquals("", link.getCharsetAttribute());
        String url = this.url.toString();
        url = url.substring(0, url.length() - 1);
        url = url.substring(url.lastIndexOf('/'));
        assertEquals(url + "/stylesheet.css", link.getHrefAttribute());
        assertEquals("", link.getHrefLangAttribute());
        assertEquals("", link.getMediaAttribute());
        assertEquals("stylesheet", link.getRelAttribute());
        assertEquals("", link.getRevAttribute());
        assertEquals("", link.getTargetAttribute());
        assertEquals("text/css", link.getTypeAttribute());
       
    }
View Full Code Here

    /**
     * <p>Verify the presence and contents of a stylesheet element.</p>
     */
    public void testStylesheet() throws Exception {

        HtmlLink link = null;
        Iterator kids = head().getChildElements().iterator();
        while (kids.hasNext()) {
            HtmlElement kid = (HtmlElement) kids.next();
            if (kid instanceof HtmlLink) {
                assertNull("Only one stylesheet element present", link);
                link = (HtmlLink) kid;
            }
        }
        assertNotNull("Exactly one stylesheet element present", link);
        assertEquals("link", link.getTagName());
        assertEquals("", link.getCharsetAttribute());
        String url = this.url.toString();
        url = url.substring(0, url.length() - 1);
        url = url.substring(url.lastIndexOf('/'));
        assertEquals(url + "/stylesheet.css", link.getHrefAttribute());
        assertEquals("", link.getHrefLangAttribute());
        assertEquals("", link.getMediaAttribute());
        assertEquals("stylesheet", link.getRelAttribute());
        assertEquals("", link.getRevAttribute());
        assertEquals("", link.getTargetAttribute());
        assertEquals("text/css", link.getTypeAttribute());
       
    }
View Full Code Here

  public void testRenderStyle() throws Exception {
    HtmlPage page = renderView();
    assertNotNull(page);
    List styles = page.getDocumentElement().getHtmlElementsByTagName("link");
    for (Iterator it = styles.iterator(); it.hasNext();) {
      HtmlLink item = (HtmlLink) it.next();
      String srcAttr = item.getHrefAttribute();

      if (StringUtils.isNotBlank(srcAttr)) {
        boolean found = false;
        for (Iterator srcIt = cssStyles.iterator(); srcIt.hasNext();) {
          String src = (String) srcIt.next();
View Full Code Here

    createAndAddStyleResource(RESOURCE_URI_PREFIX + userXcss);
    createAndAddStyleResource(RESOURCE_URI_PREFIX + componentXcss).setRendered(false);
   
    HtmlPage page = renderView();
    List<HtmlLink> styles;
    HtmlLink userLink;
   
    styles = selectStylesByHhref(page, userXcss);
    assertEquals(1, styles.size());
    userLink = styles.get(0);
    assertEquals("user", userLink.getClassAttribute());
    assertEquals("", userLink.getMediaAttribute());

    styles = selectStylesByHhref(page, componentXcss);
    assertEquals(0, styles.size());
  }
View Full Code Here

    styleComponent.setSrc(InternetResourceBuilder.getInstance().getResourceForKey(userXcss));
    facesContext.getViewRoot().getChildren().add(styleComponent);
   
    HtmlPage page = renderView();
    List<HtmlLink> styles;
    HtmlLink userLink;
   
    styles = selectStylesByHhref(page, userXcss);
    assertEquals(1, styles.size());
    userLink = styles.get(0);
    assertEquals("user", userLink.getClassAttribute());
    assertEquals("", userLink.getMediaAttribute());

    styles = selectStylesByHhref(page, componentXcss);
    assertEquals(1, styles.size());
    userLink = styles.get(0);
    assertEquals("user", userLink.getClassAttribute());
    assertEquals("", userLink.getMediaAttribute());
  }
View Full Code Here

      getAttributes().put(HTML.media_ATTRIBUTE, "screen print");
   
    HtmlPage page = renderView();
    List<HtmlLink> styles = selectStylesByHhref(page, userXcss);
    assertEquals(1, styles.size());
    HtmlLink userLink = styles.get(0);
    assertEquals("user", userLink.getClassAttribute());
    assertEquals("screen print", userLink.getMediaAttribute());
  }
View Full Code Here

    /**
     * <p>Verify the presence and contents of a stylesheet element.</p>
     */
    public void testStylesheet() throws Exception {

        HtmlLink link = null;
        Iterator kids = head().getChildElements().iterator();
        while (kids.hasNext()) {
            HtmlElement kid = (HtmlElement) kids.next();
            if (kid instanceof HtmlLink) {
                assertNull("Only one stylesheet element present", link);
                link = (HtmlLink) kid;
            }
        }
        assertNotNull("Exactly one stylesheet element present", link);
        assertEquals("link", link.getTagName());
        assertEquals("", link.getCharsetAttribute());
        String url = this.url.toString();
        url = url.substring(0, url.length() - 1);
        url = url.substring(url.lastIndexOf('/'));
        assertEquals(url + "/stylesheet.css", link.getHrefAttribute());
        assertEquals("", link.getHrefLangAttribute());
        assertEquals("", link.getMediaAttribute());
        assertEquals("stylesheet", link.getRelAttribute());
        assertEquals("", link.getRevAttribute());
        assertEquals("", link.getTargetAttribute());
        assertEquals("text/css", link.getTypeAttribute());
       
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.HtmlLink

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.