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/f411798f Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f411798f Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f411798f Branch: refs/heads/develop Commit: f411798f92e23e9b25b6f29899f375c6834d0831 Parents: af880a5 Author: Erik de Bruin <[email protected]> Authored: Mon Jun 30 12:08:28 2014 +0200 Committer: Erik de Bruin <[email protected]> Committed: Fri Aug 1 12:59:14 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/f411798f/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>"); + } + }
