Update VF2JS MXML node tests with tests for attributes. Signed-off-by: Erik de Bruin <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/0125c66b Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/0125c66b Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/0125c66b Branch: refs/heads/VF2JS Commit: 0125c66b61abb6edceb79d3c331c0a75254a7ecd Parents: 6305027 Author: Erik de Bruin <[email protected]> Authored: Mon Jun 30 12:08:28 2014 +0200 Committer: Erik de Bruin <[email protected]> Committed: Mon Jun 30 12:08:28 2014 +0200 ---------------------------------------------------------------------- .../codegen/mxml/vf2js/TestVF2JSMXMLNodes.java | 46 +++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0125c66b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLNodes.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLNodes.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLNodes.java index 2cd9ac3..24bac96 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLNodes.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/TestVF2JSMXMLNodes.java @@ -27,7 +27,7 @@ public class TestVF2JSMXMLNodes extends VF2JSTestBase { @Test - public void testSimpleNode() + public void testSimpleButtonNode() { String code = "<s:Button />"; @@ -40,4 +40,48 @@ public class TestVF2JSMXMLNodes extends VF2JSTestBase assertOut("<Button></Button>"); } + @Test + public void testButtonNodeWithVF2JSAttribute() + { + String code = "<s:Button label=\"hello\" />"; + + IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode( + code, IMXMLPropertySpecifierNode.class, + MXMLTestBase.WRAP_LEVEL_DOCUMENT); + + mxmlBlockWalker.visitPropertySpecifier(node); + + assertOut("<Button label=\"hello\"></Button>"); + } + + @Test + public void testButtonNodeWithNonVF2JSAttribute() + { + String code = "<s:Button string=\"bye\" />"; + + IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode( + code, IMXMLPropertySpecifierNode.class, + MXMLTestBase.WRAP_LEVEL_DOCUMENT); + + mxmlBlockWalker.visitPropertySpecifier(node); + + // (erikdebruin) The attribute doesn't exist in VF2JS, so it's ignored + assertOut("<Button></Button>"); + } + + @Test + public void testButtonNodeWithBothVF2JSAndNonVF2JSAttribute() + { + String code = "<s:Button label=\"hello\" string=\"bye\" />"; + + IMXMLPropertySpecifierNode node = (IMXMLPropertySpecifierNode) getNode( + code, IMXMLPropertySpecifierNode.class, + MXMLTestBase.WRAP_LEVEL_DOCUMENT); + + mxmlBlockWalker.visitPropertySpecifier(node); + + // (erikdebruin) The attribute 'string' doesn't exist in VF2JS, so it's ignored + assertOut("<Button label=\"hello\"></Button>"); + } + }
