You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2021/12/19 18:09:19 UTC

[royale-asjs] branch develop updated: Should be null and not undefined

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 58a40b4  Should be null and not undefined
58a40b4 is described below

commit 58a40b46cd376d1f348e349539b1df55eb665502
Author: Harbs <ha...@in-tools.com>
AuthorDate: Sun Dec 19 20:09:11 2021 +0200

    Should be null and not undefined
---
 frameworks/projects/XML/src/main/royale/XML.as     |  2 +-
 .../test/royale/flexUnitTests/xml/XMLQNameTest.as  | 33 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/XML/src/main/royale/XML.as b/frameworks/projects/XML/src/main/royale/XML.as
index 090c543..6586ebf 100644
--- a/frameworks/projects/XML/src/main/royale/XML.as
+++ b/frameworks/projects/XML/src/main/royale/XML.as
@@ -1895,7 +1895,7 @@ package
 		{
 			/*if(!_name)
 				_name = getQName("","","",false);*/
-			return _name;
+			return _name ? _name : null;
 		}
 		
 		/**
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLQNameTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLQNameTest.as
index 6412658..5965a4f 100644
--- a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLQNameTest.as
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLQNameTest.as
@@ -22,6 +22,7 @@ package flexUnitTests.xml
     
     import flexUnitTests.xml.support.QNameTest;    
     import org.apache.royale.test.asserts.*;
+    import org.apache.royale.test.asserts.assertStrictlyEquals;
     
    // import testshim.RoyaleUnitTestRunner;
     
@@ -297,7 +298,37 @@ package flexUnitTests.xml
             assertTrue(test6 == test1, 'unexpected equality result');
             
         }
-        
+        [Test]
+        public function testXMLWithNamespace():void{
+            var xml:XML = 
+                    <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
+                        soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
+
+                                    <soap:Body xmlns:wx = "http://example.com/weather">
+                            <wx:forecast>
+                                <wx:city>Quito</wx:city>
+                            </wx:forecast>
+                        </soap:Body>
+                    </soap:Envelope>;
+                    
+            assertEquals(xml.name().localName,"Envelope", "unexpected localName result");
+            assertEquals(xml.name().uri,"http://www.w3.org/2001/12/soap-envelope","unexpected uri result");
+        }
+
+        [Test]
+        public function testNameWithTextAndAttribute():void{
+            var xml:XML = 
+                    <foo x="15" y="22">
+                        text
+                    </foo>;
+                    
+            assertEquals(xml.name().localName,"foo");
+            assertEquals(xml.name().uri, "","unexpected uri result");
+            assertEquals(xml.children()[0],"text","unexpected text result");
+            assertStrictlyEquals(xml.children()[0].name(),null,"unexpected name to be null and not undefined");
+            assertEquals(xml.attributes()[0],15,"unexpected attribute result");
+            assertEquals(xml.attributes()[0].name(),"x","unexpected name result");
+        }        
        
     }
 }