Package com.google.template.soy.soytree

Examples of com.google.template.soy.soytree.TemplateNode.numChildren()


    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);
    TemplateNode template = (TemplateNode) SharedTestUtils.getNode(soyTree);
    template.addChild(new RawTextNode(0, "bleh"));
    template.addChild(new RawTextNode(0, "bluh"));

    assertEquals(5, template.numChildren());

    (new CombineConsecutiveRawTextNodesVisitor()).exec(soyTree);

    assertEquals(3, template.numChildren());
    assertEquals("Blah", ((RawTextNode) template.getChild(0)).getRawText());
View Full Code Here


    assertEquals(5, template.numChildren());

    (new CombineConsecutiveRawTextNodesVisitor()).exec(soyTree);

    assertEquals(3, template.numChildren());
    assertEquals("Blah", ((RawTextNode) template.getChild(0)).getRawText());
    assertEquals("blahblehbluh", ((RawTextNode) template.getChild(2)).getRawText());
  }

}
View Full Code Here

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);
    TemplateNode template = (TemplateNode) SharedTestUtils.getNode(soyTree);

    // Before.
    assertEquals(7, template.numChildren());

    (new RemoveHtmlCommentsVisitor()).exec(soyTree);

    // After.
    assertEquals(4, template.numChildren());
View Full Code Here

    assertEquals(7, template.numChildren());

    (new RemoveHtmlCommentsVisitor()).exec(soyTree);

    // After.
    assertEquals(4, template.numChildren());
    assertEquals("$boo", ((PrintNode) template.getChild(0)).getExprText());
    assertEquals("Blah blah.", ((RawTextNode) template.getChild(1)).getRawText());
    assertEquals("$boo", ((PrintNode) template.getChild(2)).getExprText());
    assertEquals("$boo", ((PrintNode) template.getChild(3)).getExprText());
  }
View Full Code Here

    TemplateNode template =
        (TemplateNode) SharedTestUtils.getNode(SharedTestUtils.parseSoyFiles(TEST_FILE_CONTENT));

    // Before.
    assertEquals(9, template.numChildren());
    CssNode cn1 = (CssNode) template.getChild(1);
    assertEquals("AAA", cn1.getSelectorText());
    CssNode cn7 = (CssNode) template.getChild(7);
    assertEquals("$goo", cn7.getComponentNameText());
    assertEquals("BBB", cn7.getSelectorText());
View Full Code Here

    (new RenameCssVisitor(null)).exec(template);
    (new CombineConsecutiveRawTextNodesVisitor()).exec(template);

    // After.
    assertEquals(5, template.numChildren());
    RawTextNode rtn0 = (RawTextNode) template.getChild(0);
    assertEquals("<div class=\"AAA ", rtn0.getRawText());
    PrintNode pn1 = (PrintNode) template.getChild(1);
    assertEquals("$goo", pn1.getExprText());
    RawTextNode rtn2 = (RawTextNode) template.getChild(2);
View Full Code Here

    TemplateNode template =
        (TemplateNode) SharedTestUtils.getNode(SharedTestUtils.parseSoyFiles(TEST_FILE_CONTENT));

    // Before.
    assertEquals(9, template.numChildren());
    CssNode cn1 = (CssNode) template.getChild(1);
    assertEquals("AAA", cn1.getSelectorText());
    CssNode cn7 = (CssNode) template.getChild(7);
    assertEquals("$goo", cn7.getComponentNameText());
    assertEquals("BBB", cn7.getSelectorText());
View Full Code Here

    (new RenameCssVisitor(cssRenamingMap)).exec(template);
    (new CombineConsecutiveRawTextNodesVisitor()).exec(template);

    // After.
    assertEquals(5, template.numChildren());
    RawTextNode rtn0 = (RawTextNode) template.getChild(0);
    assertEquals("<div class=\"XXX ", rtn0.getRawText());
    PrintNode pn1 = (PrintNode) template.getChild(1);
    assertEquals("$goo", pn1.getExprText());
    RawTextNode rtn2 = (RawTextNode) template.getChild(2);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.