Package org.apache.flex.compiler.tree.mxml

Examples of org.apache.flex.compiler.tree.mxml.IMXMLScriptNode


public class MXMLScriptNodeTests extends MXMLNodeBaseTests
{
  private IMXMLScriptNode getMXMLScriptNode(String[] code)
  {
    IMXMLFileNode fileNode = getMXMLFileNode(code);
    IMXMLScriptNode node = (IMXMLScriptNode)findFirstDescendantOfType(fileNode, IMXMLScriptNode.class);
    assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLScriptID));
    assertThat("getName", node.getName(), is("Script"));
    return node;
  }
View Full Code Here


  {
    String[] code = new String[]
    {
      "<fx:Script/>"
    };
    IMXMLScriptNode node = getMXMLScriptNode(code);
    assertThat("getChildCount", node.getChildCount(), is(0));
  }
View Full Code Here

  {
    String[] code = new String[]
    {
      "<fx:Script></fx:Script>"
    };
    IMXMLScriptNode node = getMXMLScriptNode(code);
    assertThat("getChildCount", node.getChildCount(), is(0));
  }
View Full Code Here

  {
    String[] code = new String[]
    {
      "<fx:Script/> \t\r\n<fx:Script/>"
    };
    IMXMLScriptNode node = getMXMLScriptNode(code);
    assertThat("getChildCount", node.getChildCount(), is(0));
  }
View Full Code Here

      "<fx:Script>",
      "    private var i:int = 1;",
      "    private function f():void { };",
      "</fx:Script>"
    };
    IMXMLScriptNode node = getMXMLScriptNode(code);
    assertThat("getChildCount", node.getChildCount(), is(2));
    assertThat("child 0", node.getChild(0).getNodeID(), is(ASTNodeID.VariableID));
    assertThat("child 1", node.getChild(1).getNodeID(), is(ASTNodeID.FunctionID));
  }
View Full Code Here

        // TODO (erikdebruin) fix indentation...
        String code = "" + "<fx:Script><![CDATA[" + "    var n:int = 3;"
                + "    for (var i:int = 0; i < n; i++)" + "    {"
                + "        Alert.show(\"Hi\");" + "    }" + "]]></fx:Script>";

        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);

        mxmlBlockWalker.visitScript(node);

        assertOut("<script><![CDATA[\n\tvar n:int = 3;\n\tfor (var i:int = 0; i < n; i++) {\n\tAlert.show(\"Hi\");\n};\n]]></script>");
View Full Code Here

    @Test
    public void testEmptyScript()
    {
        String code = "" + "<fx:Script><![CDATA[]]></fx:Script>";

        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);

        mxmlBlockWalker.visitScript(node);

        assertOut("<script><![CDATA[]]></script>");
View Full Code Here

    {
        String code = "" + "<fx:Script><![CDATA["
                + "    private const GREETING:String = \"Hello world!\";"
                + "]]></fx:Script>";

        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);

        mxmlBlockWalker.visitScript(node);

        assertOut("<script><![CDATA[\n\tprivate const GREETING:String = \"Hello world!\";\n]]></script>");
View Full Code Here

        String code = "" + "<fx:Script><![CDATA["
                + "    public var goodbye:String = \"Bye bye :-(\";"
                + "    private const GREETING:String = \"Hello world!\";"
                + "]]></fx:Script>";

        IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
                IMXMLScriptNode.class, MXMLTestBase.WRAP_LEVEL_DOCUMENT);

        mxmlBlockWalker.visitScript(node);

        assertOut("<script><![CDATA[\n\tpublic var goodbye:String = \"Bye bye :-(\";\n\tprivate const GREETING:String = \"Hello world!\";\n]]></script>");
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.tree.mxml.IMXMLScriptNode

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.