Package com.google.gxp.compiler.ifexpand

Examples of com.google.gxp.compiler.ifexpand.IfExpandedTree


  /**
   * Creates a parse tree.
   */
  private IfExpandedTree tree(ParsedElement... children) {
    return new IfExpandedTree(new SourcePosition(filename),
                              parseAlerts.buildAndClear(), list(children));
  }
View Full Code Here


    return new ParsedAttribute(pos(), NullNamespace.INSTANCE, name, value,
                               name);
  }

  public void testBaseCase() throws Exception {
    IfExpandedTree input = tree();
    ReparentedTree output = reparent(input);
    assertTrue(output.getRoot() instanceof NullRoot);
  }
View Full Code Here

  }

  public void testEmptyNamelessTemplate() throws Exception {
    ParsedElement template = template(NO_ATTRS);
    expectedAlerts.add(new MissingAttributeError(template, "name"));
    IfExpandedTree parseTree = tree(template);
    ReparentedTree output = reparent(parseTree);
    assertOneRoot(output);
    Template root = getTemplate(output.getRoot());
    assertEquals(TEMPLATE_NAME.toString(), root.getName().toString());
    assertEquals(0, root.getImports().size());
View Full Code Here

    assertEquals(0, root.getParameters().size());
    assertEmptyValue(root.getContent());
  }

  public void testNamedTemplate() throws Exception {
    IfExpandedTree parseTree = tree(template(list(attr("name", "pkg.Test"))));
    ReparentedTree output = reparent(parseTree);
    assertOneRoot(output);
    Template root = getTemplate(output.getRoot());
    assertEquals(TEMPLATE_NAME, root.getName());
    assertEquals(0, root.getImports().size());
View Full Code Here

  public void testTemplateWithBadAttr() throws Exception {
    ParsedAttribute spaz = attr("spaz", "I don't exist!");
    ParsedElement template = template(list(attr("name", "pkg.Test"), spaz));
    expectedAlerts.add(new UnknownAttributeError(template, spaz));
    IfExpandedTree parseTree = tree(template);
    ReparentedTree output = reparent(parseTree);
    assertOneRoot(output);
    Template root = getTemplate(output.getRoot());
    assertEquals(TEMPLATE_NAME, root.getName());
    assertEquals(0, root.getImports().size());
View Full Code Here

    assertEquals(0, root.getParameters().size());
    assertEmptyValue(root.getContent());
  }

  public void testTemplateWithImports() throws Exception {
    IfExpandedTree parseTree =
        tree(template(list(attr("name", "pkg.Test")),
                      imp(list(attr("class", "com.google.Foo"))),
                      imp(list(attr("package", "com.google.bar"))),
                      imp(list(attr("class", "com.google.Baz")))));
    ReparentedTree output = reparent(parseTree);
View Full Code Here

  public void testImportWithText() throws Exception {
    TextElement textNode = text("gremlin");
    ParsedElement badImp = imp(list(attr("class", "com.google.Foo")),
                               textNode);
    IfExpandedTree parseTree =
        tree(template(list(attr("name", "pkg.Test")),
                      badImp,
                      imp(list(attr("package", "com.google.bar"))),
                      imp(list(attr("class", "com.google.Baz")))));
    ReparentedTree output = reparent(parseTree);
View Full Code Here

    assertEquals(0, root.getParameters().size());
    assertEmptyValue(root.getContent());
  }

  public void testTemplateWithParams() throws Exception {
    IfExpandedTree parseTree =
        tree(template(list(attr("name", "pkg.Test")),
                      param(list(attr("name", "x"),
                                 attr("type", "int"))),
                      param(list(attr("type", "String"),
                                 attr("default", "\"xyzzy\""),
View Full Code Here

    assertEquals("\"xyzzy\"", ((NativeExpression) defValue).getDefaultNativeCode());
    assertEmptyValue(root.getContent());
  }

  public void testTemplateWithKids() throws Exception {
    IfExpandedTree parseTree =
        tree(template(list(attr("name", "pkg.Test")),
                      tag("img", list(attr("src", "Uno"))),
                      tag("p", list(attr("class", "Dos"))),
                      tag("div", list(attr("id", "Windows")))));
    ReparentedTree output = reparent(parseTree);
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.ifexpand.IfExpandedTree

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.