Package com.google.template.soy.soytree

Examples of com.google.template.soy.soytree.SoyFileSetNode


  public void testAutoescapeOnSimple() throws Exception {

    String testPrintTags = "{'<br>'}";
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, true);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(0, printNodes.get(0).getChildren().size());
View Full Code Here


  public void testAutoescapeOnWithOtherDirectives() throws Exception {

    String testPrintTags = "{'<br>' |boo:5}";
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, true);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(1, printNodes.get(0).getChildren().size());
    assertEquals("|boo", printNodes.get(0).getChild(0).getName());
View Full Code Here

  public void testAutoescapeOnWithNoAutoescape() throws Exception {

    String testPrintTags = "{'<br>' |noAutoescape}{'<br>' |noAutoescape |noAutoescape}";
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, true);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(1, printNodes.get(0).getChildren().size());
    assertEquals(NoAutoescapeDirective.NAME, printNodes.get(0).getChild(0).getName());
View Full Code Here

    String testPrintTags =
        "{'<br>' |escapeHtml}{'<br>' |noAutoescape |escapeHtml}{'<br>' |escapeHtml |noAutoescape}";
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, true);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(1, printNodes.get(0).getChildren().size());
    assertEquals(EscapeHtmlDirective.NAME, printNodes.get(0).getChild(0).getName());
View Full Code Here

  public void testAutoescapeOffSimple() throws Exception {

    String testPrintTags = "{'<br>'}";
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, false);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(0, printNodes.get(0).getChildren().size());
View Full Code Here

  public void testAutoescapeOffWithOtherDirectives() throws Exception {

    String testPrintTags = "{'<br>' |boo:5}"// V1
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, false);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(1, printNodes.get(0).getChildren().size());
    assertEquals("|boo", printNodes.get(0).getChild(0).getName());
View Full Code Here

  public void testAutoescapeOffWithNoAutoescape() throws Exception {

    String testPrintTags = "{'<br>' |noescape}{'<br>' |noAutoescape |noAutoescape}"// V1 & V2
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, false);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(1, printNodes.get(0).getChildren().size());
    assertEquals(NoAutoescapeDirective.NAME, printNodes.get(0).getChild(0).getName());
View Full Code Here

    String testPrintTags =
        "{'<br>' |escape}{'<br>' |noAutoescape |escapeHtml}{'<br>' |escape |noescape}"// V1 & V2
    Pair<SoyFileSetNode, List<PrintNode>> helperRetVal =
        parseTestPrintTagsHelper(testPrintTags, false);
    SoyFileSetNode soyTree = helperRetVal.first;
    List<PrintNode> printNodes = helperRetVal.second;

    // Before.
    assertEquals(1, printNodes.get(0).getChildren().size());
    assertEquals(EscapeHtmlDirective.NAME, printNodes.get(0).getChild(0).getName());
View Full Code Here

        "/** Foo template. */\n" +
        "{template name=\".foo\"" + (shouldAutoescape ? "" : " autoescape=\"false\"") + "}\n" +
        testPrintTags + "\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);
    SoyFileNode soyFile = soyTree.getChild(0);

    List<PrintNode> printNodes = Lists.newArrayList();
    for (SoyNode child : soyFile.getChild(0).getChildren()) {
      printNodes.add((PrintNode) child);
    }
View Full Code Here

public class HandleCssCommandVisitorTest extends TestCase {


  public void testHandleLiteral() {

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode("{css selected-option}");
    (new HandleCssCommandVisitor(CssHandlingScheme.LITERAL)).exec(soyTree);
    SoyNode soyNode = SharedTestUtils.getNode(soyTree, 0);
    assertEquals("selected-option", ((RawTextNode) soyNode).getRawText());
  }
View Full Code Here

TOP

Related Classes of com.google.template.soy.soytree.SoyFileSetNode

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.