Package com.google.gxp.compiler.alerts.common

Examples of com.google.gxp.compiler.alerts.common.MissingAttributeError


  public void testCall_requiredParamMissing() throws Exception {
    String endCall = "</my:" + getTemplateBaseName() + ">";
    compile("<gxp:param type='String' name='s'/>",
            "<my:" + getTemplateBaseName() + "/>");
    assertAlert(new MissingAttributeError(pos(3, 1),
                                          "<my:" + getTemplateBaseName() + ">",
                                          "s"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here


    assertNoUnexpectedAlerts();
  }

  public void testOutputElement_requiredAttrMissing() throws Exception {
    compile("<img src='foo.jpg'/>");
    assertAlert(new MissingAttributeError(pos(2,1), "<img>", "alt"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

  public void testCond_oneClauseWithNoCond() throws Exception {
    compile("<gxp:cond>",
            "  <gxp:clause>",
            "  </gxp:clause>",
            "</gxp:cond>");
    assertAlert(new MissingAttributeError(pos(3,3), "<gxp:clause>", "cond"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

            "  <gxp:clause>",
            "  </gxp:clause>",
            "  <gxp:clause>",
            "  </gxp:clause>",
            "</gxp:cond>");
    assertAlert(new MissingAttributeError(pos(3,3), "<gxp:clause>", "cond"));
    assertAlert(new MissingAttributeError(pos(5,3), "<gxp:clause>", "cond"));
    // last clause should not generate an error as it does not require a condition
    // (it's the default clause)
    assertNoUnexpectedAlerts();
  }
View Full Code Here

    assertIllegalExpressionDetected("<gxp:if cond='", "'/>");
  }

  public void testIf_missingCond() throws Exception {
    compile("<gxp:if></gxp:if>");
    assertAlert(new MissingAttributeError(pos(2,1), "<gxp:if>", "cond"));
    assertNoUnexpectedAlerts();
  }
View Full Code Here

                                  Expression fallback,
                                  boolean optional) {
    Attribute attr = getAttribute(ns, name);
    if (attr == null) {
      if (!optional) {
        alertSink.add(new MissingAttributeError(forNode, name));
      }
      return fallback;
    } else {
      return attr.getValue();
    }
View Full Code Here

    }

    MultiLanguageAttrValue mlar = getMultiLanguageAttrValue(name, true);
    if (mlar.isEmpty()) {
      if (!optional) {
        alertSink.add(new MissingAttributeError(forNode, name));
      }
      return fallback;
    }
    return new NativeExpression(forNode.getSourcePosition(), "'" + name + "' attribute", mlar);
  }
View Full Code Here

    return (Template)root;
  }

  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());
View Full Code Here

  public void tearDown() throws Exception {
    assertEquals(expectedAlerts.buildAndClear(), actualAlerts.buildAndClear());
  }

  public void testNotFoundWithFallback() throws Exception {
    expectedAlerts.add(new MissingAttributeError(fromNode, "foo"));

    assertEquals("bar", attrMap.get("foo", "bar"));
    attrMap.reportUnusedAttributes();
  }
View Full Code Here

    assertEquals("bar", attrMap.get("foo", "bar"));
    attrMap.reportUnusedAttributes();
  }

  public void testNotFoundWithoutFallback() throws Exception {
    expectedAlerts.add(new MissingAttributeError(fromNode, "foo"));

    assertEquals(null, attrMap.get("foo", null));
    attrMap.reportUnusedAttributes();
  }
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.alerts.common.MissingAttributeError

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.